The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
update scripts & gitignore
Steven Tey738bd405e780
diff --git a/.gitignore b/.gitignoreindex b5cee4ed5f..dba2ab1b6b 100644--- a/.gitignore+++ b/.gitignore@@ -41,4 +41,5 @@ next-env.d.ts.react-email.contentlayer.vscode-*.csv\ No newline at end of file+*.csv+*.ndjson\ No newline at end of filediff --git a/apps/web/scripts/get-active-projects.ts b/apps/web/scripts/get-projects-by-clicks.tssimilarity index 100%rename from apps/web/scripts/get-active-projects.tsrename to apps/web/scripts/get-projects-by-clicks.tsdiff --git a/apps/web/scripts/get-projects-by-links.ts b/apps/web/scripts/get-projects-by-links.tsnew file mode 100644index 0000000000..9084756b8a--- /dev/null+++ b/apps/web/scripts/get-projects-by-links.ts@@ -0,0 +1,46 @@+import "dotenv-flow/config";+import prisma from "@/lib/prisma";++async function main() {+ const projects = await prisma.link+ .groupBy({+ by: ["projectId"],+ _count: {+ id: true,+ },+ orderBy: {+ _count: {+ id: "desc",+ },+ },+ take: 100,+ })+ .then(+ async (projects) =>+ await Promise.all(+ projects.map(async ({ _count, projectId }) => {+ if (!projectId) {+ return;+ }+ const project = await prisma.project.findUnique({+ where: {+ id: projectId,+ },+ select: {+ slug: true,+ plan: true,+ },+ });+ return {+ project: project?.slug,+ plan: project?.plan,+ links: _count.id,+ };+ }),+ ),+ );++ console.table(projects);+}++main();