@pubinfo/commitlint 2.0.0-rc.3 → 2.0.0-rc.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/bin/commit.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { runMain } from '../dist/index.js';
2
+ import { runMain } from '../dist/run.js';
3
3
 
4
4
  runMain();
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,26 @@ declare function loadCommitConfig(): UserConfig & {
9
8
  prompt?: any;
10
9
  };
11
10
  //#endregion
12
- //#region src/prompt.d.ts
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(cfg: typeof commitPreset, opts: {
17
- emoji: boolean;
18
- }): Promise<PromptResult | null>;
27
+ declare function runPrompt(): Promise<PromptResult | null>;
19
28
  //#endregion
20
- //#region src/runner.d.ts
29
+ //#region src/utils/lint.message.d.ts
21
30
  declare function lintMessage(message: string): Promise<boolean>;
22
31
  declare function lintAndReturn(message: string): Promise<string>;
23
32
  //#endregion
24
- //#region src/setup.d.ts
25
- /**
26
- * 生成 cz-git 配置文件 (cz.config.cjs)。
27
- * 用途:
28
- * - 让 cz-git 交互界面显示中文提示、动态类型/范围。
29
- * - 保持与内置 commitPreset.prompt 同步。
30
- * 行为:始终覆盖写入(只要目录存在/可创建),不再跳过已存在文件。
31
- */
32
- declare function createCzConfigFile(cwd?: string): boolean;
33
- /**
34
- * 生成 .gitmessage 模板,便于 IDE / Git 原生命令在编辑器中提供格式示例。
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
- };
76
- //#endregion
77
- export { commitPreset, createCommitTemplate, createCzConfigFile, ensureGitTemplate, ensurePackageGitHooks, initCommitEnvironment, lintAndReturn, lintMessage, loadCommitConfig, runMain, runPrompt };
33
+ export { commitPreset, createCzConfig, createGitMessage, lintAndReturn, lintMessage, loadCommitConfig, runCzConfig, runGitMessage, runNpx, runPrompt, runSimpleGitHooks };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { commitPreset, createCommitTemplate, createCzConfigFile, ensureGitTemplate, ensurePackageGitHooks, initCommitEnvironment, lintAndReturn, lintMessage, loadCommitConfig, runMain, runPrompt } from "./run-kpuZDnr9.js";
1
+ import { commitPreset, createCzConfig, createGitMessage, lintAndReturn, lintMessage, loadCommitConfig, runCzConfig, runGitMessage, runNpx, runPrompt, runSimpleGitHooks } from "./lint.message-TYD-xclw.js";
2
2
 
3
- export { commitPreset, createCommitTemplate, createCzConfigFile, ensureGitTemplate, ensurePackageGitHooks, initCommitEnvironment, lintAndReturn, lintMessage, loadCommitConfig, runMain, runPrompt };
3
+ export { commitPreset, createCzConfig, createGitMessage, lintAndReturn, lintMessage, loadCommitConfig, runCzConfig, runGitMessage, runNpx, runPrompt, runSimpleGitHooks };