import db from "."; import { hashPassword } from "../lib/crypto"; import { uid } from "../lib/utils"; import { file } from "./schema/file"; import { project } from "./schema/project"; import { user } from "./schema/user"; const main = async () => { const [adminUser] = await db .insert(user) .values({ name: "Admin", email: "admin@mail.com", password: await hashPassword("123456"), }) .returning(); const [vanillaProject] = await db .insert(project) .values({ userId: adminUser.id, slug: uid(), title: "Vanilla Project" }) .returning(); // vanilla html css js template await db .insert(file) .values([ { projectId: vanillaProject.id, path: "index.html", filename: "index.html", content: "
Hello world!
", isPinned: true, }, { projectId: vanillaProject.id, path: "styles.css", filename: "styles.css", content: "body { padding: 16px; }", isPinned: true, }, { projectId: vanillaProject.id, path: "scripts.js", filename: "scripts.js", content: "console.log('hello world!');", isPinned: true, }, { projectId: vanillaProject.id, path: "_layout.html", filename: "_layout.html", content: `Open App.jsx to edit this text.