@final-commerce/common 2.8.1-online.4 → 2.8.1-online.5
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/gate-done.mjs +11 -24
- package/package.json +1 -1
package/bin/gate-done.mjs
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* gate-done — pre-push hook.
|
|
4
4
|
*
|
|
5
|
-
* Runs
|
|
5
|
+
* Runs three sweeps inside a 90-second wall-clock budget:
|
|
6
6
|
*
|
|
7
|
-
* 1.
|
|
8
|
-
* 2.
|
|
9
|
-
* 3.
|
|
10
|
-
* 4. bundle — size-limit or custom bundle-size script (if configured)
|
|
7
|
+
* 1. gitleaks — credential / secret scanning (git log + staged)
|
|
8
|
+
* 2. vitest — full test suite with coverage threshold enforcement
|
|
9
|
+
* 3. bundle — size-limit or custom bundle-size script (if configured)
|
|
11
10
|
*
|
|
12
|
-
* Any sweep failure
|
|
11
|
+
* Any sweep failure exits 1, blocking the push.
|
|
13
12
|
* Budget overrun also exits 1.
|
|
14
13
|
*
|
|
15
14
|
* Install as Husky pre-push hook:
|
|
@@ -74,21 +73,9 @@ function ok(msg) {
|
|
|
74
73
|
process.stdout.write(`\x1b[32m✔ [${elapsed()}s] ${msg}\x1b[0m\n`);
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
// ── 1.
|
|
76
|
+
// ── 1. gitleaks ───────────────────────────────────────────────────────────────
|
|
78
77
|
|
|
79
|
-
info('Sweep 1/
|
|
80
|
-
checkBudget('npm audit');
|
|
81
|
-
|
|
82
|
-
const auditResult = run('npm audit --audit-level=high');
|
|
83
|
-
if (auditResult.status !== 0) {
|
|
84
|
-
warn('npm audit found high or critical vulnerabilities. Run `npm audit` for details.');
|
|
85
|
-
} else {
|
|
86
|
-
ok('npm audit: no high/critical vulnerabilities.');
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// ── 2. gitleaks ───────────────────────────────────────────────────────────────
|
|
90
|
-
|
|
91
|
-
info('Sweep 2/4 — gitleaks secrets scan…');
|
|
78
|
+
info('Sweep 1/3 — gitleaks secrets scan…');
|
|
92
79
|
checkBudget('gitleaks');
|
|
93
80
|
|
|
94
81
|
const hasGitleaks = capture('command -v gitleaks 2>/dev/null').status === 0;
|
|
@@ -108,9 +95,9 @@ if (!hasGitleaks) {
|
|
|
108
95
|
ok('gitleaks: no secrets detected.');
|
|
109
96
|
}
|
|
110
97
|
|
|
111
|
-
// ──
|
|
98
|
+
// ── 2. vitest coverage ────────────────────────────────────────────────────────
|
|
112
99
|
|
|
113
|
-
info('Sweep 3
|
|
100
|
+
info('Sweep 2/3 — Vitest test suite + coverage thresholds…');
|
|
114
101
|
checkBudget('vitest');
|
|
115
102
|
|
|
116
103
|
const vitestResult = run('npx vitest run --coverage');
|
|
@@ -121,9 +108,9 @@ if (vitestResult.status !== 0) {
|
|
|
121
108
|
|
|
122
109
|
ok('Vitest: all tests passed, coverage thresholds met.');
|
|
123
110
|
|
|
124
|
-
// ──
|
|
111
|
+
// ── 3. bundle size ────────────────────────────────────────────────────────────
|
|
125
112
|
|
|
126
|
-
info('Sweep
|
|
113
|
+
info('Sweep 3/3 — bundle size audit…');
|
|
127
114
|
checkBudget('bundle audit');
|
|
128
115
|
|
|
129
116
|
const pkgPath = resolve(process.cwd(), 'package.json');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@final-commerce/common",
|
|
3
|
-
"version": "2.8.1-online.
|
|
3
|
+
"version": "2.8.1-online.5",
|
|
4
4
|
"description": "Shared utilities, types, constants, and engineering governance configs for the Final Commerce platform.",
|
|
5
5
|
"homepage": "https://github.com/Final-Commerce/common#readme",
|
|
6
6
|
"bugs": {
|