import db from ".";
import { hashPassword } from "../lib/crypto";
import { file } from "./schema/file";
import { user } from "./schema/user";
const main = async () => {
const [adminUser] = await db
.insert(user)
.values({
email: "admin@mail.com",
password: await hashPassword("123456"),
})
.returning();
// await db
// .insert(file)
// .values([
// {
// userId: adminUser.id,
// path: "index.html",
// filename: "index.html",
// content: '
Hello world!
',
// },
// {
// userId: adminUser.id,
// path: "styles.css",
// filename: "styles.css",
// content: "body { padding: 16px; }",
// },
// {
// userId: adminUser.id,
// path: "script.js",
// filename: "script.js",
// content: "console.log('hello world!');",
// },
// {
// userId: adminUser.id,
// path: "_layout.html",
// filename: "_layout.html",
// content: `
//
//
//
//
// Document
//
//
//
//
// {CONTENT}
//
//
// `,
// },
// ])
// .execute();
// react template
await db
.insert(file)
.values([
{
userId: adminUser.id,
path: "index.html",
filename: "index.html",
content: `
React + Tailwind Template
`,
},
{
userId: adminUser.id,
path: "globals.css",
filename: "globals.css",
content: `@tailwind base;
@tailwind components;
@tailwind utilities;
body {
@apply p-4;
}
`,
},
{
userId: adminUser.id,
path: "index.jsx",
filename: "index.jsx",
content: `import React from "react";
import { createRoot } from "react-dom/client";
import App from "./App.jsx";
const root = createRoot(document.getElementById("app"));
root.render();
`,
},
{
userId: adminUser.id,
path: "App.jsx",
filename: "App.jsx",
isPinned: true,
content: `import React from "react";
const App = () => {
return (
React + Tailwind Template!
Open App.jsx to edit this text.
);
};
export default App;
`,
},
])
.execute();
process.exit();
};
main();