@icebreakers/monorepo 4.0.5 → 4.0.7
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/README.md +42 -37
- package/dist/cli.mjs +38 -64
- package/dist/{commands-BDc4kaVr.mjs → commands-LC_g9yaY.mjs} +254 -137
- package/dist/{config-itCaAICn.mjs → config-BrLDFwAH.mjs} +13 -22
- package/dist/{create-flow-BdzRAs_D.mjs → create-flow-BSS7K95k.mjs} +3 -3
- package/dist/{index-DvZrxwOh.d.mts → index-CJ0vJpBt.d.mts} +60 -45
- package/dist/index.d.mts +10 -17
- package/dist/index.mjs +5 -5
- package/dist/{tooling-cxnXmQex.mjs → tooling-D1Bjw6xy.mjs} +63 -37
- package/dist/tooling-entry.d.mts +2 -2
- package/dist/tooling-entry.mjs +1 -1
- package/dist/{types-l72Q1OXu.mjs → types-BwhDyALS.mjs} +7 -7
- package/package.json +33 -13
- package/bin/mo.js +0 -2
- package/bin/monorepo.js +0 -2
- package/bin/rc.js +0 -2
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
8
|
pnpm add -D repoctl
|
|
9
|
-
pnpm exec repo
|
|
9
|
+
pnpm exec repo init
|
|
10
10
|
pnpm exec repo doctor
|
|
11
11
|
pnpm exec repo doctor --json
|
|
12
12
|
pnpm exec repo templates
|
|
@@ -16,13 +16,13 @@ pnpm exec repo check --dry-run
|
|
|
16
16
|
pnpm exec repo env info
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
模板生成后的仓库还会带上无冲突的 `repo:*` 根脚本:
|
|
20
20
|
|
|
21
21
|
```sh
|
|
22
|
-
pnpm
|
|
23
|
-
pnpm doctor
|
|
24
|
-
pnpm new my-package
|
|
25
|
-
pnpm check
|
|
22
|
+
pnpm run repo:init
|
|
23
|
+
pnpm run repo:doctor -- --json
|
|
24
|
+
pnpm run repo:new -- my-package
|
|
25
|
+
pnpm run repo:check
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## 什么时候直接用这个包
|
|
@@ -32,35 +32,35 @@ pnpm check
|
|
|
32
32
|
- 你需要直接使用 `@icebreakers/monorepo` / `@icebreakers/monorepo/tooling` 的程序化 API
|
|
33
33
|
- 你在维护 `repoctl` 的底层实现、模板、升级资产或 wrapper 配置
|
|
34
34
|
|
|
35
|
-
## CLI
|
|
35
|
+
## CLI 入口
|
|
36
36
|
|
|
37
|
-
`repo
|
|
37
|
+
`@icebreakers/monorepo` 仍提供 `repo` / `repoctl` 两个 CLI 入口,旧的 `monorepo`、`mo`、`rc` bin 别名已移除。
|
|
38
38
|
|
|
39
39
|
```sh
|
|
40
40
|
pnpm add -D @icebreakers/monorepo@latest
|
|
41
41
|
|
|
42
42
|
# 顶层任务命令
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
pnpm exec repo init
|
|
44
|
+
pnpm exec repo doctor
|
|
45
|
+
pnpm exec repo templates
|
|
46
|
+
pnpm exec repo new my-package
|
|
47
|
+
pnpm exec repo check
|
|
48
|
+
pnpm exec repo upgrade
|
|
49
49
|
|
|
50
50
|
# 分组命令
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
pnpm exec repo ws up
|
|
52
|
+
pnpm exec repo ws ls --json --include-private
|
|
53
|
+
pnpm exec repo tg init --all
|
|
54
|
+
pnpm exec repo pkg new
|
|
55
|
+
pnpm exec repo ai p new --name checkout
|
|
56
|
+
pnpm exec repo skills sync --codex
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
推荐顺序是:
|
|
60
60
|
|
|
61
|
-
1. 生成仓库里的 `pnpm
|
|
61
|
+
1. 生成仓库里的 `pnpm run repo:init / pnpm run repo:doctor / pnpm run repo:new / pnpm run repo:check`
|
|
62
62
|
2. `repo ...`
|
|
63
|
-
3. `repoctl ...`
|
|
63
|
+
3. `repoctl ...`
|
|
64
64
|
|
|
65
65
|
## `repo check`
|
|
66
66
|
|
|
@@ -81,9 +81,9 @@ repo check --full --json --out reports/check-plan.json
|
|
|
81
81
|
- 根 `package.json`
|
|
82
82
|
- `pnpm-workspace.yaml`
|
|
83
83
|
- 当前 Node 版本是否满足 `engines.node`
|
|
84
|
-
- 根依赖里是否安装了 `repoctl`
|
|
85
|
-
- 推荐的根脚本 `
|
|
86
|
-
-
|
|
84
|
+
- 根依赖里是否安装了 `repoctl`
|
|
85
|
+
- 推荐的根脚本 `repo:init / repo:new / repo:check / repo:doctor` 是否齐全
|
|
86
|
+
- 是否仍残留已废弃的 `monorepo.config.ts`
|
|
87
87
|
- `.husky/pre-commit` 与 `lint-staged.config.js` 是否同时存在
|
|
88
88
|
|
|
89
89
|
如果有阻塞项,命令会以非零状态结束。
|
|
@@ -104,7 +104,7 @@ CLI 启动时只注册命令树,具体命令实现会在 action 执行时懒
|
|
|
104
104
|
|
|
105
105
|
## 默认 CLI 配置
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
工作区根目录使用 `repoctl.config.ts` 覆盖默认行为。`monorepo.config.ts` 已不再作为运行时配置入口。
|
|
108
108
|
|
|
109
109
|
```ts
|
|
110
110
|
import { defineMonorepoConfig } from 'repoctl'
|
|
@@ -164,31 +164,36 @@ repo new dashboard --template vue-hono --json --out plans/dashboard.json
|
|
|
164
164
|
|
|
165
165
|
当 `repoctl.config.ts` 中设置了 `commands.create.defaultTemplate` 时,命令会直接创建,不再额外询问模板,并自动按模板落到 `packages/` 或 `apps/`。
|
|
166
166
|
|
|
167
|
-
`
|
|
167
|
+
`repo ai prompt create` 支持批量生成:
|
|
168
168
|
|
|
169
169
|
```bash
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
pnpm exec repo ai prompt create --name checkout
|
|
171
|
+
pnpm exec repo ai prompt create --tasks agentic/tasks.json --format md -f
|
|
172
172
|
```
|
|
173
173
|
|
|
174
174
|
## Tooling Wrapper API
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
如果你希望在生成后的配置文件基础上继续手写覆盖,推荐使用 `repoctl/tooling` 暴露的 wrapper。
|
|
177
177
|
|
|
178
|
-
- `defineCommitlintConfig` / `
|
|
178
|
+
- `defineCommitlintConfig` / `defineStylelintConfig` / `defineLintStagedConfig` / `defineTsconfigConfig` 统一使用 `options`
|
|
179
|
+
- `defineEslintConfig` 支持 `defineEslintConfig(baseOptions, ...configs)`、`{ options, configs }` 和 `options.configs`
|
|
179
180
|
- `defineVitestConfig` 使用 `options` 加 `overrides`
|
|
180
181
|
- `defineVitestProjectConfig` 也已统一使用 `options`
|
|
181
|
-
- 旧的 `config` 入参仍兼容,但只建议用于存量代码迁移
|
|
182
182
|
|
|
183
183
|
```ts
|
|
184
|
-
import { defineEslintConfig, defineVitestConfig, defineVitestProjectConfig } from '
|
|
184
|
+
import { defineEslintConfig, defineVitestConfig, defineVitestProjectConfig } from 'repoctl/tooling'
|
|
185
185
|
import { defineConfig, defineProject } from 'vitest/config'
|
|
186
186
|
|
|
187
|
-
export const eslintConfig = await defineEslintConfig(
|
|
188
|
-
|
|
187
|
+
export const eslintConfig = await defineEslintConfig(
|
|
188
|
+
{
|
|
189
189
|
ignores: ['fixtures/**'],
|
|
190
190
|
},
|
|
191
|
-
|
|
191
|
+
{
|
|
192
|
+
rules: {
|
|
193
|
+
'no-console': 'off',
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
)
|
|
192
197
|
|
|
193
198
|
export const vitestConfig = defineConfig(async () => await defineVitestConfig({
|
|
194
199
|
options: {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as logger, g as fs, r as cliName, t as initToolingTargets, u as version } from "./types-
|
|
1
|
+
import { d as logger, g as fs, r as cliName, t as initToolingTargets, u as version } from "./types-BwhDyALS.mjs";
|
|
2
2
|
import path from "pathe";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import os from "node:os";
|
|
@@ -8,8 +8,8 @@ import { Command } from "commander";
|
|
|
8
8
|
async function handleAiPromptCreate(cwd, opts) {
|
|
9
9
|
const [{ input }, { createTimestampFolderName, defaultAgenticBaseDir, generateAgenticTemplate, generateAgenticTemplates, loadAgenticTasks }, { resolveCommandConfig }] = await Promise.all([
|
|
10
10
|
import("@icebreakers/monorepo-templates"),
|
|
11
|
-
import("./commands-
|
|
12
|
-
import("./config-
|
|
11
|
+
import("./commands-LC_g9yaY.mjs").then((n) => n.t),
|
|
12
|
+
import("./config-BrLDFwAH.mjs").then((n) => n.n)
|
|
13
13
|
]);
|
|
14
14
|
const aiConfig = await resolveCommandConfig("ai", cwd);
|
|
15
15
|
const format = opts.format ?? aiConfig?.format ?? "md";
|
|
@@ -123,7 +123,7 @@ async function emitConfigInspection(inspection, opts, cwd) {
|
|
|
123
123
|
}
|
|
124
124
|
function registerConfigCommands(program, cwd) {
|
|
125
125
|
program.command("config").alias("cfg").description("配置命令").command("inspect").description("输出当前 repoctl 配置文件和已解析配置").alias("i").option("--json", "输出 JSON,方便脚本消费").option("--markdown", "输出 Markdown,方便粘贴到 issue 或 PR").option("--out <file>", "把当前输出写入文件").option("--redact", "脱敏 cwd/configDir/home 绝对路径后再输出").action(async (opts) => {
|
|
126
|
-
const { inspectMonorepoConfig } = await import("./commands-
|
|
126
|
+
const { inspectMonorepoConfig } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
127
127
|
await emitConfigInspection(await inspectMonorepoConfig(cwd), opts, cwd);
|
|
128
128
|
});
|
|
129
129
|
}
|
|
@@ -175,8 +175,6 @@ function formatEnvPaths(paths) {
|
|
|
175
175
|
formatEnvPathEntry("workspaceManifest", paths.paths.workspaceManifest),
|
|
176
176
|
formatEnvPathEntry("repoctlConfig", paths.paths.repoctlConfig),
|
|
177
177
|
...paths.paths.repoctlConfigs.map((entry) => formatEnvPathEntry("repoctlConfigCandidate", entry)),
|
|
178
|
-
formatEnvPathEntry("legacyConfig", paths.paths.legacyConfig),
|
|
179
|
-
...paths.paths.legacyConfigs.map((entry) => formatEnvPathEntry("legacyConfigCandidate", entry)),
|
|
180
178
|
formatEnvPathEntry("toolingDir", paths.paths.toolingDir),
|
|
181
179
|
formatEnvPathEntry("reportsDir", paths.paths.reportsDir),
|
|
182
180
|
formatEnvPathEntry("doctorReport", paths.paths.doctorReport),
|
|
@@ -445,23 +443,23 @@ async function emitEnvSupportBundle(bundle, opts, cwd) {
|
|
|
445
443
|
function registerEnvCommands(program, cwd) {
|
|
446
444
|
const envCommand = program.command("env").alias("e").description("环境命令");
|
|
447
445
|
envCommand.command("info").description("输出当前仓库环境信息").alias("i").option("--json", "输出 JSON,方便脚本消费").option("--markdown", "输出 Markdown,方便粘贴到 issue 或 PR").option("--out <file>", "把当前输出写入文件").option("--redact", "脱敏 workspace/cwd/home 绝对路径后再输出").action(async (opts) => {
|
|
448
|
-
const { collectEnvInfo } = await import("./commands-
|
|
446
|
+
const { collectEnvInfo } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
449
447
|
await emitEnvInfo(await collectEnvInfo(cwd), opts, cwd);
|
|
450
448
|
});
|
|
451
449
|
envCommand.command("snapshot").description("输出排障快照,包含环境、doctor 和 check 计划").alias("s").option("--json", "输出 JSON,方便脚本消费").option("--markdown", "输出 Markdown,方便粘贴到 issue 或 PR").option("--out <file>", "把当前输出写入文件").option("--redact", "脱敏 workspace/cwd/home 绝对路径后再输出").option("--strict", "输出快照后,如果 doctor 有 fail 或 warn 则返回失败码").action(async (opts) => {
|
|
452
|
-
const { collectEnvSnapshot } = await import("./commands-
|
|
450
|
+
const { collectEnvSnapshot } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
453
451
|
await emitEnvSnapshot(await collectEnvSnapshot(cwd), opts, cwd);
|
|
454
452
|
});
|
|
455
453
|
envCommand.command("paths").description("输出当前仓库关键路径和报告建议位置").alias("p").option("--json", "输出 JSON,方便脚本消费").option("--markdown", "输出 Markdown,方便粘贴到 issue 或 PR").option("--out <file>", "把当前输出写入文件").option("--redact", "脱敏 workspace/cwd/home 绝对路径后再输出").action(async (opts) => {
|
|
456
|
-
const { collectEnvPaths } = await import("./commands-
|
|
454
|
+
const { collectEnvPaths } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
457
455
|
await emitEnvPaths(await collectEnvPaths(cwd), opts, cwd);
|
|
458
456
|
});
|
|
459
457
|
envCommand.command("support").description("输出完整排障包,包含环境、路径、配置、doctor 和 check 计划").alias("b").option("--json", "输出 JSON,方便脚本消费").option("--markdown", "输出 Markdown,方便粘贴到 issue 或 PR").option("--out <file>", "把当前输出写入文件").option("--redact", "脱敏 workspace/cwd/home 绝对路径后再输出").option("--strict", "输出排障包后,如果 doctor 有 fail 或 warn 则返回失败码").action(async (opts) => {
|
|
460
|
-
const { collectEnvSupportBundle } = await import("./commands-
|
|
458
|
+
const { collectEnvSupportBundle } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
461
459
|
await emitEnvSupportBundle(await collectEnvSupportBundle(cwd), opts, cwd);
|
|
462
460
|
});
|
|
463
461
|
envCommand.command("mirror").description("设置 VS Code binary mirror").alias("m").action(async () => {
|
|
464
|
-
const { setVscodeBinaryMirror } = await import("./commands-
|
|
462
|
+
const { setVscodeBinaryMirror } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
465
463
|
await setVscodeBinaryMirror(cwd);
|
|
466
464
|
logger.success("env mirror finished!");
|
|
467
465
|
});
|
|
@@ -470,7 +468,7 @@ function registerEnvCommands(program, cwd) {
|
|
|
470
468
|
//#region src/cli/commands/package.ts
|
|
471
469
|
function registerPackageCommands(program, cwd) {
|
|
472
470
|
program.command("package").alias("pkg").description("子包命令").command("create").description("创建一个新的子包").alias("new").argument("[name]").option("-t, --template <template>", "直接使用指定模板,跳过模板选择").option("--dry-run", "预览将要创建的目录与 package 信息,不写入文件").option("--json", "以 JSON 输出创建预览,隐含 --dry-run").option("--out <file>", "把创建预览写入文件,隐含 --dry-run").action(async (inputName, opts) => {
|
|
473
|
-
const { runCreateFlow } = await import("./create-flow-
|
|
471
|
+
const { runCreateFlow } = await import("./create-flow-BSS7K95k.mjs");
|
|
474
472
|
const result = await runCreateFlow(cwd, inputName, {
|
|
475
473
|
...opts.template !== void 0 ? { template: opts.template } : {},
|
|
476
474
|
...opts.dryRun || opts.json || opts.out ? { dryRun: true } : {},
|
|
@@ -495,7 +493,7 @@ function registerReleaseCommands(program, cwd) {
|
|
|
495
493
|
const releaseCommand = program.command("release").description("发布与 Changesets prerelease 工具集");
|
|
496
494
|
releaseCommand.command("stable").description("在 main 分支执行正式发布").action(async () => {
|
|
497
495
|
await runReleaseAction(async () => {
|
|
498
|
-
const { releaseStable } = await import("./commands-
|
|
496
|
+
const { releaseStable } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
499
497
|
await releaseStable({ cwd });
|
|
500
498
|
logger.success("stable release finished!");
|
|
501
499
|
});
|
|
@@ -503,21 +501,21 @@ function registerReleaseCommands(program, cwd) {
|
|
|
503
501
|
const preCommand = releaseCommand.command("pre").description("执行或管理 prerelease 发布");
|
|
504
502
|
preCommand.command("publish").alias("run").description("在 alpha/beta/rc/next 分支发布 prerelease").action(async () => {
|
|
505
503
|
await runReleaseAction(async () => {
|
|
506
|
-
const { releasePrerelease } = await import("./commands-
|
|
504
|
+
const { releasePrerelease } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
507
505
|
await releasePrerelease({ cwd });
|
|
508
506
|
logger.success("prerelease finished!");
|
|
509
507
|
});
|
|
510
508
|
});
|
|
511
509
|
preCommand.command("enter").description("进入 Changesets prerelease 模式").argument("<tag>", "alpha / beta / rc / next").action(async (tag) => {
|
|
512
510
|
await runReleaseAction(async () => {
|
|
513
|
-
const { enterPrerelease } = await import("./commands-
|
|
511
|
+
const { enterPrerelease } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
514
512
|
enterPrerelease(tag, { cwd });
|
|
515
513
|
logger.success(`entered ${tag} prerelease mode!`);
|
|
516
514
|
});
|
|
517
515
|
});
|
|
518
516
|
preCommand.command("exit").description("退出 Changesets prerelease 模式").action(async () => {
|
|
519
517
|
await runReleaseAction(async () => {
|
|
520
|
-
const { exitPrerelease } = await import("./commands-
|
|
518
|
+
const { exitPrerelease } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
521
519
|
exitPrerelease({ cwd });
|
|
522
520
|
logger.success("exited prerelease mode!");
|
|
523
521
|
});
|
|
@@ -528,7 +526,7 @@ function registerReleaseCommands(program, cwd) {
|
|
|
528
526
|
const skillTargets = ["codex", "claude"];
|
|
529
527
|
function registerSkillsCommands(program, cwd) {
|
|
530
528
|
program.command("skills").alias("sk").description("技能工具集").command("sync").description("同步 resources/skills/icebreakers-monorepo-cli 到全局目录").alias("s").option("--codex", "同步到 ~/.codex/skills").option("--claude", "同步到 ~/.claude/skills").option("--all", "同步全部目标").action(async (opts) => {
|
|
531
|
-
const { syncSkills } = await import("./commands-
|
|
529
|
+
const { syncSkills } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
532
530
|
const selected = /* @__PURE__ */ new Set();
|
|
533
531
|
if (opts.all) for (const target of skillTargets) selected.add(target);
|
|
534
532
|
else {
|
|
@@ -648,7 +646,7 @@ function registerTemplatesCommands(program) {
|
|
|
648
646
|
program.command("templates").alias("tpl").description("列出可用的内置模板").argument("[key]", "查看指定模板详情").option("-c, --category <category>", "按模板分类过滤:library / app / service / docs / tool").option("--check", "检查内置模板元数据、目录和临时文件").option("--json", "输出 JSON,方便脚本消费").option("--markdown", "输出 Markdown,方便同步文档").option("--out <file>", "把当前输出写入文件").action(async (key, opts) => {
|
|
649
647
|
const { getTemplateChoice, getTemplateChoices, isTemplateCategory, suggestTemplateKey, templateCategories } = await import("@icebreakers/monorepo-templates");
|
|
650
648
|
if (opts.check) {
|
|
651
|
-
const { checkTemplates } = await import("./commands-
|
|
649
|
+
const { checkTemplates } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
652
650
|
const report = await checkTemplates();
|
|
653
651
|
if (opts.json) await emitTemplateOutput(JSON.stringify(report, null, 2), opts);
|
|
654
652
|
else await emitTemplateOutput(formatTemplateHealthReport(report, !opts.out), opts);
|
|
@@ -727,7 +725,7 @@ function normalizeToolingTargets(tooling) {
|
|
|
727
725
|
function registerToolingCommands(program, cwd) {
|
|
728
726
|
program.command("tooling").alias("tg").description("工程化配置命令").command("init").description(`生成 tooling 配置(可选值:${initToolingTargets.join(", ")})`).alias("i").argument("[tooling...]").option("-a, --all", "生成全部 tooling 配置").option("-f, --force", "覆盖已存在的 tooling 配置文件").action(async (tooling = [], opts) => {
|
|
729
727
|
const normalizedTooling = normalizeToolingTargets(tooling);
|
|
730
|
-
const { initTooling } = await import("./commands-
|
|
728
|
+
const { initTooling } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
731
729
|
await initTooling(cwd, {
|
|
732
730
|
...normalizedTooling ? { targets: normalizedTooling } : {},
|
|
733
731
|
...opts.all !== void 0 ? { all: opts.all } : {},
|
|
@@ -897,8 +895,8 @@ async function emitCheckPlan(plan, opts, cwd) {
|
|
|
897
895
|
logger.success(`wrote ${path.relative(cwd, outFile)}`);
|
|
898
896
|
}
|
|
899
897
|
function registerTopLevelCommands(program, cwd) {
|
|
900
|
-
program.command("init").description("初始化当前 workspace,并生成推荐配置").
|
|
901
|
-
const { init } = await import("./commands-
|
|
898
|
+
program.command("init").description("初始化当前 workspace,并生成推荐配置").option("--preset <preset>", "初始化预设:minimal / standard", "standard").option("-f, --force", "覆盖已存在的 tooling 配置文件").option("--overwrite", "覆盖 setup 管理的已存在文件").option("-y, --yes", "使用默认值跳过所有交互,适合 CI").action(async (opts) => {
|
|
899
|
+
const { init } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
902
900
|
await init(cwd, {
|
|
903
901
|
...opts.preset !== void 0 ? { preset: opts.preset } : {},
|
|
904
902
|
...opts.force !== void 0 ? { force: opts.force } : {},
|
|
@@ -909,7 +907,7 @@ function registerTopLevelCommands(program, cwd) {
|
|
|
909
907
|
logger.info("next: run `pnpm install` and `pnpm build`");
|
|
910
908
|
});
|
|
911
909
|
program.command("new").description("创建新的 package / app").argument("[name]").option("-t, --template <template>", "直接使用指定模板,跳过模板选择").option("--dry-run", "预览将要创建的目录与 package 信息,不写入文件").option("--json", "以 JSON 输出创建预览,隐含 --dry-run").option("--out <file>", "把创建预览写入文件,隐含 --dry-run").action(async (inputName, opts) => {
|
|
912
|
-
const { runCreateFlow } = await import("./create-flow-
|
|
910
|
+
const { runCreateFlow } = await import("./create-flow-BSS7K95k.mjs");
|
|
913
911
|
const result = await runCreateFlow(cwd, inputName, {
|
|
914
912
|
...opts.template !== void 0 ? { template: opts.template } : {},
|
|
915
913
|
...opts.dryRun || opts.json || opts.out ? { dryRun: true } : {},
|
|
@@ -927,10 +925,10 @@ function registerTopLevelCommands(program, cwd) {
|
|
|
927
925
|
...opts.staged !== void 0 ? { staged: opts.staged } : {},
|
|
928
926
|
...opts.editFile !== void 0 ? { editFile: opts.editFile } : {}
|
|
929
927
|
};
|
|
930
|
-
const { resolveRecommendedCheckPlan, runRecommendedCheck } = await import("./commands-
|
|
928
|
+
const { resolveRecommendedCheckPlan, runRecommendedCheck } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
931
929
|
if (opts.dryRun || opts.json || opts.markdown || opts.out) {
|
|
932
930
|
if (opts.full) {
|
|
933
|
-
const { resolveFullWorkspaceCheckPlan } = await import("./commands-
|
|
931
|
+
const { resolveFullWorkspaceCheckPlan } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
934
932
|
await emitCheckPlan(await resolveFullWorkspaceCheckPlan(cwd), opts, cwd);
|
|
935
933
|
return;
|
|
936
934
|
}
|
|
@@ -941,7 +939,7 @@ function registerTopLevelCommands(program, cwd) {
|
|
|
941
939
|
logger.success("check finished!");
|
|
942
940
|
});
|
|
943
941
|
program.command("doctor").description("诊断当前仓库是否适合直接开始使用").option("--json", "输出 JSON 报告,方便 CI 或脚本消费").option("--markdown", "输出 Markdown 报告,方便粘贴到 issue 或 PR").option("--out <file>", "把诊断报告写入文件").option("--redact", "脱敏 workspace/cwd/home 绝对路径后再输出").option("--strict", "把 warning 也视为失败,适合 CI 门禁").action(async (opts) => {
|
|
944
|
-
const { runDoctor } = await import("./commands-
|
|
942
|
+
const { runDoctor } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
945
943
|
const report = await runDoctor(cwd);
|
|
946
944
|
await emitDoctorReport(report, opts, cwd);
|
|
947
945
|
if (opts.out || opts.json || opts.markdown) {
|
|
@@ -964,47 +962,32 @@ function registerTopLevelCommands(program, cwd) {
|
|
|
964
962
|
logger.success("doctor finished!");
|
|
965
963
|
});
|
|
966
964
|
program.command("upgrade").description("同步仓库标准资产与脚本").option("-i,--interactive").option("-c,--core", "仅同步核心配置,跳过 GitHub 相关资产").option("--outDir <dir>", "Output directory").option("-s,--skip-overwrite", "skip overwrite").option("-y, --yes", "跳过交互并覆盖 drifted 标准资产").option("--overwrite", "覆盖 drifted 标准资产").option("--no-overwrite", "不覆盖 drifted 标准资产").action(async (opts) => {
|
|
967
|
-
const { upgradeMonorepo } = await import("./commands-
|
|
965
|
+
const { upgradeMonorepo } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
968
966
|
await upgradeMonorepo(normalizeCliOpts(cwd, opts));
|
|
969
967
|
logger.success("upgrade finished!");
|
|
970
968
|
});
|
|
971
|
-
program.command("sync").description("兼容入口:同步仓库标准资产与脚本").option("-i,--interactive").option("-c,--core", "仅同步核心配置,跳过 GitHub 相关资产").option("--outDir <dir>", "Output directory").option("-s,--skip-overwrite", "skip overwrite").option("-y, --yes", "跳过交互并覆盖 drifted 标准资产").option("--overwrite", "覆盖 drifted 标准资产").option("--no-overwrite", "不覆盖 drifted 标准资产").action(async (opts) => {
|
|
972
|
-
const { upgradeMonorepo } = await import("./commands-BDc4kaVr.mjs").then((n) => n.t);
|
|
973
|
-
await upgradeMonorepo(normalizeCliOpts(cwd, opts));
|
|
974
|
-
logger.success("sync finished!");
|
|
975
|
-
});
|
|
976
|
-
program.command("clean").description("兼容入口:清理选中的 workspace 包").option("-y, --yes", "跳过交互直接清理(等价 autoConfirm)").option("--include-private", "包含 private 包").option("--pinned-version <version>", "覆盖写入的 @icebreakers/monorepo 版本").action(async (opts) => {
|
|
977
|
-
const { cleanProjects } = await import("./commands-BDc4kaVr.mjs").then((n) => n.t);
|
|
978
|
-
await cleanProjects(cwd, normalizeCleanOptions(opts));
|
|
979
|
-
logger.success("clean finished!");
|
|
980
|
-
});
|
|
981
|
-
program.command("mirror").description("兼容入口:设置 VS Code binary mirror").action(async () => {
|
|
982
|
-
const { setVscodeBinaryMirror } = await import("./commands-BDc4kaVr.mjs").then((n) => n.t);
|
|
983
|
-
await setVscodeBinaryMirror(cwd);
|
|
984
|
-
logger.success("mirror finished!");
|
|
985
|
-
});
|
|
986
969
|
}
|
|
987
970
|
//#endregion
|
|
988
971
|
//#region src/cli/commands/verify.ts
|
|
989
972
|
function registerVerifyCommands(program, cwd) {
|
|
990
973
|
const verifyCommand = program.command("verify").alias("v").description("本地校验工具集");
|
|
991
974
|
verifyCommand.command("pre-push").description("按推送变更范围执行 build/test/tsd 校验").alias("push").action(async () => {
|
|
992
|
-
const { verifyPrePush } = await import("./commands-
|
|
975
|
+
const { verifyPrePush } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
993
976
|
await verifyPrePush({ cwd });
|
|
994
977
|
});
|
|
995
978
|
verifyCommand.command("pre-commit").description("执行 lint-staged 校验").alias("commit").action(async () => {
|
|
996
|
-
const { verifyPreCommit } = await import("./commands-
|
|
979
|
+
const { verifyPreCommit } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
997
980
|
await verifyPreCommit({ cwd });
|
|
998
981
|
});
|
|
999
982
|
verifyCommand.command("commit-msg").description("执行 commitlint 校验").alias("msg").argument("<edit-file>").action(async (editFile) => {
|
|
1000
|
-
const { verifyCommitMsg } = await import("./commands-
|
|
983
|
+
const { verifyCommitMsg } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
1001
984
|
await verifyCommitMsg({
|
|
1002
985
|
cwd,
|
|
1003
986
|
editFile
|
|
1004
987
|
});
|
|
1005
988
|
});
|
|
1006
989
|
verifyCommand.command("staged-typecheck").description("按暂存文件所在 workspace 执行 typecheck").alias("tc").argument("[files...]").action(async (files = []) => {
|
|
1007
|
-
const { verifyStagedTypecheck } = await import("./commands-
|
|
990
|
+
const { verifyStagedTypecheck } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
1008
991
|
verifyStagedTypecheck(files, { cwd });
|
|
1009
992
|
});
|
|
1010
993
|
}
|
|
@@ -1083,12 +1066,12 @@ async function emitWorkspaceList(result, opts) {
|
|
|
1083
1066
|
function registerWorkspaceCommands(program, cwd) {
|
|
1084
1067
|
const workspaceCommand = program.command("workspace").alias("ws").description("工作区命令");
|
|
1085
1068
|
workspaceCommand.command("upgrade").description("升级/同步 monorepo 相关包").alias("up").option("-i,--interactive").option("-c,--core", "仅同步核心配置,跳过 GitHub 相关资产").option("--outDir <dir>", "Output directory").option("-s,--skip-overwrite", "skip overwrite").option("-y, --yes", "跳过交互并覆盖 drifted 标准资产").option("--overwrite", "覆盖 drifted 标准资产").option("--no-overwrite", "不覆盖 drifted 标准资产").action(async (opts) => {
|
|
1086
|
-
const { upgradeMonorepo } = await import("./commands-
|
|
1069
|
+
const { upgradeMonorepo } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
1087
1070
|
await upgradeMonorepo(normalizeCliOpts(cwd, opts));
|
|
1088
1071
|
logger.success("workspace upgrade finished!");
|
|
1089
1072
|
});
|
|
1090
1073
|
workspaceCommand.command("init").description("初始化工作区元信息(README、package.json、changeset、issue template)").alias("i").action(async () => {
|
|
1091
|
-
const { initMetadata } = await import("./commands-
|
|
1074
|
+
const { initMetadata } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
1092
1075
|
await initMetadata(cwd);
|
|
1093
1076
|
logger.success("workspace init finished!");
|
|
1094
1077
|
});
|
|
@@ -1100,8 +1083,8 @@ function registerWorkspaceCommands(program, cwd) {
|
|
|
1100
1083
|
...opts.pattern?.length ? { patterns: opts.pattern } : {}
|
|
1101
1084
|
}), opts);
|
|
1102
1085
|
});
|
|
1103
|
-
workspaceCommand.command("clean").description("清除选中的包").alias("rm").option("-y, --yes", "跳过交互直接清理(等价 autoConfirm)").option("--include-private", "包含 private 包").option("--pinned-version <version>", "覆盖写入的
|
|
1104
|
-
const { cleanProjects } = await import("./commands-
|
|
1086
|
+
workspaceCommand.command("clean").description("清除选中的包").alias("rm").option("-y, --yes", "跳过交互直接清理(等价 autoConfirm)").option("--include-private", "包含 private 包").option("--pinned-version <version>", "覆盖写入的 repoctl 版本").action(async (opts) => {
|
|
1087
|
+
const { cleanProjects } = await import("./commands-LC_g9yaY.mjs").then((n) => n.t);
|
|
1105
1088
|
await cleanProjects(cwd, normalizeCleanOptions(opts));
|
|
1106
1089
|
logger.success("workspace clean finished!");
|
|
1107
1090
|
});
|
|
@@ -1110,7 +1093,7 @@ function registerWorkspaceCommands(program, cwd) {
|
|
|
1110
1093
|
//#region src/cli/program.ts
|
|
1111
1094
|
const cwd = process.cwd();
|
|
1112
1095
|
const program = new Command();
|
|
1113
|
-
program.name(cliName).version(version).description("One-command repo
|
|
1096
|
+
program.name(cliName).version(version).description("One-command repo initialization and maintenance for pnpm/turbo workspaces.");
|
|
1114
1097
|
registerTopLevelCommands(program, cwd);
|
|
1115
1098
|
registerTemplatesCommands(program);
|
|
1116
1099
|
registerWorkspaceCommands(program, cwd);
|
|
@@ -1125,29 +1108,20 @@ registerPackageCommands(program, cwd);
|
|
|
1125
1108
|
program.addHelpText("after", `
|
|
1126
1109
|
Quick start:
|
|
1127
1110
|
Existing repo:
|
|
1128
|
-
$ ${cliName}
|
|
1111
|
+
$ ${cliName} init
|
|
1129
1112
|
$ ${cliName} doctor
|
|
1130
1113
|
$ ${cliName} templates
|
|
1131
1114
|
$ ${cliName} new my-package
|
|
1132
1115
|
$ ${cliName} check
|
|
1133
1116
|
|
|
1134
1117
|
Faster in generated repos:
|
|
1135
|
-
$ pnpm
|
|
1136
|
-
$ pnpm doctor
|
|
1137
|
-
$ pnpm new my-package
|
|
1138
|
-
$ pnpm check
|
|
1118
|
+
$ pnpm run repo:init
|
|
1119
|
+
$ pnpm run repo:doctor
|
|
1120
|
+
$ pnpm run repo:new -- my-package
|
|
1121
|
+
$ pnpm run repo:check
|
|
1139
1122
|
|
|
1140
1123
|
Keep the repo current:
|
|
1141
1124
|
$ ${cliName} upgrade
|
|
1142
|
-
|
|
1143
|
-
Zero-install cleanup:
|
|
1144
|
-
$ pnpm dlx repo@latest clean --yes
|
|
1145
|
-
|
|
1146
|
-
Compatibility shortcuts:
|
|
1147
|
-
$ repoctl setup
|
|
1148
|
-
$ repoctl doctor
|
|
1149
|
-
$ repoctl new
|
|
1150
|
-
$ repoctl check
|
|
1151
1125
|
`);
|
|
1152
1126
|
//#endregion
|
|
1153
1127
|
//#region src/cli.ts
|