create-kide-app 0.0.28 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +10 -2
- package/package.json +1 -1
- package/templates/local/drizzle.config.ts +5 -1
package/index.js
CHANGED
|
@@ -279,9 +279,17 @@ async function main() {
|
|
|
279
279
|
|
|
280
280
|
if (seedDemo && target === "local") {
|
|
281
281
|
s.start("Pushing schema to database");
|
|
282
|
+
// Ensure data/ directory exists — drizzle-kit push silently exits 0 if it can't open the file
|
|
283
|
+
mkdirSync(path.join(projectDir, "data"), { recursive: true });
|
|
284
|
+
let pushOk = false;
|
|
282
285
|
try {
|
|
283
|
-
execSync(`${pm.exec} drizzle-kit push --force`, {
|
|
284
|
-
|
|
286
|
+
const out = execSync(`${pm.exec} drizzle-kit push --force`, {
|
|
287
|
+
cwd: projectDir,
|
|
288
|
+
stdio: "pipe",
|
|
289
|
+
}).toString();
|
|
290
|
+
// drizzle-kit exits 0 even on connection errors, so verify by checking output
|
|
291
|
+
pushOk = !out.includes("Error:") && out.includes("Changes applied");
|
|
292
|
+
s.stop(pushOk ? "Schema pushed" : "Schema push failed — run `pnpm exec drizzle-kit push` manually");
|
|
285
293
|
} catch {
|
|
286
294
|
s.stop("Schema will be set up on first dev start");
|
|
287
295
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { mkdirSync } from "node:fs";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import { defineConfig } from "drizzle-kit";
|
|
3
4
|
|
|
5
|
+
const dbPath = path.resolve("./data/cms.db");
|
|
6
|
+
mkdirSync(path.dirname(dbPath), { recursive: true });
|
|
7
|
+
|
|
4
8
|
export default defineConfig({
|
|
5
9
|
schema: "./src/cms/.generated/schema.ts",
|
|
6
10
|
out: "./src/cms/migrations",
|
|
7
11
|
dialect: "sqlite",
|
|
8
12
|
dbCredentials: {
|
|
9
|
-
url: process.env.CMS_DATABASE_URL ?? `file:${
|
|
13
|
+
url: process.env.CMS_DATABASE_URL ?? `file:${dbPath}`,
|
|
10
14
|
},
|
|
11
15
|
});
|