create-kide-app 0.3.0 → 0.3.2

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 +60 -19
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -55,8 +55,10 @@ const REPO =
55
55
  const CLEANUP = [
56
56
  "docs",
57
57
  "CLAUDE.md",
58
+ "CONTRIBUTING.md",
58
59
  ".claude/settings.local.json",
59
60
  ".github/workflows", // upstream CI + @kidecms/core release pipeline — wrong in any scaffold
61
+ ".github/pull_request_template.md", // Kide's own contribution checklist — wrong in any scaffold
60
62
  "scripts/verify-cloudflare.mjs", // needs the adapters/ overlay, which every scaffold deletes
61
63
  "data",
62
64
  ".cms-data",
@@ -340,6 +342,27 @@ async function main() {
340
342
  }
341
343
  }
342
344
 
345
+ // The npm artifact publishes after the template tag (CI runs the release gate
346
+ // first) — a package-mode scaffold in that window would fail install with a
347
+ // missing version. Fail early with a clear message instead.
348
+ if (mode === "package") {
349
+ const clonedCorePkg = path.join(projectDir, "src/cms/package.json");
350
+ const clonedCoreVersion = existsSync(clonedCorePkg)
351
+ ? JSON.parse(readFileSync(clonedCorePkg, "utf-8")).version
352
+ : null;
353
+ if (clonedCoreVersion) {
354
+ try {
355
+ execSync(`npm view @kidecms/core@${clonedCoreVersion} version`, {
356
+ stdio: "pipe",
357
+ });
358
+ } catch {
359
+ cancelSetup(
360
+ `@kidecms/core@${clonedCoreVersion} is not on npm yet — if this release was just tagged, publishing may still be running. Retry in a few minutes, or choose Embedded mode.`,
361
+ );
362
+ }
363
+ }
364
+ }
365
+
343
366
  s.start(`Configuring project (using ${pm.name})`);
344
367
 
345
368
  // Apply the starter overlay — project-owned files copied over the barebone
@@ -732,32 +755,50 @@ async function main() {
732
755
  });
733
756
 
734
757
  if (!p.isCancel(setupNow) && setupNow) {
735
- // Check wrangler authentication
736
- let authenticated = false;
758
+ // A missing wrangler binary (e.g. dependency install failed) must not be
759
+ // misread as "not logged in" — check presence before authentication.
760
+ let wranglerAvailable = false;
737
761
  try {
738
- execSync(`${pm.exec} wrangler whoami`, {
762
+ execSync(`${pm.exec} wrangler --version`, {
739
763
  cwd: projectDir,
740
764
  stdio: "pipe",
741
765
  });
742
- authenticated = true;
766
+ wranglerAvailable = true;
743
767
  } catch {
744
768
  p.note(
745
- "You need to log in to Cloudflare first.",
746
- "Wrangler login required",
769
+ "wrangler is not installed dependency install may have failed.\nRun `pnpm install`, then finish the setup steps listed below.",
770
+ "Wrangler missing",
747
771
  );
748
- const doLogin = await p.confirm({
749
- message: "Open browser to log in?",
750
- initialValue: true,
751
- });
752
- if (!p.isCancel(doLogin) && doLogin) {
753
- try {
754
- execSync(`${pm.exec} wrangler login`, {
755
- cwd: projectDir,
756
- stdio: "inherit",
757
- });
758
- authenticated = true;
759
- } catch {
760
- s.stop("Login failed");
772
+ }
773
+
774
+ // Check wrangler authentication
775
+ let authenticated = false;
776
+ if (wranglerAvailable) {
777
+ try {
778
+ execSync(`${pm.exec} wrangler whoami`, {
779
+ cwd: projectDir,
780
+ stdio: "pipe",
781
+ });
782
+ authenticated = true;
783
+ } catch {
784
+ p.note(
785
+ "You need to log in to Cloudflare first.",
786
+ "Wrangler login required",
787
+ );
788
+ const doLogin = await p.confirm({
789
+ message: "Open browser to log in?",
790
+ initialValue: true,
791
+ });
792
+ if (!p.isCancel(doLogin) && doLogin) {
793
+ try {
794
+ execSync(`${pm.exec} wrangler login`, {
795
+ cwd: projectDir,
796
+ stdio: "inherit",
797
+ });
798
+ authenticated = true;
799
+ } catch {
800
+ s.stop("Login failed");
801
+ }
761
802
  }
762
803
  }
763
804
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-kide-app",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Scaffold a new Kide CMS project",
5
5
  "author": "Matti Hernesniemi",
6
6
  "license": "MIT",