@vnptnan/gate 1.0.2 → 1.0.4
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/VERSION +1 -1
- package/bin/cli.js +4 -2
- package/package.json +1 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.4
|
package/bin/cli.js
CHANGED
|
@@ -33,7 +33,7 @@ for (let i = 0; i < argv.length; i++) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function say(s) { if (!opt.quiet) console.log(s); log(s); }
|
|
36
|
-
function log(s) { try { fs.mkdirSync(path.dirname(LOG), { recursive: true }); fs.appendFileSync(LOG, `${new Date().toISOString()}\t${s}\n`); } catch (_) { /* chưa có quyền ghi */ } }
|
|
36
|
+
function log(s) { try { fs.mkdirSync(path.dirname(LOG), { recursive: true }); if (!fs.existsSync(LOG)) fs.writeFileSync(LOG, '\ufeff'); fs.appendFileSync(LOG, `${new Date().toISOString()}\t${s}\n`); } catch (_) { /* chưa có quyền ghi */ } }
|
|
37
37
|
function die(s, code = 1) { console.error(`[VNPTNAN_GATE] ${s}`); log(`LOI\t${s}`); process.exit(code); }
|
|
38
38
|
function readJson(p) { try { return JSON.parse(fs.readFileSync(p, 'utf8')); } catch (_) { return null; } }
|
|
39
39
|
const cmpVer = (a, b) => { const x = a.split(/[.-]/).map(Number), y = b.split(/[.-]/).map(Number); for (let i = 0; i < 3; i++) if ((x[i] || 0) !== (y[i] || 0)) return (x[i] || 0) - (y[i] || 0); return 0; };
|
|
@@ -195,7 +195,9 @@ async function setup() {
|
|
|
195
195
|
if (!isAdmin()) return elevate(passArgs(s));
|
|
196
196
|
const stage = path.join(HOME, 'staging', PKG.version);
|
|
197
197
|
fs.rmSync(stage, { recursive: true, force: true }); fs.mkdirSync(stage, { recursive: true });
|
|
198
|
-
|
|
198
|
+
// Lọc theo đường dẫn TƯƠNG ĐỐI: chạy qua npx thì chính ROOT nằm trong ...\npm-cache\_npx\...\node_modules\@vnptnan\gate
|
|
199
|
+
fs.cpSync(ROOT, stage, { recursive: true, filter: (p) => !path.relative(ROOT, p).split(/[\\/]/).includes('node_modules') });
|
|
200
|
+
if (!fs.existsSync(path.join(stage, 'installer', 'install.ps1'))) throw new Error(`Chép bộ cài vào ${stage} không đủ file`);
|
|
199
201
|
const mode = modeFor(s, stage);
|
|
200
202
|
installFrom(stage, mode);
|
|
201
203
|
fs.rmSync(stage, { recursive: true, force: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnptnan/gate",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Cổng kiểm soát an toàn bảo mật thông tin khi dùng AI trong phát triển phần mềm: chặn secret, dữ liệu cá nhân, package bịa ở prompt, commit, push và máy chủ GitLab. Cài: npx @vnptnan/gate",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"git-hooks",
|