@stacksjs/buddy 0.70.60 → 0.70.61
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/cli.js +11 -9
- package/dist/commands/setup.js +21 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -31,16 +31,18 @@ const args = process.argv.slice(2), requestedCommand = args[0] || "help", isHelp
|
|
|
31
31
|
"scaffold:crud"
|
|
32
32
|
].some((cmd) => requestedCommand === cmd || requestedCommand.startsWith(`${cmd}:`)) || isHelpFlag || isHelpMode, needsFullSetup = !isVersionOnly;
|
|
33
33
|
if (needsFullSetup) {
|
|
34
|
-
|
|
35
|
-
log.debug(
|
|
34
|
+
const reportFatal = (label, error) => {
|
|
35
|
+
log.debug(`Buddy ${label}`);
|
|
36
|
+
try {
|
|
37
|
+
process.stderr.write(`
|
|
38
|
+
[buddy] ${label}: ${error?.stack ?? String(error)}
|
|
39
|
+
`);
|
|
40
|
+
} catch {}
|
|
36
41
|
log.error(error);
|
|
37
|
-
process.exit(1);
|
|
38
|
-
}
|
|
39
|
-
process.on("
|
|
40
|
-
|
|
41
|
-
log.error(error);
|
|
42
|
-
process.exit(1);
|
|
43
|
-
});
|
|
42
|
+
return process.exit(1);
|
|
43
|
+
};
|
|
44
|
+
process.on("uncaughtException", (error) => reportFatal("uncaughtException", error));
|
|
45
|
+
process.on("unhandledRejection", (error) => reportFatal("unhandledRejection", error));
|
|
44
46
|
}
|
|
45
47
|
async function main() {
|
|
46
48
|
const buddy = cli("buddy"), configPath = "./buddy.config.js";
|
package/dist/commands/setup.js
CHANGED
|
@@ -58,12 +58,14 @@ export function setup(buddy) {
|
|
|
58
58
|
onUnknownSubcommand(buddy, "setup");
|
|
59
59
|
}
|
|
60
60
|
async function isPantryInstalled() {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
try {
|
|
62
|
+
return (await runCommand("pantry --version", {
|
|
63
|
+
silent: !0,
|
|
64
|
+
timeoutMs: PANTRY_CHECK_TIMEOUT_MS
|
|
65
|
+
})).isOk;
|
|
66
|
+
} catch {
|
|
67
|
+
return !1;
|
|
68
|
+
}
|
|
67
69
|
}
|
|
68
70
|
async function installPantry() {
|
|
69
71
|
const result = await runCommand(p.frameworkPath("scripts/pantry-install"), {
|
|
@@ -75,10 +77,20 @@ async function installPantry() {
|
|
|
75
77
|
process.exit(ExitCode.FatalError);
|
|
76
78
|
}
|
|
77
79
|
export async function ensurePantryInstalled() {
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
+
if (await isPantryInstalled())
|
|
81
|
+
return;
|
|
82
|
+
const installer = p.frameworkPath("scripts/pantry-install");
|
|
83
|
+
if (!existsSync(installer)) {
|
|
84
|
+
log.debug("Pantry is not installed and no bundled installer is present; continuing without it.");
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
await installPantry();
|
|
80
88
|
}
|
|
81
89
|
export async function ensurePantryDependencies(cwd) {
|
|
90
|
+
if (!await isPantryInstalled()) {
|
|
91
|
+
log.debug("Pantry not installed; skipping pantry dependency install (deps come from node_modules).");
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
82
94
|
log.info("Installing Pantry dependencies...");
|
|
83
95
|
const result = await runCommand("pantry install", {
|
|
84
96
|
cwd,
|
|
@@ -98,7 +110,7 @@ function hasAppKey(cwd) {
|
|
|
98
110
|
return /^APP_KEY=.+$/m.test(readFileSync(envPath, "utf-8"));
|
|
99
111
|
}
|
|
100
112
|
export async function ensureAppKey(cwd) {
|
|
101
|
-
if (hasAppKey(cwd)) {
|
|
113
|
+
if (hasAppKey(cwd) || process.env.APP_KEY && process.env.APP_KEY.length > 0) {
|
|
102
114
|
log.success("APP_KEY existed");
|
|
103
115
|
return;
|
|
104
116
|
}
|