@pubinfo/commitlint 2.0.0-rc.3 → 2.0.0-rc.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/commit.js +1 -1
- package/dist/index.d.ts +23 -61
- package/dist/index.js +2 -2
- package/dist/lint.message-CZXQspF4.js +2359 -0
- package/dist/run.d.ts +3 -1
- package/dist/run.js +125 -1
- package/package.json +4 -1
- package/dist/run-Ckp4pYFS.d.ts +0 -4
- package/dist/run-kpuZDnr9.js +0 -587
package/bin/commit.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { runMain } from "./run-Ckp4pYFS.js";
|
|
2
1
|
import { UserConfig } from "@commitlint/types";
|
|
3
2
|
|
|
4
|
-
//#region src/config.d.ts
|
|
3
|
+
//#region src/config/index.d.ts
|
|
5
4
|
declare const commitPreset: UserConfig & {
|
|
6
5
|
prompt?: any;
|
|
7
6
|
};
|
|
@@ -9,69 +8,32 @@ declare function loadCommitConfig(): UserConfig & {
|
|
|
9
8
|
prompt?: any;
|
|
10
9
|
};
|
|
11
10
|
//#endregion
|
|
12
|
-
//#region src/
|
|
11
|
+
//#region src/init/cz.config.d.ts
|
|
12
|
+
declare function createCzConfig(cwd?: string): boolean;
|
|
13
|
+
declare function runCzConfig(czConfigPath: string, cwd?: string): boolean;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/init/git.message.d.ts
|
|
16
|
+
declare function createGitMessage(rootPath?: string): boolean;
|
|
17
|
+
declare function runGitMessage(rootPath?: string): boolean;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/init/simple.git.hook.d.ts
|
|
20
|
+
declare function runSimpleGitHooks(script?: string, cwd?: string): boolean;
|
|
21
|
+
declare function runNpx(cwd?: string): boolean;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/prompt/index.d.ts
|
|
13
24
|
interface PromptResult {
|
|
14
25
|
raw: string;
|
|
15
26
|
}
|
|
16
|
-
declare function runPrompt(
|
|
17
|
-
emoji: boolean;
|
|
18
|
-
}): Promise<PromptResult | null>;
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region src/runner.d.ts
|
|
21
|
-
declare function lintMessage(message: string): Promise<boolean>;
|
|
22
|
-
declare function lintAndReturn(message: string): Promise<string>;
|
|
27
|
+
declare function runPrompt(): Promise<PromptResult | null>;
|
|
23
28
|
//#endregion
|
|
24
|
-
//#region src/
|
|
29
|
+
//#region src/utils/git.d.ts
|
|
25
30
|
/**
|
|
26
|
-
*
|
|
27
|
-
* 用途:
|
|
28
|
-
* - 让 cz-git 交互界面显示中文提示、动态类型/范围。
|
|
29
|
-
* - 保持与内置 commitPreset.prompt 同步。
|
|
30
|
-
* 行为:始终覆盖写入(只要目录存在/可创建),不再跳过已存在文件。
|
|
31
|
+
* 判断当前工作目录是否处在 Git 仓库内。
|
|
31
32
|
*/
|
|
32
|
-
declare function
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
declare function createCommitTemplate(cwd?: string): boolean;
|
|
38
|
-
/**
|
|
39
|
-
* 将 Git 全局/仓库级 commit.template 指向 .gitmessage(若尚未设置)。
|
|
40
|
-
* 失败会静默忽略,不影响主流程。
|
|
41
|
-
*/
|
|
42
|
-
declare function ensureGitTemplate(cwd?: string): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* 确保 package.json 中 simple-git-hooks 配置包含:
|
|
45
|
-
* - pre-commit: 仅 lint-staged 处理已暂存文件 + 全量 lint 兜底
|
|
46
|
-
* - commit-msg: 动态选择使用统一 CLI(pubinfo) 还是回退二进制(pubinfo-commit)
|
|
47
|
-
* 逻辑:
|
|
48
|
-
* 1. 根据依赖判断是否有 pubinfo / @pubinfo/cli
|
|
49
|
-
* 2. 幂等写入,无差异则不改动文件
|
|
50
|
-
*/
|
|
51
|
-
declare function ensurePackageGitHooks(cwd?: string): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* 确保 package.json 中的 commitizen 配置指向迁移后的 .pubinfo/cz.config.cjs。
|
|
54
|
-
* 适用场景:用户仍然使用 git-cz / czg / commitizen 入口时,能复用同一份配置。
|
|
55
|
-
* 规则:
|
|
56
|
-
* - 若无 config.commitizen,则创建 { path: 'node_modules/cz-git', czConfig: '.pubinfo/cz.config.cjs' }
|
|
57
|
-
* - 若已有但未声明 czConfig 或旧路径 (如 cz.config.cjs / ./cz.config.cjs),更新为新路径。
|
|
58
|
-
* - 不主动覆盖指向其它自定义文件的 czConfig(若用户显式设置且非根默认文件名)。
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* 一键初始化提交环境:
|
|
63
|
-
* - 生成 .gitmessage / cz.config.cjs
|
|
64
|
-
* - 设置 commit.template
|
|
65
|
-
* - 写入 simple-git-hooks 配置并安装
|
|
66
|
-
* 返回各步骤布尔状态,便于上层打印调试。
|
|
67
|
-
*/
|
|
68
|
-
declare function initCommitEnvironment(cwd?: string): {
|
|
69
|
-
createdTpl: boolean;
|
|
70
|
-
createdCz: boolean;
|
|
71
|
-
setTpl: boolean;
|
|
72
|
-
updatedPkg: boolean;
|
|
73
|
-
updatedCommitizen: boolean;
|
|
74
|
-
installed: boolean;
|
|
75
|
-
};
|
|
33
|
+
declare function isInsideGitRepo(): boolean;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/utils/lint.message.d.ts
|
|
36
|
+
declare function lintMessage(message: string): Promise<boolean>;
|
|
37
|
+
declare function lintAndReturn(message: string): Promise<string>;
|
|
76
38
|
//#endregion
|
|
77
|
-
export { commitPreset,
|
|
39
|
+
export { commitPreset, createCzConfig, createGitMessage, isInsideGitRepo, lintAndReturn, lintMessage, loadCommitConfig, runCzConfig, runGitMessage, runNpx, runPrompt, runSimpleGitHooks };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { commitPreset,
|
|
1
|
+
import { commitPreset, createCzConfig, createGitMessage, isInsideGitRepo, lintAndReturn, lintMessage, loadCommitConfig, runCzConfig, runGitMessage, runNpx, runPrompt, runSimpleGitHooks } from "./lint.message-CZXQspF4.js";
|
|
2
2
|
|
|
3
|
-
export { commitPreset,
|
|
3
|
+
export { commitPreset, createCzConfig, createGitMessage, isInsideGitRepo, lintAndReturn, lintMessage, loadCommitConfig, runCzConfig, runGitMessage, runNpx, runPrompt, runSimpleGitHooks };
|