create-cronus-app 0.6.20 → 0.6.22

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/dist/index.js CHANGED
@@ -6,8 +6,8 @@ import { fileURLToPath } from "node:url";
6
6
  import { parseArgs } from "node:util";
7
7
  import { ASSISTANTS, DEFAULT_PRESET, DOCTRINE_PRESETS, parseList, SKILLS, writeAiKit, writeDesignDocuments, } from "@cronus-ui/ai-kit";
8
8
  import { composeTemplate } from "./compose.js";
9
- import { runInstall, scaffold } from "./scaffold.js";
10
- import { c, DEFAULT_MODE, DEFAULT_TEMPLATE, DEFAULT_THEME, dirNameFromProjectName, isComposedTemplate, isValidProjectName, log, MODES, PACKAGE_MANAGERS, promptConfirm, promptSelect, TEMPLATE_APPEARANCE, TEMPLATE_HINTS, TEMPLATES, THEME_HINTS, THEMES, } from "./utils.js";
9
+ import { runDbPush, runInstall, scaffold } from "./scaffold.js";
10
+ import { c, DEFAULT_MODE, DEFAULT_TEMPLATE, DEFAULT_THEME, dirNameFromProjectName, isComposedTemplate, isGoldPathTemplate, isValidProjectName, log, MODES, PACKAGE_MANAGERS, promptConfirm, promptSelect, TEMPLATE_APPEARANCE, TEMPLATE_HINTS, TEMPLATES, THEME_HINTS, THEMES, } from "./utils.js";
11
11
  import { CREATE_VERSION } from "./version.js";
12
12
  export const HELP = `${c.bold("create-cronus-app")} — scaffold a Next.js + Cronus UI app.
13
13
 
@@ -227,17 +227,33 @@ async function main() {
227
227
  }
228
228
  }
229
229
  const pm = parsed.pm ?? detectPackageManager();
230
+ let installOk = false;
230
231
  if (parsed.install) {
231
232
  log.step(`Installing dependencies with ${c.cyan(pm)}…`);
232
233
  try {
233
234
  runInstall(pm, targetDir);
235
+ installOk = true;
234
236
  log.ok("Dependencies installed.");
235
237
  }
236
238
  catch (err) {
237
239
  log.warn(`Install failed (${err.message}). Install manually later.`);
238
240
  }
239
241
  }
240
- log.outro(dirName, pm, parsed.install, template);
242
+ let dbPushed = false;
243
+ if (installOk &&
244
+ isGoldPathTemplate(template) &&
245
+ existsSync(join(targetDir, "drizzle.config.ts"))) {
246
+ log.step("Pushing the sqlite schema…");
247
+ try {
248
+ runDbPush(pm, targetDir);
249
+ dbPushed = true;
250
+ log.ok("Database schema pushed.");
251
+ }
252
+ catch (err) {
253
+ log.warn(`db:push failed (${err.message}). Run it manually later.`);
254
+ }
255
+ }
256
+ log.outro(dirName, pm, parsed.install, template, dbPushed);
241
257
  }
242
258
  /** True when this module is the process entry point (not imported by a test). */
243
259
  function isEntrypoint() {
@@ -28,4 +28,8 @@ export interface ScaffoldResult {
28
28
  export declare function scaffold(options: ScaffoldOptions): ScaffoldResult;
29
29
  /** Run the package manager's install in `cwd`. Throws if it exits non-zero. */
30
30
  export declare function runInstall(pm: PackageManager, cwd: string): void;
31
+ /** `pm run db:push -- --force` — non-interactive first-run sqlite push. */
32
+ export declare const DB_PUSH_ARGS: readonly ["run", "db:push", "--", "--force"];
33
+ /** Push the gold-path sqlite schema. Throws if it exits non-zero. */
34
+ export declare function runDbPush(pm: PackageManager, cwd: string): void;
31
35
  //# sourceMappingURL=scaffold.d.ts.map
package/dist/scaffold.js CHANGED
@@ -115,4 +115,19 @@ export function runInstall(pm, cwd) {
115
115
  throw new Error(`${pm} install exited with code ${result.status}`);
116
116
  }
117
117
  }
118
+ /** `pm run db:push -- --force` — non-interactive first-run sqlite push. */
119
+ export const DB_PUSH_ARGS = ["run", "db:push", "--", "--force"];
120
+ /** Push the gold-path sqlite schema. Throws if it exits non-zero. */
121
+ export function runDbPush(pm, cwd) {
122
+ const result = spawnSync(pm, [...DB_PUSH_ARGS], {
123
+ cwd,
124
+ stdio: "inherit",
125
+ shell: process.platform === "win32",
126
+ });
127
+ if (result.error)
128
+ throw result.error;
129
+ if (typeof result.status === "number" && result.status !== 0) {
130
+ throw new Error(`${pm} db:push exited with code ${result.status}`);
131
+ }
132
+ }
118
133
  //# sourceMappingURL=scaffold.js.map
package/dist/utils.d.ts CHANGED
@@ -15,16 +15,17 @@ export declare const c: {
15
15
  * the copy without scraping stdout. `template` is optional for back-compat: omit
16
16
  * it (or pass a bundled template) to keep the component-add path; composed
17
17
  * templates (`saas`/`store`/`landing`) get add-page / theme / upgrade instead.
18
- * saas/admin also get `db:push` before `dev` (sqlite gold path).
18
+ * saas/admin list `db:push` before `dev` unless the scaffolder already ran it.
19
19
  */
20
- export declare function outroLines(name: string, pm: PackageManager, installed: boolean, template?: TemplateName): string[];
20
+ export declare function isGoldPathTemplate(name: string): boolean;
21
+ export declare function outroLines(name: string, pm: PackageManager, installed: boolean, template?: TemplateName, dbPushed?: boolean): string[];
21
22
  export declare const log: {
22
23
  intro(): void;
23
24
  step(msg: string): void;
24
25
  ok(msg: string): void;
25
26
  warn(msg: string): void;
26
27
  error(msg: string): void;
27
- outro(name: string, pm: PackageManager, installed: boolean, template?: TemplateName): void;
28
+ outro(name: string, pm: PackageManager, installed: boolean, template?: TemplateName, dbPushed?: boolean): void;
28
29
  };
29
30
  /**
30
31
  * The starter templates a user can pick. `default`/`dashboard`/`marketing` copy
package/dist/utils.js CHANGED
@@ -18,15 +18,18 @@ export const c = {
18
18
  * the copy without scraping stdout. `template` is optional for back-compat: omit
19
19
  * it (or pass a bundled template) to keep the component-add path; composed
20
20
  * templates (`saas`/`store`/`landing`) get add-page / theme / upgrade instead.
21
- * saas/admin also get `db:push` before `dev` (sqlite gold path).
21
+ * saas/admin list `db:push` before `dev` unless the scaffolder already ran it.
22
22
  */
23
- export function outroLines(name, pm, installed, template) {
23
+ export function isGoldPathTemplate(name) {
24
+ return name === "saas" || name === "admin";
25
+ }
26
+ export function outroLines(name, pm, installed, template, dbPushed = false) {
24
27
  const dev = pm === "npm" ? "npm run dev" : `${pm} dev`;
25
28
  const install = pm === "yarn" ? "yarn" : `${pm} install`;
26
29
  const dbPush = pm === "npm" ? "npm run db:push" : `${pm} run db:push`;
27
30
  const dollar = c.dim("$");
28
31
  const composed = template !== undefined && isComposedTemplate(template);
29
- const goldPath = template === "saas" || template === "admin";
32
+ const goldPath = template !== undefined && isGoldPathTemplate(template);
30
33
  const grow = composed
31
34
  ? [
32
35
  "Grow the app anytime:",
@@ -45,7 +48,7 @@ export function outroLines(name, pm, installed, template) {
45
48
  "Next steps:",
46
49
  ` ${dollar} cd ${name}`,
47
50
  ...(installed ? [] : [` ${dollar} ${install}`]),
48
- ...(goldPath ? [` ${dollar} ${dbPush}`] : []),
51
+ ...(goldPath && !dbPushed ? [` ${dollar} ${dbPush}`] : []),
49
52
  ` ${dollar} ${dev}`,
50
53
  "",
51
54
  `Then open the URL printed by ${c.cyan(dev)}.`,
@@ -70,8 +73,8 @@ export const log = {
70
73
  error(msg) {
71
74
  process.stderr.write(`${c.red("✗")} ${msg}\n`);
72
75
  },
73
- outro(name, pm, installed, template) {
74
- process.stdout.write(`${outroLines(name, pm, installed, template).join("\n")}\n`);
76
+ outro(name, pm, installed, template, dbPushed = false) {
77
+ process.stdout.write(`${outroLines(name, pm, installed, template, dbPushed).join("\n")}\n`);
75
78
  },
76
79
  };
77
80
  /**
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Kept in sync with package.json#version. */
2
- export declare const CREATE_VERSION = "0.6.20";
2
+ export declare const CREATE_VERSION = "0.6.22";
3
3
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Kept in sync with package.json#version. */
2
- export const CREATE_VERSION = "0.6.20";
2
+ export const CREATE_VERSION = "0.6.22";
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cronus-app",
3
- "version": "0.6.20",
3
+ "version": "0.6.22",
4
4
  "description": "Scaffold a Next.js + Cronus UI app: npx create-cronus-app my-app --template saas.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -43,8 +43,8 @@
43
43
  "prepublishOnly": "tsc -p tsconfig.json"
44
44
  },
45
45
  "dependencies": {
46
- "@cronus-ui/ai-kit": "0.6.20",
47
- "cronus-ui": "0.6.20"
46
+ "@cronus-ui/ai-kit": "0.6.22",
47
+ "cronus-ui": "0.6.22"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "^22.10.0",
@@ -9,7 +9,7 @@
9
9
  "lib": "lib",
10
10
  "blocks": "components/blocks"
11
11
  },
12
- "registry": "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.20/registry",
12
+ "registry": "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.22/registry",
13
13
  "theme": {
14
14
  "name": "__THEME__",
15
15
  "mode": "__MODE__"
@@ -9,9 +9,9 @@
9
9
  "start": "next start"
10
10
  },
11
11
  "dependencies": {
12
- "@cronus-ui/theme": "^0.6.20",
13
- "@cronus-ui/tokens": "^0.6.20",
14
- "@cronus-ui/ui": "^0.6.20",
12
+ "@cronus-ui/theme": "^0.6.22",
13
+ "@cronus-ui/tokens": "^0.6.22",
14
+ "@cronus-ui/ui": "^0.6.22",
15
15
  "@tanstack/react-table": "^8.21.3",
16
16
  "lucide-react": "^0.577.0",
17
17
  "next": "16.2.10",
@@ -9,7 +9,7 @@
9
9
  "lib": "lib",
10
10
  "blocks": "components/blocks"
11
11
  },
12
- "registry": "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.20/registry",
12
+ "registry": "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.22/registry",
13
13
  "theme": {
14
14
  "name": "__THEME__",
15
15
  "mode": "__MODE__"
@@ -9,9 +9,9 @@
9
9
  "start": "next start"
10
10
  },
11
11
  "dependencies": {
12
- "@cronus-ui/theme": "^0.6.20",
13
- "@cronus-ui/tokens": "^0.6.20",
14
- "@cronus-ui/ui": "^0.6.20",
12
+ "@cronus-ui/theme": "^0.6.22",
13
+ "@cronus-ui/tokens": "^0.6.22",
14
+ "@cronus-ui/ui": "^0.6.22",
15
15
  "next": "16.2.10",
16
16
  "react": "^19.2.0",
17
17
  "react-dom": "^19.2.0"
@@ -9,7 +9,7 @@
9
9
  "lib": "lib",
10
10
  "blocks": "components/blocks"
11
11
  },
12
- "registry": "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.20/registry",
12
+ "registry": "https://raw.githubusercontent.com/pedrogbraz/cronus-ui/v0.6.22/registry",
13
13
  "theme": {
14
14
  "name": "__THEME__",
15
15
  "mode": "__MODE__"
@@ -9,9 +9,9 @@
9
9
  "start": "next start"
10
10
  },
11
11
  "dependencies": {
12
- "@cronus-ui/theme": "^0.6.20",
13
- "@cronus-ui/tokens": "^0.6.20",
14
- "@cronus-ui/ui": "^0.6.20",
12
+ "@cronus-ui/theme": "^0.6.22",
13
+ "@cronus-ui/tokens": "^0.6.22",
14
+ "@cronus-ui/ui": "^0.6.22",
15
15
  "lucide-react": "^0.577.0",
16
16
  "next": "16.2.10",
17
17
  "react": "^19.2.0",