create-kide-app 0.3.5 → 0.4.0

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.
Files changed (2) hide show
  1. package/index.js +39 -17
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -477,6 +477,10 @@ async function main() {
477
477
  pkg.dependencies["@kidecms/core"] = `^${coreVersion}`;
478
478
  delete pkg.scripts["verify:pack"];
479
479
  delete pkg.scripts["verify:package"];
480
+ // Package-mode upgrades are `pnpm add @kidecms/core@latest` — the patch
481
+ // flow (and its .kide-version stamp) only exists after `kide eject`.
482
+ delete pkg.scripts["cms:upgrade"];
483
+ delete pkg.scripts["cms:restore"];
480
484
  // The runtime (and its worker tests + Cloudflare type profile) now lives in
481
485
  // node_modules — keep check/test scoped to project code, and let vitest pass
482
486
  // until the project has tests of its own.
@@ -564,22 +568,27 @@ async function main() {
564
568
  } catch {
565
569
  // best-effort
566
570
  }
567
- const versionStamp = {
568
- template: REPO.replace(/\.git$/, ""),
569
- kideVersion: coreVersion ?? pkg.version ?? null,
570
- ref: templateRef ?? "HEAD",
571
- commit: templateCommit,
572
- target,
573
- mode,
574
- starter: starter ?? null,
575
- corePath: "src/cms",
576
- scaffoldedAt: new Date().toISOString(),
577
- createKideApp: cliVersion,
578
- };
579
- writeFileSync(
580
- path.join(projectDir, ".kide-version"),
581
- `${JSON.stringify(versionStamp, null, 2)}\n`,
582
- );
571
+ // Package mode gets no version stamp: the installed @kidecms/core version is
572
+ // the only baseline that matters, and `kide eject` writes the stamp when the
573
+ // patch-upgrade flow starts existing.
574
+ if (mode === "embedded") {
575
+ const versionStamp = {
576
+ template: REPO.replace(/\.git$/, ""),
577
+ kideVersion: coreVersion ?? pkg.version ?? null,
578
+ ref: templateRef ?? "HEAD",
579
+ commit: templateCommit,
580
+ target,
581
+ mode,
582
+ starter: starter ?? null,
583
+ corePath: "src/cms",
584
+ scaffoldedAt: new Date().toISOString(),
585
+ createKideApp: cliVersion,
586
+ };
587
+ writeFileSync(
588
+ path.join(projectDir, ".kide-version"),
589
+ `${JSON.stringify(versionStamp, null, 2)}\n`,
590
+ );
591
+ }
583
592
 
584
593
  // Wire up the local MCP server so Claude Code (and other MCP clients that read
585
594
  // a project-scoped `.mcp.json`) discover it automatically — no manual
@@ -735,12 +744,25 @@ async function main() {
735
744
  s.stop("Schema generation failed — run `cms:generate` manually");
736
745
  }
737
746
 
747
+ // --- Apply schema to the local database (local target only; Cloudflare's D1
748
+ // needs Worker bindings). Without this, only `pnpm dev` (which pushes on boot)
749
+ // works out of the box — `pnpm build && pnpm preview` would hit a table-less DB.
750
+
751
+ if (target === "local") {
752
+ s.start("Preparing database");
753
+ try {
754
+ await runAsync(`${pm.run} cms:push`, projectDir);
755
+ s.stop("Database ready");
756
+ } catch {
757
+ s.stop("Database push failed — run `pnpm cms:push` manually");
758
+ }
759
+ }
760
+
738
761
  // --- Seed starter content (local target only) ---
739
762
 
740
763
  if (starter && seedRequested && target === "local") {
741
764
  s.start("Seeding example content");
742
765
  try {
743
- await runAsync(`${pm.run} cms:push`, projectDir);
744
766
  await runAsync(`${pm.exec} kide seed`, projectDir);
745
767
  s.stop("Example content seeded");
746
768
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-kide-app",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "description": "Scaffold a new Kide CMS project",
5
5
  "author": "Matti Hernesniemi",
6
6
  "license": "MIT",