Skip to content

Commit d58e9c7

Browse files
committed
add script
1 parent d20fc67 commit d58e9c7

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ next-env.d.ts
3838

3939
# misc
4040
.vscode
41+
*.jsonl

scripts/download.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import prisma from "@/lib/prisma";
2+
import "dotenv-flow/config";
3+
import * as fs from "fs";
4+
5+
async function main() {
6+
const projects = await prisma.project.findMany({
7+
select: {
8+
id: true,
9+
name: true,
10+
description: true,
11+
slug: true,
12+
},
13+
orderBy: {
14+
createdAt: "asc",
15+
},
16+
});
17+
18+
// save as JSONL
19+
const file = fs.createWriteStream("projects.jsonl");
20+
projects.forEach((project) => {
21+
file.write(JSON.stringify(project) + "\n");
22+
});
23+
}
24+
25+
main();

0 commit comments

Comments
 (0)