gencow 0.1.173 → 0.1.174
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/bin/gencow.mjs +1 -1
- package/lib/db-command.mjs +23 -1
- package/package.json +1 -1
package/bin/gencow.mjs
CHANGED
|
@@ -341,7 +341,7 @@ ${BOLD}Commands (login required):${RESET}
|
|
|
341
341
|
${DIM}--prod Push to production DB (confirmation required)${RESET}
|
|
342
342
|
${GREEN}db:generate${RESET} Generate SQL migration files from schema.ts
|
|
343
343
|
${GREEN}db:seed${RESET} Run gencow/seed.ts on cloud app
|
|
344
|
-
${DIM}--prod Seed production app${RESET}
|
|
344
|
+
${DIM}--prod Seed production app (confirmation required)${RESET}
|
|
345
345
|
${GREEN}static [dir]${RESET} Deploy static files only ${DIM}(dist/, out/, build/)${RESET}
|
|
346
346
|
${DIM}--prod Deploy to production app${RESET}
|
|
347
347
|
${DIM}--force, -f Skip optional dependency scan${RESET}
|
package/lib/db-command.mjs
CHANGED
|
@@ -72,11 +72,25 @@ async function promptDbPushConfirm(appId, createInterfaceImpl) {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
async function promptDbSeedProdConfirm(appId, createInterfaceImpl) {
|
|
76
|
+
const createInterface = createInterfaceImpl ?? (await import("readline")).createInterface;
|
|
77
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
78
|
+
return await new Promise((resolveAnswer) => {
|
|
79
|
+
rl.question(
|
|
80
|
+
`\n ${RED}!${RESET} Seed ${BOLD}PRODUCTION${RESET} database (${appId})?\n Type "yes" to confirm: `,
|
|
81
|
+
(answer) => {
|
|
82
|
+
rl.close();
|
|
83
|
+
resolveAnswer(answer.trim().toLowerCase() === "yes");
|
|
84
|
+
},
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
75
89
|
function renderDbSeedHelp(logImpl = log) {
|
|
76
90
|
logImpl(`\n${BOLD}${CYAN}gencow db:seed${RESET} — Run seed.ts on cloud app\n`);
|
|
77
91
|
logImpl(` ${BOLD}Usage:${RESET} gencow db:seed [options]\n`);
|
|
78
92
|
logImpl(` ${BOLD}Options:${RESET}`);
|
|
79
|
-
logImpl(` ${DIM}--prod${RESET} Seed production app`);
|
|
93
|
+
logImpl(` ${DIM}--prod${RESET} Seed production app (confirmation required)`);
|
|
80
94
|
logImpl(` ${DIM}--local${RESET} Seed local dev server`);
|
|
81
95
|
logImpl(` ${DIM}--app, -a${RESET} Target specific app\n`);
|
|
82
96
|
}
|
|
@@ -293,6 +307,14 @@ export function createDbCommands({
|
|
|
293
307
|
return;
|
|
294
308
|
}
|
|
295
309
|
|
|
310
|
+
if (isProd) {
|
|
311
|
+
const confirmed = await promptDbSeedProdConfirm(appId, createInterfaceImpl);
|
|
312
|
+
if (!confirmed) {
|
|
313
|
+
warnImpl("Cancelled.");
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
296
318
|
const envLabel = isProd ? "prod" : "dev";
|
|
297
319
|
logImpl(`\n${BOLD}${CYAN}Gencow DB Seed${RESET} ${DIM}(${envLabel}: ${appId})${RESET}\n`);
|
|
298
320
|
infoImpl("Running seed.ts on cloud app...");
|