@icebreakers/monorepo 5.5.10 → 5.6.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/dist/cli.mjs +33 -33
- package/dist/{commands-CIzCAxyY.mjs → commands-D4xZQ5t-.mjs} +83 -70
- package/dist/{create-flow-C811m80z.mjs → create-flow-CXRhfGbb.mjs} +16 -19
- package/dist/{index-DDQKKYet.d.mts → index-Bl_PB2Ch.d.mts} +54 -40
- package/dist/index.d.mts +15 -11
- package/dist/index.mjs +4 -3
- package/dist/tooling-entry.d.mts +1 -1
- package/dist/tooling-entry.mjs +2 -1
- package/dist/tsconfig-BrjI_5yI.mjs +75 -0
- package/dist/{types-m8JLwKzl.mjs → types-MAUIQpfp.mjs} +2 -2
- package/dist/{tooling-BfXlmCi-.mjs → vitest-Blzbh8xZ.mjs} +108 -167
- package/package.json +5 -5
- package/resources/skills/repoctl/SKILL.md +2 -2
- package/resources/skills/repoctl/references/templates.md +3 -2
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as message, l as version, m as logger, p as supportedLocales, r as cliName, t as initToolingTargets, u as localize, y as fs } from "./types-
|
|
1
|
+
import { d as message, l as version, m as logger, p as supportedLocales, r as cliName, t as initToolingTargets, u as localize, y as fs } from "./types-MAUIQpfp.mjs";
|
|
2
2
|
import { s as resolveCommandConfig } from "./config-p842Knhq.mjs";
|
|
3
3
|
import path from "pathe";
|
|
4
4
|
import process from "node:process";
|
|
@@ -10,7 +10,7 @@ import { Command, Option } from "commander";
|
|
|
10
10
|
async function handleAiPromptCreate(cwd, opts) {
|
|
11
11
|
const [{ input }, { createTimestampFolderName, defaultAgenticBaseDir, generateAgenticTemplate, generateAgenticTemplates, loadAgenticTasks }, { resolveCommandConfig }] = await Promise.all([
|
|
12
12
|
import("@icebreakers/monorepo-templates"),
|
|
13
|
-
import("./commands-
|
|
13
|
+
import("./commands-D4xZQ5t-.mjs").then((n) => n.t),
|
|
14
14
|
import("./config-p842Knhq.mjs").then((n) => n.n)
|
|
15
15
|
]);
|
|
16
16
|
const aiConfig = await resolveCommandConfig("ai", cwd);
|
|
@@ -125,7 +125,7 @@ async function emitConfigInspection(inspection, opts, cwd) {
|
|
|
125
125
|
}
|
|
126
126
|
function registerConfigCommands(program, cwd) {
|
|
127
127
|
program.command("config").alias("cfg").description(localize("Configuration commands", "配置命令")).command("inspect").description(localize("Show the active repoctl config file and resolved configuration", "输出当前 repoctl 配置文件和已解析配置")).alias("i").option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown", "输出 Markdown,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).option("--redact", localize("Redact cwd, configDir, and home paths", "脱敏 cwd/configDir/home 绝对路径后再输出")).action(async (opts) => {
|
|
128
|
-
const { inspectMonorepoConfig } = await import("./commands-
|
|
128
|
+
const { inspectMonorepoConfig } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
129
129
|
await emitConfigInspection(await inspectMonorepoConfig(cwd), opts, cwd);
|
|
130
130
|
});
|
|
131
131
|
}
|
|
@@ -445,23 +445,23 @@ async function emitEnvSupportBundle(bundle, opts, cwd) {
|
|
|
445
445
|
function registerEnvCommands(program, cwd) {
|
|
446
446
|
const envCommand = program.command("env").alias("e").description(localize("Environment and support commands", "环境命令"));
|
|
447
447
|
envCommand.command("info").description(localize("Show environment information for the current repository", "输出当前仓库环境信息")).alias("i").option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown", "输出 Markdown,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).action(async (opts) => {
|
|
448
|
-
const { collectEnvInfo } = await import("./commands-
|
|
448
|
+
const { collectEnvInfo } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
449
449
|
await emitEnvInfo(await collectEnvInfo(cwd), opts, cwd);
|
|
450
450
|
});
|
|
451
451
|
envCommand.command("snapshot").description(localize("Create a support snapshot with environment, doctor, and check data", "输出排障快照,包含环境、doctor 和 check 计划")).alias("s").option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown", "输出 Markdown,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).option("--strict", localize("Fail when doctor reports a failure or warning", "输出快照后,如果 doctor 有 fail 或 warn 则返回失败码")).action(async (opts) => {
|
|
452
|
-
const { collectEnvSnapshot } = await import("./commands-
|
|
452
|
+
const { collectEnvSnapshot } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
453
453
|
await emitEnvSnapshot(await collectEnvSnapshot(cwd), opts, cwd);
|
|
454
454
|
});
|
|
455
455
|
envCommand.command("paths").description(localize("Show important repository and report paths", "输出当前仓库关键路径和报告建议位置")).alias("p").option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown", "输出 Markdown,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).action(async (opts) => {
|
|
456
|
-
const { collectEnvPaths } = await import("./commands-
|
|
456
|
+
const { collectEnvPaths } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
457
457
|
await emitEnvPaths(await collectEnvPaths(cwd), opts, cwd);
|
|
458
458
|
});
|
|
459
459
|
envCommand.command("support").description(localize("Create a complete support bundle", "输出完整排障包,包含环境、路径、配置、doctor 和 check 计划")).alias("b").option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown", "输出 Markdown,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).option("--strict", localize("Fail when doctor reports a failure or warning", "输出排障包后,如果 doctor 有 fail 或 warn 则返回失败码")).action(async (opts) => {
|
|
460
|
-
const { collectEnvSupportBundle } = await import("./commands-
|
|
460
|
+
const { collectEnvSupportBundle } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
461
461
|
await emitEnvSupportBundle(await collectEnvSupportBundle(cwd), opts, cwd);
|
|
462
462
|
});
|
|
463
463
|
envCommand.command("mirror").description(localize("Configure the VS Code binary mirror", "设置 VS Code binary mirror")).alias("m").action(async () => {
|
|
464
|
-
const { setVscodeBinaryMirror } = await import("./commands-
|
|
464
|
+
const { setVscodeBinaryMirror } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
465
465
|
await setVscodeBinaryMirror(cwd);
|
|
466
466
|
logger.success(localize("Environment mirror finished.", "环境镜像完成。"));
|
|
467
467
|
});
|
|
@@ -470,7 +470,7 @@ function registerEnvCommands(program, cwd) {
|
|
|
470
470
|
//#region src/cli/commands/package.ts
|
|
471
471
|
function registerPackageCommands(program, cwd) {
|
|
472
472
|
program.command("package").alias("pkg").description(localize("Package commands", "子包命令")).command("create").description(localize("Create a new workspace package", "创建一个新的子包")).alias("new").argument("[name]").option("-t, --template <template>", localize("Use a template key without prompting", "直接使用指定模板,跳过模板选择")).option("--dry-run", localize("Preview without writing files", "预览将要创建的目录与 package 信息,不写入文件")).option("--json", localize("Output JSON; implies --dry-run", "以 JSON 输出创建预览,隐含 --dry-run")).option("--out <file>", localize("Write the preview to a file; implies --dry-run", "把创建预览写入文件,隐含 --dry-run")).action(async (inputName, opts) => {
|
|
473
|
-
const { runCreateFlow } = await import("./create-flow-
|
|
473
|
+
const { runCreateFlow } = await import("./create-flow-CXRhfGbb.mjs");
|
|
474
474
|
const result = await runCreateFlow(cwd, inputName, {
|
|
475
475
|
...opts.template !== void 0 ? { template: opts.template } : {},
|
|
476
476
|
...opts.dryRun || opts.json || opts.out ? { dryRun: true } : {},
|
|
@@ -502,7 +502,7 @@ function registerReleaseCommands(program, cwd) {
|
|
|
502
502
|
const releaseCommand = program.command("release").description(localize("Release and pnpm versioning commands", "发布与 pnpm versioning 工具集"));
|
|
503
503
|
releaseCommand.command("ci").description(localize("Prepare, publish, or recover versions in CI", "在 CI 中自动准备、发布和恢复版本")).option("--mode <mode>", localize("auto / prepare / publish / publish-unpublished / reconcile", "auto / prepare / publish / publish-unpublished / reconcile"), "auto").option("--package <name>", localize("Package used by publish-unpublished mode", "publish-unpublished 使用的 package")).option("--version <version>", localize("Version used by publish-unpublished mode", "publish-unpublished 使用的版本")).option("--source-sha <sha>", localize("Recover a prepared release from its original main commit", "从 main 原始提交恢复整批发布")).option("--dry-run", localize("Preview reconcile changes without updating GitHub", "只预览 reconcile 变更,不更新 GitHub")).action(async (opts) => {
|
|
504
504
|
await runReleaseAction(async () => {
|
|
505
|
-
const { releaseCi } = await import("./commands-
|
|
505
|
+
const { releaseCi } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
506
506
|
await releaseCi({
|
|
507
507
|
...await resolveReleaseOptions(cwd),
|
|
508
508
|
...opts.mode ? { mode: opts.mode } : {},
|
|
@@ -516,7 +516,7 @@ function registerReleaseCommands(program, cwd) {
|
|
|
516
516
|
});
|
|
517
517
|
releaseCommand.command("notes").description(localize("Manage GitHub Release notes", "维护 GitHub Release 正文")).command("repair").description(localize("Rebuild GitHub Release notes from the changelog for each release tag", "按每个发布 tag 对应的 changelog 重建 GitHub Release 正文")).option("--all", localize("Repair every recognized GitHub Release", "修复所有可识别的 GitHub Release")).option("--tag <package@version>", localize("Repair only the specified package@version", "只修复指定 package@version")).option("--dry-run", localize("Generate and summarize without updating GitHub Releases", "只生成并统计,不更新 GitHub Release")).option("--create-missing", localize("Create a missing GitHub Release after validating the published package and tag", "核验已发布 package 和 tag 后补建缺失的 GitHub Release")).action(async (opts) => {
|
|
518
518
|
await runReleaseAction(async () => {
|
|
519
|
-
const { repairReleaseNotes } = await import("./commands-
|
|
519
|
+
const { repairReleaseNotes } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
520
520
|
const result = await repairReleaseNotes({
|
|
521
521
|
cwd,
|
|
522
522
|
...opts.all ? { all: true } : {},
|
|
@@ -529,7 +529,7 @@ function registerReleaseCommands(program, cwd) {
|
|
|
529
529
|
});
|
|
530
530
|
const stableCommand = releaseCommand.command("stable").description(localize("Run a stable release from main", "在 main 分支执行正式发布")).action(async () => {
|
|
531
531
|
await runReleaseAction(async () => {
|
|
532
|
-
const { releaseCi } = await import("./commands-
|
|
532
|
+
const { releaseCi } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
533
533
|
await releaseCi({
|
|
534
534
|
...await resolveReleaseOptions(cwd),
|
|
535
535
|
mode: "publish"
|
|
@@ -539,7 +539,7 @@ function registerReleaseCommands(program, cwd) {
|
|
|
539
539
|
});
|
|
540
540
|
stableCommand.command("prepare").description(localize("Consume pnpm change intents and prepare a Release PR", "消费 pnpm change intents 并准备 Release PR")).action(async () => {
|
|
541
541
|
await runReleaseAction(async () => {
|
|
542
|
-
const { releaseCi } = await import("./commands-
|
|
542
|
+
const { releaseCi } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
543
543
|
await releaseCi({
|
|
544
544
|
...await resolveReleaseOptions(cwd),
|
|
545
545
|
mode: "prepare"
|
|
@@ -549,7 +549,7 @@ function registerReleaseCommands(program, cwd) {
|
|
|
549
549
|
});
|
|
550
550
|
stableCommand.command("publish").description(localize("Publish versions on main that are not yet on npm", "发布 main 分支上尚未发布的包")).action(async () => {
|
|
551
551
|
await runReleaseAction(async () => {
|
|
552
|
-
const { releaseCi } = await import("./commands-
|
|
552
|
+
const { releaseCi } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
553
553
|
await releaseCi({
|
|
554
554
|
...await resolveReleaseOptions(cwd),
|
|
555
555
|
mode: "publish"
|
|
@@ -560,21 +560,21 @@ function registerReleaseCommands(program, cwd) {
|
|
|
560
560
|
const preCommand = releaseCommand.command("pre").description(localize("Run or manage prereleases", "执行或管理 prerelease 发布"));
|
|
561
561
|
preCommand.command("publish").alias("run").description(localize("Publish a prerelease from an alpha, beta, rc, or next lane", "在 alpha/beta/rc/next 分支发布 prerelease")).action(async () => {
|
|
562
562
|
await runReleaseAction(async () => {
|
|
563
|
-
const { releaseCi } = await import("./commands-
|
|
563
|
+
const { releaseCi } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
564
564
|
await releaseCi(await resolveReleaseOptions(cwd));
|
|
565
565
|
logger.success(localize("Prerelease finished.", "预发布完成。"));
|
|
566
566
|
});
|
|
567
567
|
});
|
|
568
568
|
preCommand.command("enter").description(localize("Enter a pnpm prerelease lane", "进入 pnpm prerelease lane")).argument("<tag>", localize("alpha / beta / rc / next", "alpha / beta / rc / next")).action(async (tag) => {
|
|
569
569
|
await runReleaseAction(async () => {
|
|
570
|
-
const { enterPrerelease } = await import("./commands-
|
|
570
|
+
const { enterPrerelease } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
571
571
|
await enterPrerelease(tag, { cwd });
|
|
572
572
|
logger.success(localize(`Entered ${tag} prerelease mode.`, `已进入 ${tag} 预发布模式。`));
|
|
573
573
|
});
|
|
574
574
|
});
|
|
575
575
|
preCommand.command("exit").description(localize("Exit the pnpm prerelease lane", "退出 pnpm prerelease lane")).action(async () => {
|
|
576
576
|
await runReleaseAction(async () => {
|
|
577
|
-
const { exitPrerelease } = await import("./commands-
|
|
577
|
+
const { exitPrerelease } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
578
578
|
await exitPrerelease({ cwd });
|
|
579
579
|
logger.success(localize("Exited prerelease mode.", "已退出预发布模式。"));
|
|
580
580
|
});
|
|
@@ -591,7 +591,7 @@ const skillTargets = [
|
|
|
591
591
|
];
|
|
592
592
|
function registerSkillsCommands(program, cwd) {
|
|
593
593
|
program.command("skills").alias("sk").description(localize("AI skill commands", "技能工具集")).command("sync").description(localize("Synchronize the repoctl skill to global agent directories", "同步 resources/skills/repoctl 到全局目录")).alias("s").option("--codex", localize("Synchronize to ~/.codex/skills", "同步到 ~/.codex/skills")).option("--claude", localize("Synchronize to ~/.claude/skills", "同步到 ~/.claude/skills")).option("--cursor", localize("Synchronize to ~/.cursor/skills", "同步到 ~/.cursor/skills")).option("--agents", localize("Synchronize to ~/.agents/skills", "同步到 ~/.agents/skills")).option("--grok", localize("Synchronize to ~/.grok/skills", "同步到 ~/.grok/skills")).option("--all", localize("Synchronize every target", "同步全部目标")).action(async (opts) => {
|
|
594
|
-
const { syncSkills } = await import("./commands-
|
|
594
|
+
const { syncSkills } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
595
595
|
const selected = /* @__PURE__ */ new Set();
|
|
596
596
|
if (opts.all) for (const target of skillTargets) selected.add(target);
|
|
597
597
|
else {
|
|
@@ -714,7 +714,7 @@ function registerTemplatesCommands(program) {
|
|
|
714
714
|
program.command("templates").alias("tpl").description(localize("List the built-in templates", "列出可用的内置模板")).argument("[key]", localize("Show details for a template key", "查看指定模板详情")).option("-c, --category <category>", localize("Filter by library, app, service, docs, or tool", "按模板分类过滤:library / app / service / docs / tool")).option("--check", localize("Check built-in template metadata and directories", "检查内置模板元数据、目录和临时文件")).option("--json", localize("Output JSON for scripts", "输出 JSON,方便脚本消费")).option("--markdown", localize("Output Markdown for documentation", "输出 Markdown,方便同步文档")).option("--out <file>", localize("Write output to a file", "把当前输出写入文件")).action(async (key, opts) => {
|
|
715
715
|
const { getTemplateChoice, getTemplateChoices, isTemplateCategory, suggestTemplateKey, templateCategories } = await import("@icebreakers/monorepo-templates");
|
|
716
716
|
if (opts.check) {
|
|
717
|
-
const { checkTemplates } = await import("./commands-
|
|
717
|
+
const { checkTemplates } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
718
718
|
const report = await checkTemplates();
|
|
719
719
|
if (opts.json) await emitTemplateOutput(JSON.stringify(report, null, 2), opts);
|
|
720
720
|
else await emitTemplateOutput(formatTemplateHealthReport(report, !opts.out), opts);
|
|
@@ -793,7 +793,7 @@ function normalizeToolingTargets(tooling) {
|
|
|
793
793
|
function registerToolingCommands(program, cwd) {
|
|
794
794
|
program.command("tooling").alias("tg").description(localize("Tooling configuration commands", "工程化配置命令")).command("init").description(localize(`Generate tooling configuration (${initToolingTargets.join(", ")})`, `生成 tooling 配置(可选值:${initToolingTargets.join(", ")})`)).alias("i").argument("[tooling...]").option("-a, --all", localize("Generate every tooling configuration", "生成全部 tooling 配置")).option("-f, --force", localize("Overwrite existing tooling configuration files", "覆盖已存在的 tooling 配置文件")).action(async (tooling = [], opts) => {
|
|
795
795
|
const normalizedTooling = normalizeToolingTargets(tooling);
|
|
796
|
-
const { initTooling } = await import("./commands-
|
|
796
|
+
const { initTooling } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
797
797
|
await initTooling(cwd, {
|
|
798
798
|
...normalizedTooling ? { targets: normalizedTooling } : {},
|
|
799
799
|
...opts.all !== void 0 ? { all: opts.all } : {},
|
|
@@ -964,7 +964,7 @@ async function emitCheckPlan(plan, opts, cwd) {
|
|
|
964
964
|
}
|
|
965
965
|
function registerTopLevelCommands(program, cwd) {
|
|
966
966
|
program.command("init").description(localize("Initialize the current workspace with recommended configuration", "初始化当前 workspace,并生成推荐配置")).option("--preset <preset>", localize("Initialization preset: minimal or standard", "初始化预设:minimal / standard"), "standard").option("-f, --force", localize("Overwrite existing tooling configuration files", "覆盖已存在的 tooling 配置文件")).option("--overwrite", localize("Overwrite existing managed files", "覆盖受管的已存在文件")).option("-y, --yes", localize("Use defaults without prompting; suitable for CI", "使用默认值跳过所有交互,适合 CI")).action(async (opts) => {
|
|
967
|
-
const { init } = await import("./commands-
|
|
967
|
+
const { init } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
968
968
|
await init(cwd, {
|
|
969
969
|
...opts.preset !== void 0 ? { preset: opts.preset } : {},
|
|
970
970
|
...opts.force !== void 0 ? { force: opts.force } : {},
|
|
@@ -975,7 +975,7 @@ function registerTopLevelCommands(program, cwd) {
|
|
|
975
975
|
logger.info(localize("Next: run `pnpm install` and `pnpm build`.", "下一步:运行 `pnpm install` 和 `pnpm build`。"));
|
|
976
976
|
});
|
|
977
977
|
program.command("new").description(localize("Create a new package or application", "创建新的 package / app")).argument("[name]").option("-t, --template <template>", localize("Use a template key without prompting", "直接使用指定模板,跳过模板选择")).option("--dry-run", localize("Preview directories and package metadata without writing", "预览将要创建的目录与 package 信息,不写入文件")).option("--json", localize("Output the creation preview as JSON; implies --dry-run", "以 JSON 输出创建预览,隐含 --dry-run")).option("--out <file>", localize("Write the creation preview to a file; implies --dry-run", "把创建预览写入文件,隐含 --dry-run")).action(async (inputName, opts) => {
|
|
978
|
-
const { runCreateFlow } = await import("./create-flow-
|
|
978
|
+
const { runCreateFlow } = await import("./create-flow-CXRhfGbb.mjs");
|
|
979
979
|
const result = await runCreateFlow(cwd, inputName, {
|
|
980
980
|
...opts.template !== void 0 ? { template: opts.template } : {},
|
|
981
981
|
...opts.dryRun || opts.json || opts.out ? { dryRun: true } : {},
|
|
@@ -993,10 +993,10 @@ function registerTopLevelCommands(program, cwd) {
|
|
|
993
993
|
...opts.staged !== void 0 ? { staged: opts.staged } : {},
|
|
994
994
|
...opts.editFile !== void 0 ? { editFile: opts.editFile } : {}
|
|
995
995
|
};
|
|
996
|
-
const { resolveRecommendedCheckPlan, runRecommendedCheck } = await import("./commands-
|
|
996
|
+
const { resolveRecommendedCheckPlan, runRecommendedCheck } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
997
997
|
if (opts.dryRun || opts.json || opts.markdown || opts.out) {
|
|
998
998
|
if (opts.full) {
|
|
999
|
-
const { resolveFullWorkspaceCheckPlan } = await import("./commands-
|
|
999
|
+
const { resolveFullWorkspaceCheckPlan } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
1000
1000
|
await emitCheckPlan(await resolveFullWorkspaceCheckPlan(cwd), opts, cwd);
|
|
1001
1001
|
return;
|
|
1002
1002
|
}
|
|
@@ -1007,7 +1007,7 @@ function registerTopLevelCommands(program, cwd) {
|
|
|
1007
1007
|
logger.success(localize("Checks finished.", "检查完成。"));
|
|
1008
1008
|
});
|
|
1009
1009
|
program.command("doctor").description(localize("Diagnose whether the current repository is ready to use", "诊断当前仓库是否适合直接开始使用")).option("--json", localize("Output JSON for CI or scripts", "输出 JSON 报告,方便 CI 或脚本消费")).option("--markdown", localize("Output Markdown for an issue or pull request", "输出 Markdown 报告,方便粘贴到 issue 或 PR")).option("--out <file>", localize("Write the diagnostic report to a file", "把诊断报告写入文件")).option("--redact", localize("Redact workspace, cwd, and home paths", "脱敏 workspace/cwd/home 绝对路径后再输出")).option("--strict", localize("Treat warnings as failures", "把 warning 也视为失败,适合 CI 门禁")).action(async (opts) => {
|
|
1010
|
-
const { runDoctor } = await import("./commands-
|
|
1010
|
+
const { runDoctor } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
1011
1011
|
const report = await runDoctor(cwd);
|
|
1012
1012
|
await emitDoctorReport(report, opts, cwd);
|
|
1013
1013
|
if (opts.out || opts.json || opts.markdown) {
|
|
@@ -1030,7 +1030,7 @@ function registerTopLevelCommands(program, cwd) {
|
|
|
1030
1030
|
logger.success(localize("Doctor finished.", "Doctor 诊断完成。"));
|
|
1031
1031
|
});
|
|
1032
1032
|
program.command("upgrade").description(localize("Synchronize standard repository assets and scripts", "同步仓库标准资产与脚本")).option("-i,--interactive", localize("Select managed files interactively", "交互式选择受管文件")).option("-c,--core", localize("Synchronize core configuration without GitHub assets", "仅同步核心配置,跳过 GitHub 相关资产")).option("--outDir <dir>", localize("Output directory", "输出目录")).option("-s,--skip-overwrite", localize("Preserve existing files", "保留已存在文件")).option("-y, --yes", localize("Skip prompts and overwrite drifted managed assets", "跳过交互并覆盖 drifted 标准资产")).option("--overwrite", localize("Overwrite drifted managed assets", "覆盖 drifted 标准资产")).option("--no-overwrite", localize("Preserve drifted managed assets", "不覆盖 drifted 标准资产")).option("--overwrite-release", localize("Overwrite an unmarked custom release workflow", "覆盖未标记的自定义 release workflow")).action(async (opts) => {
|
|
1033
|
-
const { upgradeMonorepo } = await import("./commands-
|
|
1033
|
+
const { upgradeMonorepo } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
1034
1034
|
await upgradeMonorepo(normalizeCliOpts(cwd, opts));
|
|
1035
1035
|
logger.success(localize("Upgrade finished.", "升级完成。"));
|
|
1036
1036
|
});
|
|
@@ -1040,22 +1040,22 @@ function registerTopLevelCommands(program, cwd) {
|
|
|
1040
1040
|
function registerVerifyCommands(program, cwd) {
|
|
1041
1041
|
const verifyCommand = program.command("verify").alias("v").description(localize("Local verification commands", "本地校验工具集"));
|
|
1042
1042
|
verifyCommand.command("pre-push").description(localize("Run build, test, and tsd checks for pushed changes", "按推送变更范围执行 build/test/tsd 校验")).alias("push").action(async () => {
|
|
1043
|
-
const { verifyPrePush } = await import("./commands-
|
|
1043
|
+
const { verifyPrePush } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
1044
1044
|
await verifyPrePush({ cwd });
|
|
1045
1045
|
});
|
|
1046
1046
|
verifyCommand.command("pre-commit").description(localize("Run lint-staged verification", "执行 lint-staged 校验")).alias("commit").action(async () => {
|
|
1047
|
-
const { verifyPreCommit } = await import("./commands-
|
|
1047
|
+
const { verifyPreCommit } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
1048
1048
|
await verifyPreCommit({ cwd });
|
|
1049
1049
|
});
|
|
1050
1050
|
verifyCommand.command("commit-msg").description(localize("Run commitlint verification", "执行 commitlint 校验")).alias("msg").argument("<edit-file>").action(async (editFile) => {
|
|
1051
|
-
const { verifyCommitMsg } = await import("./commands-
|
|
1051
|
+
const { verifyCommitMsg } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
1052
1052
|
await verifyCommitMsg({
|
|
1053
1053
|
cwd,
|
|
1054
1054
|
editFile
|
|
1055
1055
|
});
|
|
1056
1056
|
});
|
|
1057
1057
|
verifyCommand.command("staged-typecheck").description(localize("Run typecheck in workspaces containing staged files", "按暂存文件所在 workspace 执行 typecheck")).alias("tc").argument("[files...]").action(async (files = []) => {
|
|
1058
|
-
const { verifyStagedTypecheck } = await import("./commands-
|
|
1058
|
+
const { verifyStagedTypecheck } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
1059
1059
|
verifyStagedTypecheck(files, { cwd });
|
|
1060
1060
|
});
|
|
1061
1061
|
}
|
|
@@ -1134,12 +1134,12 @@ async function emitWorkspaceList(result, opts) {
|
|
|
1134
1134
|
function registerWorkspaceCommands(program, cwd) {
|
|
1135
1135
|
const workspaceCommand = program.command("workspace").alias("ws").description(localize("Workspace commands", "工作区命令"));
|
|
1136
1136
|
workspaceCommand.command("upgrade").description(localize("Upgrade or synchronize monorepo packages", "升级/同步 monorepo 相关包")).alias("up").option("-i,--interactive", localize("Select managed files interactively", "交互式选择受管文件")).option("-c,--core", localize("Synchronize core configuration without GitHub assets", "仅同步核心配置,跳过 GitHub 相关资产")).option("--outDir <dir>", localize("Output directory", "输出目录")).option("-s,--skip-overwrite", localize("Preserve existing files", "保留已存在文件")).option("-y, --yes", localize("Skip prompts and overwrite drifted managed assets", "跳过交互并覆盖 drifted 标准资产")).option("--overwrite", localize("Overwrite drifted managed assets", "覆盖 drifted 标准资产")).option("--no-overwrite", localize("Preserve drifted managed assets", "不覆盖 drifted 标准资产")).option("--overwrite-release", localize("Overwrite an unmarked custom release workflow", "覆盖未标记的自定义 release workflow")).action(async (opts) => {
|
|
1137
|
-
const { upgradeMonorepo } = await import("./commands-
|
|
1137
|
+
const { upgradeMonorepo } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
1138
1138
|
await upgradeMonorepo(normalizeCliOpts(cwd, opts));
|
|
1139
1139
|
logger.success(localize("Workspace upgrade finished.", "Workspace 升级完成。"));
|
|
1140
1140
|
});
|
|
1141
1141
|
workspaceCommand.command("init").description(localize("Initialize workspace metadata and repository files", "初始化工作区元信息(README、package.json、pnpm intent、issue template)")).alias("i").action(async () => {
|
|
1142
|
-
const { initMetadata } = await import("./commands-
|
|
1142
|
+
const { initMetadata } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
1143
1143
|
await initMetadata(cwd);
|
|
1144
1144
|
logger.success(localize("Workspace initialization finished.", "Workspace 初始化完成。"));
|
|
1145
1145
|
});
|
|
@@ -1152,7 +1152,7 @@ function registerWorkspaceCommands(program, cwd) {
|
|
|
1152
1152
|
}), opts);
|
|
1153
1153
|
});
|
|
1154
1154
|
workspaceCommand.command("clean").description(localize("Remove selected workspace packages", "清除选中的包")).alias("rm").option("-y, --yes", localize("Skip prompts and clean immediately", "跳过交互直接清理(等价 autoConfirm)")).option("--include-private", localize("Include private packages", "包含 private 包")).option("--pinned-version <version>", localize("Override the repoctl version written to the root package", "覆盖写入的 repoctl 版本")).action(async (opts) => {
|
|
1155
|
-
const { cleanProjects } = await import("./commands-
|
|
1155
|
+
const { cleanProjects } = await import("./commands-D4xZQ5t-.mjs").then((n) => n.t);
|
|
1156
1156
|
await cleanProjects(cwd, normalizeCleanOptions(opts));
|
|
1157
1157
|
logger.success(localize("Workspace cleanup finished.", "Workspace 清理完成。"));
|
|
1158
1158
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
2
|
import { i as getWorkspacePackages, n as getWorkspaceData, r as getWorkspacePackageSummaries, t as clearWorkspaceCache } from "./workspace-MCKewElu.mjs";
|
|
3
|
-
import { b as isIgnorableFsError, c as package_default$1, f as resolveRepoctlLocale, i as packageDir, l as version$1, m as logger, n as assetsDir, o as templatesDir, t as initToolingTargets, u as localize, y as fs$1 } from "./types-
|
|
3
|
+
import { b as isIgnorableFsError, c as package_default$1, f as resolveRepoctlLocale, i as packageDir, l as version$1, m as logger, n as assetsDir, o as templatesDir, t as initToolingTargets, u as localize, y as fs$1 } from "./types-MAUIQpfp.mjs";
|
|
4
4
|
import { a as loadMonorepoConfig, c as resolveToolingConfig, i as getRepoctlConfigCandidates, o as loadMonorepoConfigDetails, s as resolveCommandConfig } from "./config-p842Knhq.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { n as defineTsconfigConfig } from "./tsconfig-BrjI_5yI.mjs";
|
|
6
6
|
import gitUrlParse from "git-url-parse";
|
|
7
7
|
import { simpleGit } from "simple-git";
|
|
8
8
|
import { findWorkspaceDir } from "@pnpm/find-workspace-dir";
|
|
@@ -161,18 +161,85 @@ async function generateAgenticTemplates(tasks, defaults = {}) {
|
|
|
161
161
|
return results;
|
|
162
162
|
}
|
|
163
163
|
//#endregion
|
|
164
|
-
//#region src/commands/verify/
|
|
165
|
-
|
|
164
|
+
//#region src/commands/verify/run.ts
|
|
165
|
+
function runPnpmCommand(cwd, label, args, spawn) {
|
|
166
|
+
process.stdout.write(`${label}\n`);
|
|
167
|
+
const result = spawn("pnpm", args, {
|
|
168
|
+
cwd,
|
|
169
|
+
stdio: "inherit"
|
|
170
|
+
});
|
|
171
|
+
if (result.status !== 0) process.exit(result.status ?? 1);
|
|
172
|
+
}
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/commands/verify/staged.ts
|
|
175
|
+
const gitDirName = ".git";
|
|
166
176
|
const typecheckExtensions = /* @__PURE__ */ new Set([
|
|
167
177
|
".ts",
|
|
168
178
|
".tsx",
|
|
169
179
|
".mts",
|
|
170
180
|
".cts",
|
|
171
|
-
".vue"
|
|
181
|
+
".vue",
|
|
182
|
+
".astro",
|
|
183
|
+
".mdx"
|
|
172
184
|
]);
|
|
173
185
|
const typecheckBasenames = /* @__PURE__ */ new Set(["package.json"]);
|
|
186
|
+
function hasTypecheckScript(dir) {
|
|
187
|
+
const packageJsonPath = path$1.join(dir, "package.json");
|
|
188
|
+
if (!fs.existsSync(packageJsonPath)) return false;
|
|
189
|
+
try {
|
|
190
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
191
|
+
return typeof packageJson.scripts?.typecheck === "string" && packageJson.scripts.typecheck.length > 0;
|
|
192
|
+
} catch {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function findRepositoryRoot(startDir) {
|
|
197
|
+
let current = path$1.resolve(startDir);
|
|
198
|
+
while (true) {
|
|
199
|
+
if (fs.existsSync(path$1.join(current, gitDirName))) return current;
|
|
200
|
+
const next = path$1.dirname(current);
|
|
201
|
+
if (next === current) return path$1.resolve(startDir);
|
|
202
|
+
current = next;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
function resolveTypecheckWorkspaceDir(filePath, cwd) {
|
|
206
|
+
const workspaceRoot = findRepositoryRoot(cwd);
|
|
207
|
+
let current = path$1.dirname(path$1.resolve(cwd, filePath));
|
|
208
|
+
while (current.startsWith(workspaceRoot)) {
|
|
209
|
+
if (current !== cwd && hasTypecheckScript(current)) return current;
|
|
210
|
+
const next = path$1.dirname(current);
|
|
211
|
+
if (next === current) break;
|
|
212
|
+
current = next;
|
|
213
|
+
}
|
|
214
|
+
return workspaceRoot;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* 对暂存区中涉及类型检查的文件,按最近的 workspace 归属执行 `typecheck`。
|
|
218
|
+
*
|
|
219
|
+
* 当前识别的扩展名:`.ts`、`.tsx`、`.mts`、`.cts`、`.vue`、`.astro`、`.mdx`。
|
|
220
|
+
*
|
|
221
|
+
* @param stagedFiles 暂存区文件路径列表
|
|
222
|
+
* @param options 运行参数
|
|
223
|
+
*/
|
|
224
|
+
function verifyStagedTypecheck(stagedFiles, options = {}) {
|
|
225
|
+
const cwd = options.cwd ?? process.cwd();
|
|
226
|
+
const spawn = options.spawn ?? spawnSync;
|
|
227
|
+
let workspaceDirs = [...new Set(stagedFiles.filter((file) => {
|
|
228
|
+
const basename = path$1.basename(file);
|
|
229
|
+
return typecheckExtensions.has(path$1.extname(file)) || typecheckBasenames.has(basename);
|
|
230
|
+
}).map((file) => resolveTypecheckWorkspaceDir(file, cwd)))];
|
|
231
|
+
if (workspaceDirs.length === 0) return;
|
|
232
|
+
if (workspaceDirs.includes(cwd)) workspaceDirs = [cwd];
|
|
233
|
+
for (const workspaceDir of workspaceDirs) runPnpmCommand(cwd, `[lint-staged:typecheck] ${path$1.relative(cwd, workspaceDir) || "."}`, [
|
|
234
|
+
"--dir",
|
|
235
|
+
workspaceDir,
|
|
236
|
+
"typecheck"
|
|
237
|
+
], spawn);
|
|
238
|
+
}
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/commands/verify/index.ts
|
|
241
|
+
const zeroSha = "0".repeat(40);
|
|
174
242
|
const whitespacePattern = /\s+/;
|
|
175
|
-
const gitDirName = ".git";
|
|
176
243
|
const defaultWorkspaceOrder = [
|
|
177
244
|
"packages/create-icebreaker",
|
|
178
245
|
"packages/create-repoctl",
|
|
@@ -184,6 +251,7 @@ const defaultWorkspaceOrder = [
|
|
|
184
251
|
"templates/server",
|
|
185
252
|
"templates/tsdown",
|
|
186
253
|
"templates/vitepress",
|
|
254
|
+
"templates/nimbus",
|
|
187
255
|
"templates/vue-lib"
|
|
188
256
|
].sort((left, right) => right.length - left.length);
|
|
189
257
|
function getPackageScripts(dir, cwd) {
|
|
@@ -252,14 +320,6 @@ function getChangedFilesForNewRemote(head, cwd, execFile) {
|
|
|
252
320
|
encoding: "utf8"
|
|
253
321
|
}).split("\n").filter(Boolean);
|
|
254
322
|
}
|
|
255
|
-
function runPnpmCommand(cwd, label, args, spawn) {
|
|
256
|
-
process.stdout.write(`${label}\n`);
|
|
257
|
-
const result = spawn("pnpm", args, {
|
|
258
|
-
cwd,
|
|
259
|
-
stdio: "inherit"
|
|
260
|
-
});
|
|
261
|
-
if (result.status !== 0) process.exit(result.status ?? 1);
|
|
262
|
-
}
|
|
263
323
|
function runShellCommand(cwd, label, command, spawn) {
|
|
264
324
|
process.stdout.write(`${label}\n`);
|
|
265
325
|
const result = spawn("sh", ["-lc", command], {
|
|
@@ -279,36 +339,6 @@ async function readHookStdin() {
|
|
|
279
339
|
}
|
|
280
340
|
return output.trim();
|
|
281
341
|
}
|
|
282
|
-
function hasTypecheckScript(dir) {
|
|
283
|
-
const packageJsonPath = path$1.join(dir, "package.json");
|
|
284
|
-
if (!fs.existsSync(packageJsonPath)) return false;
|
|
285
|
-
try {
|
|
286
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
287
|
-
return typeof packageJson.scripts?.typecheck === "string" && packageJson.scripts.typecheck.length > 0;
|
|
288
|
-
} catch {
|
|
289
|
-
return false;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
function findRepositoryRoot(startDir) {
|
|
293
|
-
let current = path$1.resolve(startDir);
|
|
294
|
-
while (true) {
|
|
295
|
-
if (fs.existsSync(path$1.join(current, gitDirName))) return current;
|
|
296
|
-
const next = path$1.dirname(current);
|
|
297
|
-
if (next === current) return path$1.resolve(startDir);
|
|
298
|
-
current = next;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
function resolveTypecheckWorkspaceDir(filePath, cwd) {
|
|
302
|
-
const workspaceRoot = findRepositoryRoot(cwd);
|
|
303
|
-
let current = path$1.dirname(path$1.resolve(cwd, filePath));
|
|
304
|
-
while (current.startsWith(workspaceRoot)) {
|
|
305
|
-
if (current !== cwd && hasTypecheckScript(current)) return current;
|
|
306
|
-
const next = path$1.dirname(current);
|
|
307
|
-
if (next === current) break;
|
|
308
|
-
current = next;
|
|
309
|
-
}
|
|
310
|
-
return workspaceRoot;
|
|
311
|
-
}
|
|
312
342
|
/**
|
|
313
343
|
* 执行 pre-push 校验。
|
|
314
344
|
*
|
|
@@ -375,29 +405,6 @@ async function verifyPrePush(options = {}) {
|
|
|
375
405
|
}
|
|
376
406
|
}
|
|
377
407
|
/**
|
|
378
|
-
* 对暂存区中涉及类型检查的文件,按最近的 workspace 归属执行 `typecheck`。
|
|
379
|
-
*
|
|
380
|
-
* 当前识别的扩展名:`.ts`、`.tsx`、`.mts`、`.cts`、`.vue`。
|
|
381
|
-
*
|
|
382
|
-
* @param stagedFiles 暂存区文件路径列表
|
|
383
|
-
* @param options 运行参数
|
|
384
|
-
*/
|
|
385
|
-
function verifyStagedTypecheck(stagedFiles, options = {}) {
|
|
386
|
-
const cwd = options.cwd ?? process.cwd();
|
|
387
|
-
const spawn = options.spawn ?? spawnSync;
|
|
388
|
-
let workspaceDirs = [...new Set(stagedFiles.filter((file) => {
|
|
389
|
-
const basename = path$1.basename(file);
|
|
390
|
-
return typecheckExtensions.has(path$1.extname(file)) || typecheckBasenames.has(basename);
|
|
391
|
-
}).map((file) => resolveTypecheckWorkspaceDir(file, cwd)))];
|
|
392
|
-
if (workspaceDirs.length === 0) return;
|
|
393
|
-
if (workspaceDirs.includes(cwd)) workspaceDirs = [cwd];
|
|
394
|
-
for (const workspaceDir of workspaceDirs) runPnpmCommand(cwd, `[lint-staged:typecheck] ${path$1.relative(cwd, workspaceDir) || "."}`, [
|
|
395
|
-
"--dir",
|
|
396
|
-
workspaceDir,
|
|
397
|
-
"typecheck"
|
|
398
|
-
], spawn);
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
408
|
* 执行 commit-msg 校验。
|
|
402
409
|
*
|
|
403
410
|
* 优先读取 `tooling.husky.commitMsgCommand`;若未配置,则回退到
|
|
@@ -1040,6 +1047,10 @@ const templateMap = {
|
|
|
1040
1047
|
"cli": {
|
|
1041
1048
|
source: "cli",
|
|
1042
1049
|
target: "apps/cli"
|
|
1050
|
+
},
|
|
1051
|
+
"nimbus": {
|
|
1052
|
+
source: "nimbus",
|
|
1053
|
+
target: "apps/docs"
|
|
1043
1054
|
}
|
|
1044
1055
|
};
|
|
1045
1056
|
/**
|
|
@@ -1924,7 +1935,8 @@ var package_default = {
|
|
|
1924
1935
|
"pr:rc": "repo release pre enter rc",
|
|
1925
1936
|
"pr:next": "repo release pre enter next",
|
|
1926
1937
|
"pr:exit": "repo release pre exit",
|
|
1927
|
-
"--------": "----------------"
|
|
1938
|
+
"--------": "----------------",
|
|
1939
|
+
"test:packaged-nimbus": "node scripts/nimbus/index.mjs"
|
|
1928
1940
|
},
|
|
1929
1941
|
devDependencies: {
|
|
1930
1942
|
"@commitlint/cli": "^21.2.3",
|
|
@@ -1934,12 +1946,13 @@ var package_default = {
|
|
|
1934
1946
|
"@icebreakers/monorepo": "workspace:*",
|
|
1935
1947
|
"@icebreakers/stylelint-config": "workspace:*",
|
|
1936
1948
|
"@types/node": "^26.6.3",
|
|
1937
|
-
"@vitest/coverage-v8": "~5.0.
|
|
1949
|
+
"@vitest/coverage-v8": "~5.0.3",
|
|
1938
1950
|
"eslint": "^10.11.0",
|
|
1939
1951
|
"execa": "^10.0.1",
|
|
1940
1952
|
"husky": "^9.1.7",
|
|
1941
1953
|
"lint-staged": "^17.6.0",
|
|
1942
1954
|
"only-allow": "^1.2.2",
|
|
1955
|
+
"playwright": "^1.63.0",
|
|
1943
1956
|
"repoctl": "workspace:*",
|
|
1944
1957
|
"stylelint": "^17.15.0",
|
|
1945
1958
|
"tailwindcss": "^4.3.3",
|
|
@@ -1947,7 +1960,7 @@ var package_default = {
|
|
|
1947
1960
|
"tsdown": "0.23.0",
|
|
1948
1961
|
"turbo": "^2.11.5",
|
|
1949
1962
|
"typescript": "^6.0.3",
|
|
1950
|
-
"vitest": "~5.0.
|
|
1963
|
+
"vitest": "~5.0.3",
|
|
1951
1964
|
"yaml": "^2.9.1"
|
|
1952
1965
|
},
|
|
1953
1966
|
publishConfig: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as defaultTemplate, N as resolveCreateNewProjectPlan, j as getCreateChoices, k as createNewProject } from "./commands-
|
|
2
|
-
import { m as logger, u as localize, y as fs } from "./types-
|
|
1
|
+
import { A as defaultTemplate, M as getTemplateMap, N as resolveCreateNewProjectPlan, j as getCreateChoices, k as createNewProject } from "./commands-D4xZQ5t-.mjs";
|
|
2
|
+
import { m as logger, u as localize, y as fs } from "./types-MAUIQpfp.mjs";
|
|
3
3
|
import { s as resolveCommandConfig } from "./config-p842Knhq.mjs";
|
|
4
4
|
import path from "pathe";
|
|
5
5
|
import process from "node:process";
|
|
@@ -10,36 +10,31 @@ const createIntentChoices = [
|
|
|
10
10
|
value: "library",
|
|
11
11
|
name: "Library",
|
|
12
12
|
description: localize("Create a publishable library package", "创建一个可发布的库包"),
|
|
13
|
-
defaultTemplate: "tsdown"
|
|
14
|
-
defaultBaseDir: "packages"
|
|
13
|
+
defaultTemplate: "tsdown"
|
|
15
14
|
},
|
|
16
15
|
{
|
|
17
16
|
value: "web-app",
|
|
18
17
|
name: "Web App",
|
|
19
18
|
description: localize("Create a full-stack web application", "创建一个前后端一体的 Web 应用"),
|
|
20
|
-
defaultTemplate: "vue-hono"
|
|
21
|
-
defaultBaseDir: "apps"
|
|
19
|
+
defaultTemplate: "vue-hono"
|
|
22
20
|
},
|
|
23
21
|
{
|
|
24
22
|
value: "api-service",
|
|
25
23
|
name: "API Service",
|
|
26
24
|
description: localize("Create a Hono API service", "创建一个 Hono API 服务"),
|
|
27
|
-
defaultTemplate: "hono-server"
|
|
28
|
-
defaultBaseDir: "apps"
|
|
25
|
+
defaultTemplate: "hono-server"
|
|
29
26
|
},
|
|
30
27
|
{
|
|
31
28
|
value: "docs-site",
|
|
32
29
|
name: "Docs Site",
|
|
33
30
|
description: localize("Create a documentation site", "创建一个文档站点"),
|
|
34
|
-
defaultTemplate: "
|
|
35
|
-
defaultBaseDir: "apps"
|
|
31
|
+
defaultTemplate: "nimbus"
|
|
36
32
|
},
|
|
37
33
|
{
|
|
38
34
|
value: "cli-tool",
|
|
39
35
|
name: "CLI Tool",
|
|
40
36
|
description: localize("Create a command-line tool", "创建一个命令行工具"),
|
|
41
|
-
defaultTemplate: "cli"
|
|
42
|
-
defaultBaseDir: "apps"
|
|
37
|
+
defaultTemplate: "cli"
|
|
43
38
|
}
|
|
44
39
|
];
|
|
45
40
|
//#endregion
|
|
@@ -48,12 +43,13 @@ function normalizeTargetName(name, baseDir) {
|
|
|
48
43
|
if (name.includes("/")) return name;
|
|
49
44
|
return `${baseDir}/${name}`;
|
|
50
45
|
}
|
|
51
|
-
function resolveBaseDirFromTemplate(type) {
|
|
52
|
-
|
|
46
|
+
function resolveBaseDirFromTemplate(type, templates) {
|
|
47
|
+
const baseDir = (type ? templates[type]?.target : void 0)?.split("/")[0];
|
|
48
|
+
return baseDir === "apps" || baseDir === "packages" ? baseDir : void 0;
|
|
53
49
|
}
|
|
54
|
-
function normalizeNameForTemplate(name, type) {
|
|
50
|
+
function normalizeNameForTemplate(name, type, templates) {
|
|
55
51
|
if (!type) return name;
|
|
56
|
-
const baseDir = resolveBaseDirFromTemplate(type);
|
|
52
|
+
const baseDir = resolveBaseDirFromTemplate(type, templates);
|
|
57
53
|
if (!baseDir) return name;
|
|
58
54
|
return normalizeTargetName(name, baseDir);
|
|
59
55
|
}
|
|
@@ -117,11 +113,12 @@ async function runCreateFlow(cwd, inputName, options = {}) {
|
|
|
117
113
|
try {
|
|
118
114
|
const createConfig = await resolveCommandConfig("create", cwd);
|
|
119
115
|
const explicitTemplate = options.template ?? createConfig?.type ?? createConfig?.defaultTemplate;
|
|
116
|
+
const templates = getTemplateMap(createConfig?.templateMap);
|
|
120
117
|
let packageName = inputName;
|
|
121
118
|
if (!explicitTemplate && !canPrompt()) {
|
|
122
119
|
const type = defaultTemplate;
|
|
123
120
|
const createOptions = {
|
|
124
|
-
name: normalizeNameForTemplate(packageName ?? createConfig?.name ?? "my-package", type),
|
|
121
|
+
name: normalizeNameForTemplate(packageName ?? createConfig?.name ?? "my-package", type, templates),
|
|
125
122
|
cwd,
|
|
126
123
|
type
|
|
127
124
|
};
|
|
@@ -159,7 +156,7 @@ async function runCreateFlow(cwd, inputName, options = {}) {
|
|
|
159
156
|
default: "tsdown"
|
|
160
157
|
});
|
|
161
158
|
const createOptions = {
|
|
162
|
-
name:
|
|
159
|
+
name: normalizeNameForTemplate(packageName, type, templates),
|
|
163
160
|
cwd,
|
|
164
161
|
...type !== void 0 ? { type } : {}
|
|
165
162
|
};
|
|
@@ -181,7 +178,7 @@ async function runCreateFlow(cwd, inputName, options = {}) {
|
|
|
181
178
|
default: "tsdown"
|
|
182
179
|
});
|
|
183
180
|
const createOptions = {
|
|
184
|
-
name: normalizeNameForTemplate(packageName, type),
|
|
181
|
+
name: normalizeNameForTemplate(packageName, type, templates),
|
|
185
182
|
cwd,
|
|
186
183
|
...type !== void 0 ? { type } : {}
|
|
187
184
|
};
|