safelaunch 1.0.39 → 1.0.40
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/safelaunch.js +7 -0
- package/package.json +1 -1
- package/src/scan.js +1 -1
package/bin/safelaunch.js
CHANGED
|
@@ -59,6 +59,7 @@ for (const a of args) {
|
|
|
59
59
|
}
|
|
60
60
|
const hookMode = flags["--hook"] === true;
|
|
61
61
|
const silent = flags["--silent"] === true;
|
|
62
|
+
const jsonMode = flags["--json"] === true;
|
|
62
63
|
|
|
63
64
|
// ─── Dispatch ─────────────────────────────────────────────────────────────────
|
|
64
65
|
(async () => {
|
|
@@ -89,6 +90,12 @@ const silent = flags["--silent"] === true;
|
|
|
89
90
|
|
|
90
91
|
// ── scan ────────────────────────────────────────────────────────────────
|
|
91
92
|
case "scan": {
|
|
93
|
+
if (jsonMode) {
|
|
94
|
+
const result = await runScan({ hookMode: false, quiet: true, cwd: process.cwd() });
|
|
95
|
+
const all = [...result.blockers, ...result.warnings, ...result.infos];
|
|
96
|
+
process.stdout.write(JSON.stringify({ blockers: result.blockers, warnings: result.warnings, infos: result.infos, all, elapsed: result.elapsed }, null, 2));
|
|
97
|
+
process.exit(0);
|
|
98
|
+
}
|
|
92
99
|
if (!hookMode && !silent) {
|
|
93
100
|
process.stdout.write(gray(`safelaunch v${version} — scanning...\n\n`));
|
|
94
101
|
}
|
package/package.json
CHANGED
package/src/scan.js
CHANGED
|
@@ -559,7 +559,7 @@ function checkDebugFlags(cwd) {
|
|
|
559
559
|
issues.push({ severity: "warn", ...IMPACTS.DEBUG_FLAG_ENABLED(key.trim()) });
|
|
560
560
|
}
|
|
561
561
|
if (k === 'NODE_ENV' && v === 'development') {
|
|
562
|
-
issues.push({ severity: "warn",
|
|
562
|
+
issues.push({ severity: "warn", title: `NODE_ENV is set to development`, impact: 'Running in development mode in production exposes stack traces and disables optimizations.', fix: 'Set NODE_ENV=production in your production environment.' });
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
565
|
return issues;
|