@longzai-intelligence-git/config 0.1.3 → 0.1.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/dist/index.d.ts +23 -16
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* 用于把散落在 .gitignore 中的模式按主题归类,输出时以 `# <comment>` 作为分组头。
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
type GitignoreGroup = {
|
|
15
15
|
/**
|
|
16
16
|
* 分组标题纯文本。
|
|
17
17
|
*
|
|
@@ -25,14 +25,14 @@ interface GitignoreGroup {
|
|
|
25
25
|
* 用于把现有 .gitignore 中的行分类到分组;分类时按归一化后的模式精确匹配。
|
|
26
26
|
*/
|
|
27
27
|
readonly patterns: readonly string[];
|
|
28
|
-
}
|
|
28
|
+
};
|
|
29
29
|
/**
|
|
30
30
|
* .gitignore 格式化选项
|
|
31
31
|
*
|
|
32
32
|
* 控制归一化与分组编排的具体行为。所有字段在 lzi-git.config.ts 中以 Partial 形式可选,
|
|
33
33
|
* 未提供时由格式化器回退到默认值。
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
type GitignoreFormatOptions = {
|
|
36
36
|
/**
|
|
37
37
|
* 是否按 config.groups 重组模式到分组下。
|
|
38
38
|
*
|
|
@@ -43,9 +43,8 @@ interface GitignoreFormatOptions {
|
|
|
43
43
|
/**
|
|
44
44
|
* 预设/自定义分组缺失模式的注入范围。
|
|
45
45
|
*
|
|
46
|
-
* - `'root-only'`(默认):仅向「配置根 `.gitignore`」(与 `lzi-git.config.ts` 同目录的那个)
|
|
47
|
-
*
|
|
48
|
-
* 归一化、排序、去重,不新增任何模式。这避免子文件重复根已覆盖的通用忽略项。
|
|
46
|
+
* - `'root-only'`(默认):仅向「配置根 `.gitignore`」(与 `lzi-git.config.ts` 同目录的那个) 注入启用的 preset 与自定义 groups
|
|
47
|
+
* 的缺失模式;其余子目录 `.gitignore` 只做分类归组、 归一化、排序、去重,不新增任何模式。这避免子文件重复根已覆盖的通用忽略项。
|
|
49
48
|
* - `'always'`:向每个被处理的 `.gitignore` 都注入缺失模式(遗留行为,子文件会膨胀)。
|
|
50
49
|
*
|
|
51
50
|
* 「是否为根文件」由 CLI 根据文件所在目录是否等于配置文件目录判定,并通过
|
|
@@ -78,7 +77,7 @@ interface GitignoreFormatOptions {
|
|
|
78
77
|
* 默认 '其他'。
|
|
79
78
|
*/
|
|
80
79
|
readonly miscGroupComment: string;
|
|
81
|
-
}
|
|
80
|
+
};
|
|
82
81
|
/**
|
|
83
82
|
* .gitignore 格式化的默认选项。
|
|
84
83
|
*
|
|
@@ -91,7 +90,7 @@ declare const DEFAULT_GITIGNORE_OPTIONS: GitignoreFormatOptions;
|
|
|
91
90
|
* 每个键对应一组通用忽略模式,用户在 lzi-git.config.ts 的 presets 里用同名 boolean 开关控制。
|
|
92
91
|
* 扩展新预设时在此联合类型追加键名。
|
|
93
92
|
*/
|
|
94
|
-
type GitignorePresetKey = 'node' | 'electron' | 'bun' | 'turbo' | 'swc' | 'coverage' | 'sqlite' | 'env' | 'idea' | 'vscode' | 'macos' | 'windows' | 'linux' | 'npm' | 'agent';
|
|
93
|
+
type GitignorePresetKey = 'node' | 'electron' | 'bun' | 'turbo' | 'swc' | 'coverage' | 'sqlite' | 'env' | 'idea' | 'vscode' | 'macos' | 'windows' | 'linux' | 'npm' | 'agent' | 'lzi';
|
|
95
94
|
/**
|
|
96
95
|
* 内置预设定义。
|
|
97
96
|
*
|
|
@@ -99,14 +98,20 @@ type GitignorePresetKey = 'node' | 'electron' | 'bun' | 'turbo' | 'swc' | 'cover
|
|
|
99
98
|
* - default=true 的 preset 在用户未配置时自动启用(开箱即用)
|
|
100
99
|
* - default=false 的 preset 需用户显式开启(如 vscode,多数团队希望保留 .vscode 共享配置提交)
|
|
101
100
|
*/
|
|
102
|
-
|
|
103
|
-
/**
|
|
101
|
+
type GitignorePresetDefinition = {
|
|
102
|
+
/**
|
|
103
|
+
* 归属分组标题(纯文本,不含 #,输出时自动补)。
|
|
104
|
+
*/
|
|
104
105
|
readonly comment: string;
|
|
105
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* 该预设注入的模式集合。
|
|
108
|
+
*/
|
|
106
109
|
readonly patterns: readonly string[];
|
|
107
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* 默认开关(用户未在 presets 里声明时使用)。
|
|
112
|
+
*/
|
|
108
113
|
readonly default: boolean;
|
|
109
|
-
}
|
|
114
|
+
};
|
|
110
115
|
/**
|
|
111
116
|
* 内置预设表(键 → 定义)。
|
|
112
117
|
*
|
|
@@ -132,7 +137,7 @@ declare const DEFAULT_GITIGNORE_PRESETS: GitignorePresets;
|
|
|
132
137
|
*
|
|
133
138
|
* 顶层按工具域分块,当前仅有 gitignore。后续新增工具域(如 hooks、aliases)时在此扩展。
|
|
134
139
|
*/
|
|
135
|
-
|
|
140
|
+
type LziGitConfig = {
|
|
136
141
|
/**
|
|
137
142
|
* .gitignore 格式化配置。
|
|
138
143
|
*/
|
|
@@ -149,7 +154,9 @@ interface LziGitConfig {
|
|
|
149
154
|
*
|
|
150
155
|
* @example
|
|
151
156
|
* // 默认 .vscode 不忽略;开启它进入 ignore
|
|
152
|
-
* presets: {
|
|
157
|
+
* presets: {
|
|
158
|
+
* vscode: true;
|
|
159
|
+
* }
|
|
153
160
|
*/
|
|
154
161
|
readonly presets?: GitignorePresets;
|
|
155
162
|
/**
|
|
@@ -160,7 +167,7 @@ interface LziGitConfig {
|
|
|
160
167
|
*/
|
|
161
168
|
readonly groups?: readonly GitignoreGroup[];
|
|
162
169
|
};
|
|
163
|
-
}
|
|
170
|
+
};
|
|
164
171
|
//#endregion
|
|
165
172
|
//#region src/define-config.d.ts
|
|
166
173
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={groupByConfig:!0,injectMode:`root-only`,sortWithinGroup:!0,dedupe:!0,blankLinesBetweenGroups:1,miscGroupComment:`其他`},t={node:{comment:`依赖与构建`,patterns:[`node_modules
|
|
1
|
+
const e={groupByConfig:!0,injectMode:`root-only`,sortWithinGroup:!0,dedupe:!0,blankLinesBetweenGroups:1,miscGroupComment:`其他`},t={node:{comment:`依赖与构建`,patterns:[`node_modules/`,`dist/`,`build/`,`.cache/`,`*.log`,`*.tsbuildinfo`,`tsup.config.bundled_*.mjs`],default:!0},electron:{comment:`Electron`,patterns:[`out/`],default:!0},bun:{comment:`Bun`,patterns:[`.bun/`],default:!0},turbo:{comment:`Turbo`,patterns:[`.turbo/`],default:!0},swc:{comment:`SWC`,patterns:[`.swc/`],default:!0},coverage:{comment:`测试覆盖率`,patterns:[`coverage/`,`.nyc_output/`],default:!0},sqlite:{comment:`SQLite 数据库`,patterns:[`*.db`,`*.db-journal`,`*.db-wal`,`*.db-shm`,`*.sqlite`,`*.sqlite3`,`*.sqlite-journal`,`*.sqlite-wal`,`*.sqlite-shm`],default:!0},env:{comment:`环境变量`,patterns:[`.env`,`.env.*`,`!.env.example`],default:!0},idea:{comment:`JetBrains IDE`,patterns:[`.idea/`],default:!0},vscode:{comment:`VSCode`,patterns:[`.vscode/*`,`!.vscode/settings.json`,`!.vscode/tasks.json`,`!.vscode/launch.json`,`!.vscode/extensions.json`],default:!1},macos:{comment:`macOS 系统文件`,patterns:[`.DS_Store`],default:!0},windows:{comment:`Windows 系统文件`,patterns:[`Thumbs.db`,`ehthumbs.db`,`Desktop.ini`],default:!1},linux:{comment:`Linux 系统文件`,patterns:[`*~`],default:!1},npm:{comment:`npm`,patterns:[`.npmrc`],default:!0},agent:{comment:`AI Agent 本地文件`,patterns:[`CLAUDE.local.md`],default:!0},lzi:{comment:`lzi 工具链产物`,patterns:[`.lzi/issues/`,`CLAUDE.md`,`AGENTS.md`],default:!0}},n=Object.fromEntries(Object.keys(t).map(e=>[e,t[e].default])),r={gitignore:{options:e,presets:n}},i=t=>{if(t===void 0||t.gitignore===void 0)return r;let i=t.gitignore,a={options:{...e,...i.options},presets:{...n,...i.presets},...i.groups===void 0?{}:{groups:i.groups}};return{...t,gitignore:a}};export{e as DEFAULT_GITIGNORE_OPTIONS,n as DEFAULT_GITIGNORE_PRESETS,t as GITIGNORE_PRESETS,i as defineConfig};
|