@lark-apaas/fullstack-cli 1.1.45-alpha.4 → 1.1.45-alpha.6
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/index.js
CHANGED
|
@@ -2380,19 +2380,19 @@ var syncConfig = {
|
|
|
2380
2380
|
type: "directory",
|
|
2381
2381
|
overwrite: true
|
|
2382
2382
|
},
|
|
2383
|
-
// 1a. 同步 .
|
|
2383
|
+
// 1a. 同步 .githooks 目录(hook 入口,可执行 sh 脚本)
|
|
2384
2384
|
{
|
|
2385
|
-
from: "templates/.
|
|
2386
|
-
to: ".
|
|
2385
|
+
from: "templates/.githooks",
|
|
2386
|
+
to: ".githooks",
|
|
2387
2387
|
type: "directory",
|
|
2388
2388
|
overwrite: true
|
|
2389
2389
|
},
|
|
2390
|
-
// 1b. scripts.prepare:npm install 后自动激活 git hooks
|
|
2390
|
+
// 1b. scripts.prepare:npm install 后自动激活 git hooks(原生 git,无第三方依赖)
|
|
2391
2391
|
// 直接写 core.hooksPath,并保底给 pre-commit 加执行位;非 git 仓库下静默退出
|
|
2392
2392
|
{
|
|
2393
2393
|
type: "add-script",
|
|
2394
2394
|
name: "prepare",
|
|
2395
|
-
command: "chmod +x .
|
|
2395
|
+
command: "chmod +x .githooks/pre-commit 2>/dev/null; git config core.hooksPath .githooks 2>/dev/null || true",
|
|
2396
2396
|
overwrite: false
|
|
2397
2397
|
},
|
|
2398
2398
|
// 1c. scripts.precommit = pre-commit 真正的执行体(npm run lint + read-logs ×5)
|
|
@@ -2624,7 +2624,7 @@ function cleanupPackageJson(cwd = process.cwd()) {
|
|
|
2624
2624
|
}
|
|
2625
2625
|
}
|
|
2626
2626
|
|
|
2627
|
-
// src/commands/sync/
|
|
2627
|
+
// src/commands/sync/activate-hooks.ts
|
|
2628
2628
|
import fs7 from "fs";
|
|
2629
2629
|
import path5 from "path";
|
|
2630
2630
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
@@ -2632,7 +2632,7 @@ function activateGitHooks(userProjectRoot) {
|
|
|
2632
2632
|
if (!fs7.existsSync(path5.join(userProjectRoot, ".git"))) {
|
|
2633
2633
|
return { action: "skipped-no-git" };
|
|
2634
2634
|
}
|
|
2635
|
-
const hookFile = path5.join(userProjectRoot, ".
|
|
2635
|
+
const hookFile = path5.join(userProjectRoot, ".githooks", "pre-commit");
|
|
2636
2636
|
if (!fs7.existsSync(hookFile)) {
|
|
2637
2637
|
return { action: "skipped-no-hook-file" };
|
|
2638
2638
|
}
|
|
@@ -2647,8 +2647,8 @@ function activateGitHooks(userProjectRoot) {
|
|
|
2647
2647
|
stdio: ["ignore", "pipe", "ignore"]
|
|
2648
2648
|
});
|
|
2649
2649
|
const currentHooksPath = probe.stdout ? probe.stdout.toString().trim() : "";
|
|
2650
|
-
if (currentHooksPath !== ".
|
|
2651
|
-
const res = spawnSync2("git", ["config", "core.hooksPath", ".
|
|
2650
|
+
if (currentHooksPath !== ".githooks") {
|
|
2651
|
+
const res = spawnSync2("git", ["config", "core.hooksPath", ".githooks"], {
|
|
2652
2652
|
cwd: userProjectRoot,
|
|
2653
2653
|
stdio: ["ignore", "inherit", "inherit"]
|
|
2654
2654
|
});
|
|
@@ -2658,7 +2658,7 @@ function activateGitHooks(userProjectRoot) {
|
|
|
2658
2658
|
changed = true;
|
|
2659
2659
|
}
|
|
2660
2660
|
if (changed) {
|
|
2661
|
-
console.log("[fullstack-cli] \u2713 git hooks activated (core.hooksPath -> .
|
|
2661
|
+
console.log("[fullstack-cli] \u2713 git hooks activated (core.hooksPath -> .githooks)");
|
|
2662
2662
|
return { action: "activated" };
|
|
2663
2663
|
}
|
|
2664
2664
|
return { action: "already-active" };
|
package/package.json
CHANGED