safelaunch 1.0.26 → 1.0.27
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/package.json +1 -1
- package/src/setup.js +25 -9
package/package.json
CHANGED
package/src/setup.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const { runScan }
|
|
4
|
-
const { installHook }
|
|
5
|
-
const init
|
|
3
|
+
const { runScan } = require("./scan");
|
|
4
|
+
const { installHook } = require("./hook");
|
|
5
|
+
const init = require("./init");
|
|
6
6
|
|
|
7
7
|
const c = {
|
|
8
8
|
reset: "\x1b[0m", bold: "\x1b[1m", dim: "\x1b[2m",
|
|
@@ -15,10 +15,11 @@ const yellow = (s) => `${c.yellow}${c.bold}${s}${c.reset}`;
|
|
|
15
15
|
const gray = (s) => `${c.gray}${s}${c.reset}`;
|
|
16
16
|
const dim = (s) => `${c.dim}${s}${c.reset}`;
|
|
17
17
|
const bold = (s) => `${c.bold}${s}${c.reset}`;
|
|
18
|
+
const cyan = (s) => `${c.cyan}${s}${c.reset}`;
|
|
18
19
|
|
|
19
20
|
const HR = gray("─".repeat(49));
|
|
20
21
|
|
|
21
|
-
let version = "1.0.
|
|
22
|
+
let version = "1.0.26";
|
|
22
23
|
try { version = require("../package.json").version; } catch {}
|
|
23
24
|
|
|
24
25
|
async function run(options = {}) {
|
|
@@ -27,8 +28,8 @@ async function run(options = {}) {
|
|
|
27
28
|
console.log(`\n${bold("safelaunch")} ${gray(`v${version}`)} — pre-deploy guardrail`);
|
|
28
29
|
console.log(gray("Scanning your project...\n"));
|
|
29
30
|
|
|
30
|
-
//
|
|
31
|
-
const { blockers, warnings, infos, elapsed } = await runScan({ hookMode: true, cwd });
|
|
31
|
+
// quiet: true — runScan returns results silently, setup owns all output
|
|
32
|
+
const { blockers, warnings, infos, elapsed } = await runScan({ hookMode: true, quiet: true, cwd });
|
|
32
33
|
|
|
33
34
|
const totalChecks = 16;
|
|
34
35
|
const issueCount = blockers.length + warnings.length;
|
|
@@ -37,8 +38,20 @@ async function run(options = {}) {
|
|
|
37
38
|
if (issueCount === 0) {
|
|
38
39
|
console.log(`${green("✓")} ${bold(`${totalChecks} checks passed`)} ${gray(`(${elapsed}ms)`)}\n`);
|
|
39
40
|
} else {
|
|
41
|
+
for (const issue of blockers) {
|
|
42
|
+
console.log(`${red("✗")} ${bold(issue.title)}`);
|
|
43
|
+
console.log(` ${gray("Impact:")} ${issue.impact}`);
|
|
44
|
+
console.log(` ${cyan("→")} ${issue.fix}`);
|
|
45
|
+
console.log("");
|
|
46
|
+
}
|
|
47
|
+
for (const issue of warnings) {
|
|
48
|
+
console.log(`${yellow("⚠")} ${bold(issue.title)}`);
|
|
49
|
+
console.log(` ${gray("Impact:")} ${issue.impact}`);
|
|
50
|
+
console.log(` ${dim("→")} ${issue.fix}`);
|
|
51
|
+
console.log("");
|
|
52
|
+
}
|
|
40
53
|
console.log(
|
|
41
|
-
|
|
54
|
+
`${green("✓")} ${passed} check${passed !== 1 ? "s" : ""} passed` +
|
|
42
55
|
(blockers.length ? ` ${red(`✗ ${blockers.length} blocker${blockers.length > 1 ? "s" : ""}`)}` : "") +
|
|
43
56
|
(warnings.length ? ` ${yellow(`⚠ ${warnings.length} warning${warnings.length > 1 ? "s" : ""}`)}` : "") +
|
|
44
57
|
"\n"
|
|
@@ -48,7 +61,10 @@ async function run(options = {}) {
|
|
|
48
61
|
console.log(gray("Generating env.manifest.json..."));
|
|
49
62
|
const manifestResult = await init.run({ cwd, silent: true });
|
|
50
63
|
if (manifestResult && manifestResult.count > 0) {
|
|
51
|
-
console.log(
|
|
64
|
+
console.log(
|
|
65
|
+
`${green("✓")} ${bold("env.manifest.json created")} ` +
|
|
66
|
+
gray(`(${manifestResult.count} variable${manifestResult.count !== 1 ? "s" : ""} registered)`)
|
|
67
|
+
);
|
|
52
68
|
} else {
|
|
53
69
|
console.log(`${green("✓")} ${bold("env.manifest.json updated")}`);
|
|
54
70
|
}
|
|
@@ -79,4 +95,4 @@ async function run(options = {}) {
|
|
|
79
95
|
}
|
|
80
96
|
}
|
|
81
97
|
|
|
82
|
-
module.exports = { run };
|
|
98
|
+
module.exports = { run };
|