Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

cleanup scripts

Steven Tey3f3aa4feb5b8
diff --git a/apps/web/scripts/find-link.ts b/apps/web/scripts/find-link.ts
new file mode 100644
index 0000000000..1f0e46b230
--- /dev/null
+++ b/apps/web/scripts/find-link.ts
@@ -0,0 +1,20 @@
+import { prisma } from "@dub/prisma";
+import "dotenv-flow/config";
+
+async function main() {
+ const links = await prisma.link.findMany({
+ where: {
+ projectId: "xxx",
+ url: "https://example.com",
+ },
+ select: {
+ id: true,
+ shortLink: true,
+ url: true,
+ },
+ });
+
+ console.table(links);
+}
+
+main();
diff --git a/apps/web/scripts/flodesk-create-webhook.ts b/apps/web/scripts/flodesk-create-webhook.ts
deleted file mode 100644
index 8ccb89c897..0000000000
--- a/apps/web/scripts/flodesk-create-webhook.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import "dotenv-flow/config";
-
-async function main() {
- const res = await fetch("https://api.flodesk.com/v1/webhooks", {
- method: "GET",
- headers: {
- "Content-Type": "application/json",
- Authorization: `Basic ${process.env.FLODESK_API_KEY}`,
- },
- // body: JSON.stringify({
- // name: "Unsubscribed Webhook",
- // post_url:
- // "https://app.dub.co/api/callback/flodesk?token=9155f7737cd484b668fc4d4ba0532eef",
- // events: ["subscriber.unsubscribed"],
- // }),
- // }).then((res) => ({
- // limit: res.headers.get("X-Fd-RateLimit-Limit"),
- // remaining: res.headers.get("X-Fd-RateLimit-Remaining"),
- // }));
- }).then((res) => res.json());
-
- console.log(JSON.stringify(res, null, 2));
-}
-
-main();
diff --git a/apps/web/scripts/migrate.ts b/apps/web/scripts/migrate.ts
deleted file mode 100644
index 71ad42ac0e..0000000000
--- a/apps/web/scripts/migrate.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { prisma } from "@dub/prisma";
-import "dotenv-flow/config";
-
-const DOMAIN = "x.com";
-const PROJECT_ID = "xxx";
-
-async function main() {
- const response = await prisma.project.findMany({
- where: {
- id: {
- not: {
- startsWith: "c",
- },
- },
- },
- });
- console.log({ response });
-}
-
-main();
diff --git a/apps/web/scripts/purge-old-link-cache.ts b/apps/web/scripts/purge-old-link-cache.ts
deleted file mode 100644
index d75e3564dd..0000000000
--- a/apps/web/scripts/purge-old-link-cache.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { prisma } from "@dub/prisma";
-import "dotenv-flow/config";
-import { redis } from "../lib/upstash";
-
-const batch = 3;
-
-// script to remove old redis link cache entries
-async function main() {
- const domains = await prisma.domain.findMany({
- orderBy: {
- createdAt: "asc",
- },
- take: 500,
- skip: batch * 500,
- });
-
- for (const domain of domains) {
- const res = await redis.del(domain.slug);
- console.log(`Deleted ${domain.slug} from redis: ${res}`);
- }
-}
-
-main();
diff --git a/apps/web/scripts/stripe-init.ts b/apps/web/scripts/stripe-init.ts
deleted file mode 100644
index 9e068f75cb..0000000000
--- a/apps/web/scripts/stripe-init.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import Stripe from "stripe";
-
-export const stripe = new Stripe(`${process.env.STRIPE_SECRET_KEY}`, {
- apiVersion: "2025-05-28.basil",
- appInfo: {
- name: "Dub.co",
- version: "0.1.0",
- },
-});
diff --git a/apps/web/scripts/stripe-testing.ts b/apps/web/scripts/stripe-testing.ts
deleted file mode 100644
index f5a8ae7335..0000000000
--- a/apps/web/scripts/stripe-testing.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-// Just for testing
-
-import "dotenv-flow/config";
-import { stripe } from "../lib/stripe";
-
-async function main() {
- const session = await stripe.checkout.sessions.create({
- mode: "setup",
- customer: "cus_RPOmxGDnMiVIa3",
- payment_method_types: ["us_bank_account"],
- success_url: "https://example.com/success",
- cancel_url: "https://example.com/cancel",
- });
-
- console.log("Checkout session created:", session);
-}
-
-main();