create-kide-app 0.3.0 → 0.3.1

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 +58 -19
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -340,6 +340,27 @@ async function main() {
340
340
  }
341
341
  }
342
342
 
343
+ // The npm artifact publishes after the template tag (CI runs the release gate
344
+ // first) — a package-mode scaffold in that window would fail install with a
345
+ // missing version. Fail early with a clear message instead.
346
+ if (mode === "package") {
347
+ const clonedCorePkg = path.join(projectDir, "src/cms/package.json");
348
+ const clonedCoreVersion = existsSync(clonedCorePkg)
349
+ ? JSON.parse(readFileSync(clonedCorePkg, "utf-8")).version
350
+ : null;
351
+ if (clonedCoreVersion) {
352
+ try {
353
+ execSync(`npm view @kidecms/core@${clonedCoreVersion} version`, {
354
+ stdio: "pipe",
355
+ });
356
+ } catch {
357
+ cancelSetup(
358
+ `@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.`,
359
+ );
360
+ }
361
+ }
362
+ }
363
+
343
364
  s.start(`Configuring project (using ${pm.name})`);
344
365
 
345
366
  // Apply the starter overlay — project-owned files copied over the barebone
@@ -732,32 +753,50 @@ async function main() {
732
753
  });
733
754
 
734
755
  if (!p.isCancel(setupNow) && setupNow) {
735
- // Check wrangler authentication
736
- let authenticated = false;
756
+ // A missing wrangler binary (e.g. dependency install failed) must not be
757
+ // misread as "not logged in" — check presence before authentication.
758
+ let wranglerAvailable = false;
737
759
  try {
738
- execSync(`${pm.exec} wrangler whoami`, {
760
+ execSync(`${pm.exec} wrangler --version`, {
739
761
  cwd: projectDir,
740
762
  stdio: "pipe",
741
763
  });
742
- authenticated = true;
764
+ wranglerAvailable = true;
743
765
  } catch {
744
766
  p.note(
745
- "You need to log in to Cloudflare first.",
746
- "Wrangler login required",
767
+ "wrangler is not installed dependency install may have failed.\nRun `pnpm install`, then finish the setup steps listed below.",
768
+ "Wrangler missing",
747
769
  );
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");
770
+ }
771
+
772
+ // Check wrangler authentication
773
+ let authenticated = false;
774
+ if (wranglerAvailable) {
775
+ try {
776
+ execSync(`${pm.exec} wrangler whoami`, {
777
+ cwd: projectDir,
778
+ stdio: "pipe",
779
+ });
780
+ authenticated = true;
781
+ } catch {
782
+ p.note(
783
+ "You need to log in to Cloudflare first.",
784
+ "Wrangler login required",
785
+ );
786
+ const doLogin = await p.confirm({
787
+ message: "Open browser to log in?",
788
+ initialValue: true,
789
+ });
790
+ if (!p.isCancel(doLogin) && doLogin) {
791
+ try {
792
+ execSync(`${pm.exec} wrangler login`, {
793
+ cwd: projectDir,
794
+ stdio: "inherit",
795
+ });
796
+ authenticated = true;
797
+ } catch {
798
+ s.stop("Login failed");
799
+ }
761
800
  }
762
801
  }
763
802
  }
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.1",
4
4
  "description": "Scaffold a new Kide CMS project",
5
5
  "author": "Matti Hernesniemi",
6
6
  "license": "MIT",