The first commit, the core and all files is adding to repo
This commit is contained in:
32
scripts/setup.mjs
Normal file
32
scripts/setup.mjs
Normal file
@@ -0,0 +1,32 @@
|
||||
import { spawn } from "node:child_process";
|
||||
import { existsSync } from "node:fs";
|
||||
import { copyFile, mkdir } from "node:fs/promises";
|
||||
import { prepareAssets } from "./assets.mjs";
|
||||
if (!existsSync(".env.local")) await copyFile(".env.example", ".env.local");
|
||||
await mkdir(".data", { recursive: true });
|
||||
await mkdir("public/generated", { recursive: true });
|
||||
await mkdir("public/downloads", { recursive: true });
|
||||
await new Promise((resolve, reject) => {
|
||||
const p = spawn(
|
||||
process.execPath,
|
||||
["node_modules/playwright/cli.js", "install", "chromium"],
|
||||
{ stdio: "inherit" },
|
||||
);
|
||||
p.on("exit", (code) =>
|
||||
code === 0
|
||||
? resolve()
|
||||
: reject(new Error(`Chromium installation exited ${code}`)),
|
||||
);
|
||||
});
|
||||
await prepareAssets();
|
||||
process.loadEnvFile(".env.local");
|
||||
const configured = Boolean(
|
||||
process.env.NEXT_PUBLIC_SUPABASE_URL &&
|
||||
process.env.SUPABASE_SECRET_KEY &&
|
||||
process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY,
|
||||
);
|
||||
console.log(
|
||||
configured
|
||||
? "Supabase configuration present. Apply the checked-in migration before starting."
|
||||
: "Supabase is not configured. Local guest sandbox is available; hosted uploads/moderation remain disabled.",
|
||||
);
|
||||
Reference in New Issue
Block a user