sticky-note-cli 3.1.2 → 3.1.3
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/cli.js +32 -14
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -657,23 +657,41 @@ async function cmdInit() {
|
|
|
657
657
|
print("\n Cloud Backend Setup...\n");
|
|
658
658
|
let cloudResult = provisionCloudBackend();
|
|
659
659
|
|
|
660
|
-
// wrangler not installed —
|
|
660
|
+
// wrangler not installed — install it and authenticate automatically
|
|
661
661
|
if (cloudResult === null) {
|
|
662
|
-
print(" wrangler CLI
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
662
|
+
print(" wrangler CLI not found. Installing now...\n");
|
|
663
|
+
try {
|
|
664
|
+
execSync("npm install -g wrangler", { stdio: "inherit" });
|
|
665
|
+
print("\n [OK] wrangler installed");
|
|
666
|
+
} catch (err) {
|
|
667
|
+
print(" [ERR] Failed to install wrangler: " + (err.message || err));
|
|
668
|
+
print(" Try manually: npm install -g wrangler");
|
|
669
|
+
print(" Then run `npx sticky-note deploy-backend`.\n");
|
|
670
|
+
// skip remaining cloud setup and continue init
|
|
671
|
+
cloudResult = { error: "wrangler install failed" };
|
|
672
|
+
}
|
|
670
673
|
|
|
671
|
-
|
|
672
|
-
|
|
674
|
+
if (!cloudResult) {
|
|
675
|
+
// installed — now authenticate (opens browser, runs interactively)
|
|
676
|
+
print("\n Authenticating with Cloudflare (this will open your browser)...\n");
|
|
677
|
+
try {
|
|
678
|
+
execSync("wrangler login", { stdio: "inherit" });
|
|
679
|
+
print("\n [OK] Logged in to Cloudflare");
|
|
680
|
+
} catch (err) {
|
|
681
|
+
print(" [ERR] wrangler login failed: " + (err.message || err));
|
|
682
|
+
print(" Run `wrangler login` manually, then `npx sticky-note deploy-backend`.\n");
|
|
683
|
+
cloudResult = { error: "wrangler login failed" };
|
|
684
|
+
}
|
|
685
|
+
}
|
|
673
686
|
|
|
674
|
-
if (cloudResult
|
|
675
|
-
print("
|
|
676
|
-
|
|
687
|
+
if (!cloudResult) {
|
|
688
|
+
print("");
|
|
689
|
+
cloudResult = provisionCloudBackend();
|
|
690
|
+
if (cloudResult === null) {
|
|
691
|
+
print(" [ERR] wrangler still not found after install.");
|
|
692
|
+
print(" Run `npx sticky-note deploy-backend` in a new terminal.\n");
|
|
693
|
+
cloudResult = { error: "wrangler not found after install" };
|
|
694
|
+
}
|
|
677
695
|
}
|
|
678
696
|
}
|
|
679
697
|
|