@icebreakers/monorepo 2.2.0 → 3.0.0
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/assets/.github/ISSUE_TEMPLATE/bug_report.yml +1 -1
- package/assets/package.json +4 -4
- package/bin/monorepo.js +2 -0
- package/dist/cli.cjs +55 -1551
- package/dist/cli.d.cts +1 -2
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +62 -0
- package/dist/index.cjs +43 -1583
- package/dist/index.d.cts +320 -301
- package/dist/index.d.mts +509 -0
- package/dist/index.mjs +3 -0
- package/dist/upgrade-BpSxJA9Y.cjs +1519 -0
- package/dist/upgrade-DKyLL_5k.mjs +1311 -0
- package/package.json +36 -15
- package/templates/apps/client/package.json +5 -5
- package/templates/apps/server/package.json +1 -1
- package/templates/packages/vue-lib-template/package.json +2 -2
- package/bin/copy.js +0 -2
- package/dist/chunk-Y4HUH2J5.js +0 -1534
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -76
- package/dist/index.d.ts +0 -490
- package/dist/index.js +0 -70
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import * as git_url_parse0 from "git-url-parse";
|
|
2
|
+
import gitUrlParse from "git-url-parse";
|
|
3
|
+
import * as simple_git0 from "simple-git";
|
|
4
|
+
import { ConfigValues, SimpleGit, SimpleGitOptions } from "simple-git";
|
|
5
|
+
import * as consola0 from "consola";
|
|
6
|
+
import crypto from "node:crypto";
|
|
7
|
+
import * as _pnpm_types0 from "@pnpm/types";
|
|
8
|
+
import { PackageJson } from "pkg-types";
|
|
9
|
+
|
|
10
|
+
//#region src/types/cli.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* CLI 公用参数,保证各命令对外暴露一致的行为。
|
|
13
|
+
*/
|
|
14
|
+
interface CliOpts {
|
|
15
|
+
/**
|
|
16
|
+
* 是否开启交互模式,开启后每一步都会提示用户确认。
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
interactive?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* 是否使用 core 版资产,只同步最精简的文件集合。
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
core?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* 输出目录(相对 `cwd`),用于放置生成或拷贝出来的文件。
|
|
27
|
+
* @default ''
|
|
28
|
+
*/
|
|
29
|
+
outDir?: string;
|
|
30
|
+
/**
|
|
31
|
+
* 命令执行的工作目录。
|
|
32
|
+
* @default process.cwd()
|
|
33
|
+
*/
|
|
34
|
+
cwd?: string;
|
|
35
|
+
/**
|
|
36
|
+
* 是否跳过已有文件的覆写;开启后保留旧文件不做对比。
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
skipOverwrite?: boolean;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/commands/create.d.ts
|
|
43
|
+
/**
|
|
44
|
+
* 内置模板映射表,value 指向仓库中对应模板所在路径。
|
|
45
|
+
*/
|
|
46
|
+
declare const templateMap: {
|
|
47
|
+
readonly tsup: "packages/tsup-template";
|
|
48
|
+
readonly tsdown: "packages/tsdown-template";
|
|
49
|
+
readonly unbuild: "packages/unbuild-template";
|
|
50
|
+
readonly 'vue-lib': "packages/vue-lib-template";
|
|
51
|
+
readonly 'hono-server': "apps/server";
|
|
52
|
+
readonly 'vue-hono': "apps/client";
|
|
53
|
+
readonly vitepress: "apps/website";
|
|
54
|
+
readonly cli: "apps/cli";
|
|
55
|
+
};
|
|
56
|
+
type CreateNewProjectType = keyof typeof templateMap;
|
|
57
|
+
interface CreateNewProjectOptions {
|
|
58
|
+
name?: string;
|
|
59
|
+
cwd?: string;
|
|
60
|
+
renameJson?: boolean;
|
|
61
|
+
type?: CreateNewProjectType | string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* 若配置中提供 choices 则优先使用,否则退回默认预设。
|
|
65
|
+
*/
|
|
66
|
+
declare function getCreateChoices(choices?: CreateChoiceOption[]): CreateChoiceOption[] | ({
|
|
67
|
+
readonly name: "unbuild 打包";
|
|
68
|
+
readonly value: "unbuild";
|
|
69
|
+
} | {
|
|
70
|
+
readonly name: "tsup 打包";
|
|
71
|
+
readonly value: "tsup";
|
|
72
|
+
} | {
|
|
73
|
+
readonly name: "tsdown 打包";
|
|
74
|
+
readonly value: "tsdown";
|
|
75
|
+
} | {
|
|
76
|
+
readonly name: "vue 组件";
|
|
77
|
+
readonly value: "vue-lib";
|
|
78
|
+
} | {
|
|
79
|
+
readonly name: "vue hono 全栈";
|
|
80
|
+
readonly value: "vue-hono";
|
|
81
|
+
} | {
|
|
82
|
+
readonly name: "hono 模板";
|
|
83
|
+
readonly value: "hono-server";
|
|
84
|
+
} | {
|
|
85
|
+
readonly name: "vitepress 文档";
|
|
86
|
+
readonly value: "vitepress";
|
|
87
|
+
} | {
|
|
88
|
+
readonly name: "cli 模板";
|
|
89
|
+
readonly value: "cli";
|
|
90
|
+
})[];
|
|
91
|
+
/**
|
|
92
|
+
* 合并内置与自定义模板映射,允许扩展新的模板类型。
|
|
93
|
+
*/
|
|
94
|
+
declare function getTemplateMap(extra?: Record<string, string>): Record<string, string>;
|
|
95
|
+
/**
|
|
96
|
+
* 根据提供的参数或配置生成新工程目录,并可自动改写 package.json。
|
|
97
|
+
*/
|
|
98
|
+
declare function createNewProject(options?: CreateNewProjectOptions): Promise<void>;
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/types/workspace.d.ts
|
|
101
|
+
/**
|
|
102
|
+
* 工作区工具可接收的筛选选项。
|
|
103
|
+
*/
|
|
104
|
+
interface GetWorkspacePackagesOptions {
|
|
105
|
+
/**
|
|
106
|
+
* 是否在结果中排除 workspace 根包。
|
|
107
|
+
* @default true
|
|
108
|
+
*/
|
|
109
|
+
ignoreRootPackage?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* 是否过滤掉标记为 `private` 的包。
|
|
112
|
+
* @default true
|
|
113
|
+
*/
|
|
114
|
+
ignorePrivatePackage?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* 自定义 glob,覆盖 `pnpm-workspace.yaml` 的 `packages` 配置。
|
|
117
|
+
* @default workspace manifest `packages`
|
|
118
|
+
*/
|
|
119
|
+
patterns?: string[];
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/types/config.d.ts
|
|
123
|
+
/**
|
|
124
|
+
* `monorepo new` 命令的配置项,允许外部覆写模板目录、模板清单等。
|
|
125
|
+
*/
|
|
126
|
+
interface CreateCommandConfig extends Partial<Omit<CreateNewProjectOptions, 'cwd'>> {
|
|
127
|
+
/**
|
|
128
|
+
* 自定义模板根目录。
|
|
129
|
+
* @default 内置模板所在的 `packages/monorepo/templates`
|
|
130
|
+
*/
|
|
131
|
+
templatesDir?: string;
|
|
132
|
+
/**
|
|
133
|
+
* 扩展模板映射表,key 为类型,value 为模板相对路径。
|
|
134
|
+
* @default 内置 `templateMap`
|
|
135
|
+
*/
|
|
136
|
+
templateMap?: Record<string, string>;
|
|
137
|
+
/**
|
|
138
|
+
* 自定义交互提示的选项列表。
|
|
139
|
+
* @default 内置 `baseChoices`
|
|
140
|
+
*/
|
|
141
|
+
choices?: CreateChoiceOption[];
|
|
142
|
+
/**
|
|
143
|
+
* 当未选择模板时使用的默认模板。
|
|
144
|
+
* @default 'unbuild'
|
|
145
|
+
*/
|
|
146
|
+
defaultTemplate?: CreateNewProjectOptions['type'];
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* CLI 交互式选择框的选项结构。
|
|
150
|
+
*/
|
|
151
|
+
interface CreateChoiceOption {
|
|
152
|
+
/**
|
|
153
|
+
* 唯一值,将回传给命令逻辑使用。
|
|
154
|
+
* @default undefined
|
|
155
|
+
*/
|
|
156
|
+
value: string;
|
|
157
|
+
/**
|
|
158
|
+
* 选项展示名称。
|
|
159
|
+
* @default value
|
|
160
|
+
*/
|
|
161
|
+
name?: string;
|
|
162
|
+
/**
|
|
163
|
+
* 选项描述信息。
|
|
164
|
+
* @default undefined
|
|
165
|
+
*/
|
|
166
|
+
description?: string;
|
|
167
|
+
/**
|
|
168
|
+
* 短名称,用于命令行紧凑展示。
|
|
169
|
+
* @default undefined
|
|
170
|
+
*/
|
|
171
|
+
short?: string;
|
|
172
|
+
/**
|
|
173
|
+
* 设置为 true 或字符串即可禁用该选项并显示原因。
|
|
174
|
+
* @default false
|
|
175
|
+
*/
|
|
176
|
+
disabled?: boolean | string;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* `monorepo clean` 命令配置,可控制自动选择、排除包等行为。
|
|
180
|
+
*/
|
|
181
|
+
interface CleanCommandConfig {
|
|
182
|
+
/**
|
|
183
|
+
* 是否跳过交互直接清理全部。
|
|
184
|
+
* @default false
|
|
185
|
+
*/
|
|
186
|
+
autoConfirm?: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* 不允许被清理的包名列表。
|
|
189
|
+
* @default []
|
|
190
|
+
*/
|
|
191
|
+
ignorePackages?: string[];
|
|
192
|
+
/**
|
|
193
|
+
* 是否包含 private 包。
|
|
194
|
+
* @default false
|
|
195
|
+
*/
|
|
196
|
+
includePrivate?: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* 强制写回的 @icebreakers/monorepo 版本。
|
|
199
|
+
* @default 当前依赖版本
|
|
200
|
+
*/
|
|
201
|
+
pinnedVersion?: string;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* `monorepo sync` 命令配置,可覆盖 workspace 过滤规则或同步命令模板。
|
|
205
|
+
*/
|
|
206
|
+
interface SyncCommandConfig extends Partial<GetWorkspacePackagesOptions> {
|
|
207
|
+
/**
|
|
208
|
+
* 并发执行同步命令的最大数量。
|
|
209
|
+
* @default os.cpus().length
|
|
210
|
+
*/
|
|
211
|
+
concurrency?: number;
|
|
212
|
+
/**
|
|
213
|
+
* 自定义执行的同步命令模板,使用 {name} 占位。
|
|
214
|
+
* @default 'cnpm sync {name}'
|
|
215
|
+
*/
|
|
216
|
+
command?: string;
|
|
217
|
+
/**
|
|
218
|
+
* 仅同步指定的包(按名称过滤)。
|
|
219
|
+
* @default 同步全部可见包
|
|
220
|
+
*/
|
|
221
|
+
packages?: string[];
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* `monorepo upgrade` 命令配置,覆盖脚本、目标文件等能力。
|
|
225
|
+
*/
|
|
226
|
+
interface UpgradeCommandConfig extends Partial<CliOpts> {
|
|
227
|
+
/**
|
|
228
|
+
* 额外需要写入的目标文件列表。
|
|
229
|
+
* @default []
|
|
230
|
+
*/
|
|
231
|
+
targets?: string[];
|
|
232
|
+
/**
|
|
233
|
+
* 是否与默认目标合并,false 表示完全覆盖。
|
|
234
|
+
* @default true
|
|
235
|
+
*/
|
|
236
|
+
mergeTargets?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* 需要写入 package.json 的脚本集合。
|
|
239
|
+
* @default {}
|
|
240
|
+
*/
|
|
241
|
+
scripts?: Record<string, string>;
|
|
242
|
+
/**
|
|
243
|
+
* 是否跳过生成 changeset markdown。
|
|
244
|
+
* @default true
|
|
245
|
+
*/
|
|
246
|
+
skipChangesetMarkdown?: boolean;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* `monorepo init` 命令配置,用于跳过部分初始化步骤。
|
|
250
|
+
*/
|
|
251
|
+
interface InitCommandConfig {
|
|
252
|
+
/**
|
|
253
|
+
* 是否跳过 README 生成。
|
|
254
|
+
* @default false
|
|
255
|
+
*/
|
|
256
|
+
skipReadme?: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* 是否跳过 package.json 写入。
|
|
259
|
+
* @default false
|
|
260
|
+
*/
|
|
261
|
+
skipPkgJson?: boolean;
|
|
262
|
+
/**
|
|
263
|
+
* 是否跳过 changeset 的更新。
|
|
264
|
+
* @default false
|
|
265
|
+
*/
|
|
266
|
+
skipChangeset?: boolean;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* `monorepo mirror` 命令配置,可增加额外的环境变量镜像。
|
|
270
|
+
*/
|
|
271
|
+
interface MirrorCommandConfig {
|
|
272
|
+
/**
|
|
273
|
+
* 需要注入的环境变量键值对。
|
|
274
|
+
* @default {}
|
|
275
|
+
*/
|
|
276
|
+
env?: Record<string, string>;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* 项目级配置入口,按命令划分可插拔的配置块。
|
|
280
|
+
*/
|
|
281
|
+
interface MonorepoConfig {
|
|
282
|
+
/**
|
|
283
|
+
* 按命令分类的可选配置。
|
|
284
|
+
* @default {}
|
|
285
|
+
*/
|
|
286
|
+
commands?: {
|
|
287
|
+
create?: CreateCommandConfig;
|
|
288
|
+
clean?: CleanCommandConfig;
|
|
289
|
+
sync?: SyncCommandConfig;
|
|
290
|
+
upgrade?: UpgradeCommandConfig;
|
|
291
|
+
init?: InitCommandConfig;
|
|
292
|
+
mirror?: MirrorCommandConfig;
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/core/git.d.ts
|
|
297
|
+
/**
|
|
298
|
+
* 对 simple-git 的轻量封装,集中处理配置缓存与常用查询。
|
|
299
|
+
*/
|
|
300
|
+
declare class GitClient {
|
|
301
|
+
#private;
|
|
302
|
+
private readonly client;
|
|
303
|
+
constructor(options?: Partial<SimpleGitOptions>);
|
|
304
|
+
/**
|
|
305
|
+
* 读取 Git 的 config 列表,原样返回 simple-git 的结果。
|
|
306
|
+
*/
|
|
307
|
+
listConfig(): simple_git0.Response<simple_git0.ConfigListSummary>;
|
|
308
|
+
/**
|
|
309
|
+
* 初始化配置缓存,避免多次访问 Git 产生的性能损耗。
|
|
310
|
+
*/
|
|
311
|
+
init(): Promise<ConfigValues>;
|
|
312
|
+
/**
|
|
313
|
+
* 获取缓存的配置,若未初始化则自动触发 init。
|
|
314
|
+
*/
|
|
315
|
+
getConfig(): Promise<ConfigValues>;
|
|
316
|
+
/**
|
|
317
|
+
* 解析 remote.origin.url,返回 git-url-parse 的结构,便于获取仓库元信息。
|
|
318
|
+
*/
|
|
319
|
+
getGitUrl(): Promise<gitUrlParse.GitUrl | undefined>;
|
|
320
|
+
/**
|
|
321
|
+
* 组合 owner/name,生成常用的仓库名表达。
|
|
322
|
+
*/
|
|
323
|
+
getRepoName(): Promise<string | undefined>;
|
|
324
|
+
/**
|
|
325
|
+
* 从 Git 配置中提取用户信息,用于填充 package.json author 字段。
|
|
326
|
+
*/
|
|
327
|
+
getUser(): Promise<{
|
|
328
|
+
name: string;
|
|
329
|
+
email: string;
|
|
330
|
+
}>;
|
|
331
|
+
/**
|
|
332
|
+
* 获取当前仓库的顶层目录路径。
|
|
333
|
+
*/
|
|
334
|
+
getRepoRoot(): Promise<string | undefined>;
|
|
335
|
+
}
|
|
336
|
+
//#endregion
|
|
337
|
+
//#region src/core/workspace.d.ts
|
|
338
|
+
/**
|
|
339
|
+
* 读取 pnpm workspace 下的所有包,并根据配置过滤与补充字段。
|
|
340
|
+
*/
|
|
341
|
+
declare function getWorkspacePackages(workspaceDir: string, options?: GetWorkspacePackagesOptions): Promise<{
|
|
342
|
+
pkgJsonPath: string;
|
|
343
|
+
rootDir: _pnpm_types0.ProjectRootDir;
|
|
344
|
+
rootDirRealPath: _pnpm_types0.ProjectRootDirRealPath;
|
|
345
|
+
modulesDir?: string;
|
|
346
|
+
manifest: _pnpm_types0.ProjectManifest;
|
|
347
|
+
writeProjectManifest: (manifest: _pnpm_types0.ProjectManifest, force?: boolean | undefined) => Promise<void>;
|
|
348
|
+
}[]>;
|
|
349
|
+
/**
|
|
350
|
+
* 将工作区绝对路径、包列表与当前 cwd 打包返回,方便调用方一次获取所有信息。
|
|
351
|
+
*/
|
|
352
|
+
declare function getWorkspaceData(cwd: string, options?: GetWorkspacePackagesOptions): Promise<{
|
|
353
|
+
cwd: string;
|
|
354
|
+
workspaceDir: string;
|
|
355
|
+
packages: {
|
|
356
|
+
pkgJsonPath: string;
|
|
357
|
+
rootDir: _pnpm_types0.ProjectRootDir;
|
|
358
|
+
rootDirRealPath: _pnpm_types0.ProjectRootDirRealPath;
|
|
359
|
+
modulesDir?: string;
|
|
360
|
+
manifest: _pnpm_types0.ProjectManifest;
|
|
361
|
+
writeProjectManifest: (manifest: _pnpm_types0.ProjectManifest, force?: boolean | undefined) => Promise<void>;
|
|
362
|
+
}[];
|
|
363
|
+
}>;
|
|
364
|
+
//#endregion
|
|
365
|
+
//#region src/commands/clean.d.ts
|
|
366
|
+
/**
|
|
367
|
+
* 交互式清理被选中的包目录,同时重写根 package.json 中的 @icebreakers/monorepo 版本。
|
|
368
|
+
*/
|
|
369
|
+
declare function cleanProjects(cwd: string): Promise<void>;
|
|
370
|
+
//#endregion
|
|
371
|
+
//#region src/commands/init/index.d.ts
|
|
372
|
+
/**
|
|
373
|
+
* 初始化命令入口,根据配置逐步生成基础文件。
|
|
374
|
+
*/
|
|
375
|
+
declare function init(cwd: string): Promise<void>;
|
|
376
|
+
//#endregion
|
|
377
|
+
//#region src/commands/mirror/binaryMirror.d.ts
|
|
378
|
+
/**
|
|
379
|
+
* 根据中国大陆镜像源,自动向 VSCode settings.json 注入终端环境变量。
|
|
380
|
+
*/
|
|
381
|
+
declare function setVscodeBinaryMirror(cwd: string): Promise<void>;
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region src/commands/sync.d.ts
|
|
384
|
+
/**
|
|
385
|
+
* 批量执行 `cnpm sync`(或自定义命令),将所有包同步到 npmmirror。
|
|
386
|
+
*/
|
|
387
|
+
declare function syncNpmMirror(cwd: string, options?: GetWorkspacePackagesOptions): Promise<void>;
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/commands/upgrade/index.d.ts
|
|
390
|
+
/**
|
|
391
|
+
* 将 assets 目录的模版文件同步到工程中,实现一键升级脚手架能力。
|
|
392
|
+
*/
|
|
393
|
+
declare function upgradeMonorepo(opts: CliOpts): Promise<void>;
|
|
394
|
+
//#endregion
|
|
395
|
+
//#region package.d.ts
|
|
396
|
+
declare let name: string;
|
|
397
|
+
declare let version: string;
|
|
398
|
+
//#endregion
|
|
399
|
+
//#region src/constants.d.ts
|
|
400
|
+
/**
|
|
401
|
+
* @icebreakers/monorepo 包的根目录,所有模板与资产目录都以此为基准。
|
|
402
|
+
*/
|
|
403
|
+
declare const packageDir: string;
|
|
404
|
+
/**
|
|
405
|
+
* CLI 提供的模板目录,`monorepo new` 会从这里复制目标工程骨架。
|
|
406
|
+
*/
|
|
407
|
+
declare const templatesDir: string;
|
|
408
|
+
/**
|
|
409
|
+
* 升级命令需要写入的静态文件集合,位于 assets 目录中。
|
|
410
|
+
*/
|
|
411
|
+
declare const assetsDir: string;
|
|
412
|
+
/**
|
|
413
|
+
* monorepo 根目录,方便需要跳出当前包的逻辑(例如定位工作区文件)。
|
|
414
|
+
*/
|
|
415
|
+
declare const rootDir: string;
|
|
416
|
+
//#endregion
|
|
417
|
+
//#region src/core/config.d.ts
|
|
418
|
+
/**
|
|
419
|
+
* 提供类型提示的辅助函数,供外部定义配置时使用。
|
|
420
|
+
*/
|
|
421
|
+
declare function defineMonorepoConfig(config: MonorepoConfig): MonorepoConfig;
|
|
422
|
+
/**
|
|
423
|
+
* 加载指定目录的 monorepo 配置,并利用缓存提升性能。
|
|
424
|
+
*/
|
|
425
|
+
declare function loadMonorepoConfig(cwd: string): Promise<MonorepoConfig>;
|
|
426
|
+
/**
|
|
427
|
+
* 获取命令对应的合并配置,若未配置则返回空对象,保证调用端逻辑简单。
|
|
428
|
+
*/
|
|
429
|
+
declare function resolveCommandConfig<Name extends keyof NonNullable<MonorepoConfig['commands']>>(name: Name, cwd: string): Promise<NonNullable<MonorepoConfig['commands']>[Name]>;
|
|
430
|
+
//#endregion
|
|
431
|
+
//#region src/core/context.d.ts
|
|
432
|
+
/**
|
|
433
|
+
* 构建命令执行上下文,封装常用的工作区、Git、配置等信息。
|
|
434
|
+
*/
|
|
435
|
+
declare function createContext(cwd: string): Promise<{
|
|
436
|
+
cwd: string;
|
|
437
|
+
git: GitClient;
|
|
438
|
+
gitUrl: git_url_parse0.GitUrl | undefined;
|
|
439
|
+
gitUser: {
|
|
440
|
+
name: string;
|
|
441
|
+
email: string;
|
|
442
|
+
};
|
|
443
|
+
workspaceDir: string;
|
|
444
|
+
workspaceFilepath: string;
|
|
445
|
+
packages: {
|
|
446
|
+
pkgJsonPath: string;
|
|
447
|
+
rootDir: _pnpm_types0.ProjectRootDir;
|
|
448
|
+
rootDirRealPath: _pnpm_types0.ProjectRootDirRealPath;
|
|
449
|
+
modulesDir?: string;
|
|
450
|
+
manifest: _pnpm_types0.ProjectManifest;
|
|
451
|
+
writeProjectManifest: (manifest: _pnpm_types0.ProjectManifest, force?: boolean | undefined) => Promise<void>;
|
|
452
|
+
}[];
|
|
453
|
+
config: MonorepoConfig;
|
|
454
|
+
}>;
|
|
455
|
+
/**
|
|
456
|
+
* 统一导出的上下文类型,方便下游函数准确获知可用字段。
|
|
457
|
+
*/
|
|
458
|
+
type Context = Awaited<ReturnType<typeof createContext>>;
|
|
459
|
+
//#endregion
|
|
460
|
+
//#region src/core/logger.d.ts
|
|
461
|
+
/**
|
|
462
|
+
* 统一的日志实例,便于在命令行中输出带有前缀和颜色的消息。
|
|
463
|
+
*/
|
|
464
|
+
declare const logger: consola0.ConsolaInstance;
|
|
465
|
+
//#endregion
|
|
466
|
+
//#region src/utils/fs.d.ts
|
|
467
|
+
/**
|
|
468
|
+
* 判断是否为可忽略的文件系统错误。
|
|
469
|
+
* - ENOENT: 文件已被删除
|
|
470
|
+
* - EBUSY: Windows 中资源被系统占用
|
|
471
|
+
*/
|
|
472
|
+
declare function isIgnorableFsError(error: unknown): error is NodeJS.ErrnoException;
|
|
473
|
+
//#endregion
|
|
474
|
+
//#region src/utils/gitignore.d.ts
|
|
475
|
+
/**
|
|
476
|
+
* Map a workspace path (containing `.gitignore`) to its packaged variant.
|
|
477
|
+
*/
|
|
478
|
+
declare function toPublishGitignorePath(input: string): string;
|
|
479
|
+
/**
|
|
480
|
+
* Map a packaged path (containing `gitignore`) back to the workspace form.
|
|
481
|
+
*/
|
|
482
|
+
declare function toWorkspaceGitignorePath(input: string): string;
|
|
483
|
+
/**
|
|
484
|
+
* Convenient helper to check whether a filename (with or without dot prefix)
|
|
485
|
+
* should be treated as a gitignore file.
|
|
486
|
+
*/
|
|
487
|
+
declare function isGitignoreFile(name: string): boolean;
|
|
488
|
+
//#endregion
|
|
489
|
+
//#region src/utils/hash.d.ts
|
|
490
|
+
/**
|
|
491
|
+
* 生成给定二进制内容的 md5 摘要,用于快速比较文件内容。
|
|
492
|
+
*/
|
|
493
|
+
declare function getFileHash(data: crypto.BinaryLike): string;
|
|
494
|
+
/**
|
|
495
|
+
* 对比两个文件的 md5,如果不一致则认为内容有变化。
|
|
496
|
+
*/
|
|
497
|
+
declare function isFileChanged(src: crypto.BinaryLike, dest: crypto.BinaryLike): boolean;
|
|
498
|
+
//#endregion
|
|
499
|
+
//#region src/utils/regexp.d.ts
|
|
500
|
+
/**
|
|
501
|
+
* 逃逸正则表达式中所有特殊字符,避免被当做模式解析。
|
|
502
|
+
*/
|
|
503
|
+
declare function escapeStringRegexp(str: string): string;
|
|
504
|
+
/**
|
|
505
|
+
* 判断字符串是否命中任意一个正则,用于过滤要同步的资产文件。
|
|
506
|
+
*/
|
|
507
|
+
declare function isMatch(str: string, arr: RegExp[]): boolean;
|
|
508
|
+
//#endregion
|
|
509
|
+
export { type CleanCommandConfig, type CliOpts, type ConfigValues, Context, type CreateChoiceOption, type CreateCommandConfig, type CreateNewProjectOptions, type GetWorkspacePackagesOptions, GitClient, type InitCommandConfig, type MirrorCommandConfig, type MonorepoConfig, type PackageJson, type SimpleGit, type SimpleGitOptions, type SyncCommandConfig, type UpgradeCommandConfig, assetsDir, cleanProjects, createContext, createNewProject, defineMonorepoConfig, escapeStringRegexp, getCreateChoices, getFileHash, getTemplateMap, getWorkspaceData, getWorkspacePackages, init, isFileChanged, isGitignoreFile, isIgnorableFsError, isMatch, loadMonorepoConfig, logger, name, packageDir, resolveCommandConfig, rootDir, setVscodeBinaryMirror, syncNpmMirror, templateMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath, upgradeMonorepo, version };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { A as getWorkspaceData, C as templatesDir, D as defineMonorepoConfig, E as cleanProjects, M as GitClient, O as loadMonorepoConfig, S as rootDir, T as version, _ as toWorkspaceGitignorePath, a as createContext, b as assetsDir, c as getCreateChoices, d as escapeStringRegexp, f as isMatch, g as toPublishGitignorePath, h as isGitignoreFile, i as init, j as getWorkspacePackages, k as resolveCommandConfig, l as getTemplateMap, m as isFileChanged, n as syncNpmMirror, o as createNewProject, p as getFileHash, r as setVscodeBinaryMirror, t as upgradeMonorepo, u as templateMap, v as isIgnorableFsError, w as name, x as packageDir, y as logger } from "./upgrade-DKyLL_5k.mjs";
|
|
2
|
+
|
|
3
|
+
export { GitClient, assetsDir, cleanProjects, createContext, createNewProject, defineMonorepoConfig, escapeStringRegexp, getCreateChoices, getFileHash, getTemplateMap, getWorkspaceData, getWorkspacePackages, init, isFileChanged, isGitignoreFile, isIgnorableFsError, isMatch, loadMonorepoConfig, logger, name, packageDir, resolveCommandConfig, rootDir, setVscodeBinaryMirror, syncNpmMirror, templateMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath, upgradeMonorepo, version };
|