@icebreakers/monorepo 5.5.9 → 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 +35 -34
- package/dist/{commands-BCix_gOD.mjs → commands-D4xZQ5t-.mjs} +425 -120
- package/dist/{create-flow-ghL18gPo.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 +18 -12
- 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-W9fwiyx8.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
|
@@ -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
|
};
|
|
@@ -120,6 +120,10 @@ declare const templateMap: {
|
|
|
120
120
|
readonly source: "cli";
|
|
121
121
|
readonly target: "apps/cli";
|
|
122
122
|
};
|
|
123
|
+
readonly nimbus: {
|
|
124
|
+
readonly source: "nimbus";
|
|
125
|
+
readonly target: "apps/docs";
|
|
126
|
+
};
|
|
123
127
|
};
|
|
124
128
|
type CreateNewProjectType = keyof typeof templateMap;
|
|
125
129
|
interface CreateNewProjectOptions {
|
|
@@ -682,7 +686,7 @@ interface MonorepoConfig {
|
|
|
682
686
|
tooling?: ToolingConfig;
|
|
683
687
|
}
|
|
684
688
|
//#endregion
|
|
685
|
-
//#region src/tooling/
|
|
689
|
+
//#region src/tooling/types.d.ts
|
|
686
690
|
/**
|
|
687
691
|
* `commitlint.config.*` 最终导出的配置类型。
|
|
688
692
|
*
|
|
@@ -789,21 +793,40 @@ interface DefineVitestProjectConfigOptions {
|
|
|
789
793
|
cwd?: string;
|
|
790
794
|
options?: MonorepoVitestProjectConfigOptions;
|
|
791
795
|
}
|
|
796
|
+
//#endregion
|
|
797
|
+
//#region src/tooling/lint-staged.d.ts
|
|
792
798
|
/**
|
|
793
|
-
*
|
|
799
|
+
* 创建适用于当前仓库约定的 `lint-staged` 配置。
|
|
794
800
|
*
|
|
795
|
-
*
|
|
796
|
-
*
|
|
801
|
+
* 默认行为:
|
|
802
|
+
* - `*.{js,jsx,mjs,ts,tsx,mts,cts}` 运行 `eslint --fix`
|
|
803
|
+
* - `*.vue` 同时运行 `eslint --fix` 与 `stylelint --fix --allow-empty-input`
|
|
804
|
+
* - TypeScript/Vue files and workspace `package.json` files share one
|
|
805
|
+
* `pnpm exec repo verify staged-typecheck` task to avoid concurrent builds
|
|
806
|
+
* - 样式文件运行 `stylelint --fix --allow-empty-input`
|
|
807
|
+
*
|
|
808
|
+
* @param options 可配置 `repoCommand`,默认值为 `pnpm exec repo`
|
|
809
|
+
* @returns 可直接导出的 `lint-staged` 配置对象
|
|
797
810
|
*
|
|
798
811
|
* @example
|
|
799
|
-
* ```
|
|
800
|
-
* import {
|
|
812
|
+
* ```js
|
|
813
|
+
* import { createMonorepoLintStagedConfig } from 'repoctl/tooling'
|
|
801
814
|
*
|
|
802
|
-
*
|
|
803
|
-
*
|
|
815
|
+
* export default createMonorepoLintStagedConfig({
|
|
816
|
+
* repoCommand: 'pnpm exec repo',
|
|
817
|
+
* })
|
|
804
818
|
* ```
|
|
805
819
|
*/
|
|
806
|
-
declare function
|
|
820
|
+
declare function createMonorepoLintStagedConfig(options?: MonorepoLintStagedConfigOptions): MonorepoLintStagedConfig;
|
|
821
|
+
/**
|
|
822
|
+
* 从 `repoctl.config.ts` 读取 `tooling.lintStaged`,并生成 `lint-staged` 配置。
|
|
823
|
+
*
|
|
824
|
+
* @param input `cwd` 用于指定配置文件解析起点,`options` 用于追加运行时覆盖项
|
|
825
|
+
* @returns 可直接导出的 `lint-staged` 配置对象
|
|
826
|
+
*/
|
|
827
|
+
declare function defineLintStagedConfig(input?: DefineConfigOptions<MonorepoLintStagedConfigOptions>): Promise<MonorepoLintStagedConfig>;
|
|
828
|
+
//#endregion
|
|
829
|
+
//#region src/tooling/linters.d.ts
|
|
807
830
|
/**
|
|
808
831
|
* 基于 `@icebreakers/commitlint-config` 创建 commitlint 配置。
|
|
809
832
|
*
|
|
@@ -890,6 +913,25 @@ declare function createMonorepoStylelintConfig(options?: StylelintToolingConfig)
|
|
|
890
913
|
* @returns 可直接导出的 Stylelint 配置对象
|
|
891
914
|
*/
|
|
892
915
|
declare function defineStylelintConfig(input?: DefineConfigOptions<StylelintToolingConfig>): Promise<MonorepoStylelintConfig>;
|
|
916
|
+
//#endregion
|
|
917
|
+
//#region src/tooling/shared.d.ts
|
|
918
|
+
/**
|
|
919
|
+
* 读取当前工作目录下的 `repoctl.config.*` 中 `tooling` 配置块。
|
|
920
|
+
*
|
|
921
|
+
* @param cwd 配置文件解析起点。默认使用 `process.cwd()`
|
|
922
|
+
* @returns 标准化后的 tooling 配置;未配置时返回空对象
|
|
923
|
+
*
|
|
924
|
+
* @example
|
|
925
|
+
* ```ts
|
|
926
|
+
* import { loadMonorepoToolingConfig } from 'repoctl/tooling'
|
|
927
|
+
*
|
|
928
|
+
* const tooling = await loadMonorepoToolingConfig()
|
|
929
|
+
* console.log(tooling.vitest?.includeWorkspaceRootConfig)
|
|
930
|
+
* ```
|
|
931
|
+
*/
|
|
932
|
+
declare function loadMonorepoToolingConfig(cwd?: string): Promise<NonNullable<ToolingConfig>>;
|
|
933
|
+
//#endregion
|
|
934
|
+
//#region src/tooling/tsconfig.d.ts
|
|
893
935
|
/**
|
|
894
936
|
* 创建 monorepo 内置的 TypeScript 基线配置。
|
|
895
937
|
*
|
|
@@ -904,36 +946,8 @@ declare function createMonorepoTsconfig(options?: TsconfigToolingConfig): Monore
|
|
|
904
946
|
* @returns 可直接写入或导出的 `tsconfig.json` 配置对象
|
|
905
947
|
*/
|
|
906
948
|
declare function defineTsconfigConfig(input?: DefineConfigOptions<TsconfigToolingConfig>): Promise<MonorepoTsconfig>;
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
*
|
|
910
|
-
* 默认行为:
|
|
911
|
-
* - `*.{js,jsx,mjs,ts,tsx,mts,cts}` 运行 `eslint --fix`
|
|
912
|
-
* - `*.vue` 同时运行 `eslint --fix` 与 `stylelint --fix --allow-empty-input`
|
|
913
|
-
* - TypeScript/Vue files and workspace `package.json` files share one
|
|
914
|
-
* `pnpm exec repo verify staged-typecheck` task to avoid concurrent builds
|
|
915
|
-
* - 样式文件运行 `stylelint --fix --allow-empty-input`
|
|
916
|
-
*
|
|
917
|
-
* @param options 可配置 `repoCommand`,默认值为 `pnpm exec repo`
|
|
918
|
-
* @returns 可直接导出的 `lint-staged` 配置对象
|
|
919
|
-
*
|
|
920
|
-
* @example
|
|
921
|
-
* ```js
|
|
922
|
-
* import { createMonorepoLintStagedConfig } from 'repoctl/tooling'
|
|
923
|
-
*
|
|
924
|
-
* export default createMonorepoLintStagedConfig({
|
|
925
|
-
* repoCommand: 'pnpm exec repo',
|
|
926
|
-
* })
|
|
927
|
-
* ```
|
|
928
|
-
*/
|
|
929
|
-
declare function createMonorepoLintStagedConfig(options?: MonorepoLintStagedConfigOptions): MonorepoLintStagedConfig;
|
|
930
|
-
/**
|
|
931
|
-
* 从 `repoctl.config.ts` 读取 `tooling.lintStaged`,并生成 `lint-staged` 配置。
|
|
932
|
-
*
|
|
933
|
-
* @param input `cwd` 用于指定配置文件解析起点,`options` 用于追加运行时覆盖项
|
|
934
|
-
* @returns 可直接导出的 `lint-staged` 配置对象
|
|
935
|
-
*/
|
|
936
|
-
declare function defineLintStagedConfig(input?: DefineConfigOptions<MonorepoLintStagedConfigOptions>): Promise<MonorepoLintStagedConfig>;
|
|
949
|
+
//#endregion
|
|
950
|
+
//#region src/tooling/vitest/index.d.ts
|
|
937
951
|
/**
|
|
938
952
|
* 创建 monorepo 根级 Vitest 配置。
|
|
939
953
|
*
|
|
@@ -1022,4 +1036,4 @@ declare function createMonorepoVitestProjectConfig(options?: MonorepoVitestProje
|
|
|
1022
1036
|
*/
|
|
1023
1037
|
declare function defineVitestProjectConfig(input?: DefineVitestProjectConfigOptions): Promise<MonorepoVitestProjectConfigResult>;
|
|
1024
1038
|
//#endregion
|
|
1025
|
-
export { init as $,
|
|
1039
|
+
export { init as $, MonorepoVitestProjectConfigResult as A, HuskyToolingConfig as B, MonorepoLintStagedConfigOptions as C, MonorepoVitestConfigOverrides as D, MonorepoVitestConfigOptions as E, CleanCommandConfig as F, StylelintToolingConfig as G, LintStagedToolingConfig as H, CommitlintToolingConfig as I, UpgradeCommandConfig as J, ToolingConfig as K, CreateChoiceOption as L, SimpleGit as M, SimpleGitOptions as N, MonorepoVitestConfigResult as O, AiCommandConfig as P, ReleaseCommandConfig as Q, CreateCommandConfig as R, MonorepoLintStagedConfig as S, MonorepoTsconfig as T, MirrorCommandConfig as U, InitCommandConfig as V, MonorepoConfig as W, VitestToolingConfig as X, VitestProjectToolingConfig as Y, ReleaseAfterPublishHookConfig as Z, DefineEslintConfigOptions as _, generateAgenticTemplates as _t, createMonorepoTsconfig as a, CreateNewProjectOptions as at, MonorepoCommitlintConfig as b, createMonorepoCommitlintConfig as c, getTemplateMap as ct, defineCommitlintConfig as d, AgenticTemplateFormat as dt, initMetadata as et, defineEslintConfig as f, AgenticTemplateTask as ft, DefineConfigOptions as g, generateAgenticTemplate as gt, defineLintStagedConfig as h, defaultAgenticBaseDir as ht, defineVitestProjectConfig as i, createNewProject as it, ConfigValues as j, MonorepoVitestProjectConfigOptions as k, createMonorepoEslintConfig as l, resolveCreateNewProjectPlan as lt, createMonorepoLintStagedConfig as m, createTimestampFolderName as mt, createMonorepoVitestProjectConfig as n, normalizeInitToolingTargets as nt, defineTsconfigConfig as o, CreateNewProjectPlan as ot, defineStylelintConfig as p, GenerateAgenticTemplateOptions as pt, TsconfigToolingConfig as q, defineVitestConfig as r, initToolingTargets as rt, loadMonorepoToolingConfig as s, getCreateChoices as st, createMonorepoVitestConfig as t, initTooling as tt, createMonorepoStylelintConfig as u, templateMap as ut, DefineVitestConfigOptions as v, loadAgenticTasks as vt, MonorepoStylelintConfig as w, MonorepoEslintConfig as x, DefineVitestProjectConfigOptions as y, CliOpts as yt, EslintToolingConfig as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as init, A as
|
|
1
|
+
import { $ as init, A as MonorepoVitestProjectConfigResult, B as HuskyToolingConfig, C as MonorepoLintStagedConfigOptions, D as MonorepoVitestConfigOverrides, E as MonorepoVitestConfigOptions, F as CleanCommandConfig, G as StylelintToolingConfig, H as LintStagedToolingConfig, I as CommitlintToolingConfig, J as UpgradeCommandConfig, K as ToolingConfig, L as CreateChoiceOption, M as SimpleGit, N as SimpleGitOptions, O as MonorepoVitestConfigResult, P as AiCommandConfig, Q as ReleaseCommandConfig, R as CreateCommandConfig, S as MonorepoLintStagedConfig, T as MonorepoTsconfig, U as MirrorCommandConfig, V as InitCommandConfig, W as MonorepoConfig, X as VitestToolingConfig, Y as VitestProjectToolingConfig, Z as ReleaseAfterPublishHookConfig, _ as DefineEslintConfigOptions, _t as generateAgenticTemplates, a as createMonorepoTsconfig, at as CreateNewProjectOptions, b as MonorepoCommitlintConfig, c as createMonorepoCommitlintConfig, ct as getTemplateMap, d as defineCommitlintConfig, dt as AgenticTemplateFormat, et as initMetadata, f as defineEslintConfig, ft as AgenticTemplateTask, g as DefineConfigOptions, gt as generateAgenticTemplate, h as defineLintStagedConfig, ht as defaultAgenticBaseDir, i as defineVitestProjectConfig, it as createNewProject, j as ConfigValues, k as MonorepoVitestProjectConfigOptions, l as createMonorepoEslintConfig, lt as resolveCreateNewProjectPlan, m as createMonorepoLintStagedConfig, mt as createTimestampFolderName, n as createMonorepoVitestProjectConfig, nt as normalizeInitToolingTargets, o as defineTsconfigConfig, ot as CreateNewProjectPlan, p as defineStylelintConfig, pt as GenerateAgenticTemplateOptions, q as TsconfigToolingConfig, r as defineVitestConfig, rt as initToolingTargets, s as loadMonorepoToolingConfig, st as getCreateChoices, t as createMonorepoVitestConfig, tt as initTooling, u as createMonorepoStylelintConfig, ut as templateMap, v as DefineVitestConfigOptions, vt as loadAgenticTasks, w as MonorepoStylelintConfig, x as MonorepoEslintConfig, y as DefineVitestProjectConfigOptions, yt as CliOpts, z as EslintToolingConfig } from "./index-Bl_PB2Ch.mjs";
|
|
2
2
|
import gitUrlParse from "git-url-parse";
|
|
3
3
|
import { mkdtemp, readFile, readdir, stat, writeFile } from "node:fs/promises";
|
|
4
4
|
import { execFileSync, spawnSync } from "node:child_process";
|
|
@@ -418,6 +418,8 @@ interface ReleaseOptions {
|
|
|
418
418
|
sleep?: (milliseconds: number) => Promise<void>;
|
|
419
419
|
}
|
|
420
420
|
interface ReleaseCiOptions extends ReleaseOptions {
|
|
421
|
+
/** Recover the entire prepared release from this main-history commit. */
|
|
422
|
+
sourceSha?: string;
|
|
421
423
|
mode?: ReleaseMode;
|
|
422
424
|
packageName?: string;
|
|
423
425
|
packageVersion?: string;
|
|
@@ -439,7 +441,7 @@ export declare function releaseCi(options: ReleaseCiOptions): Promise<PublishedP
|
|
|
439
441
|
} | undefined>;
|
|
440
442
|
//#endregion
|
|
441
443
|
//#region src/commands/release/prerelease.d.ts
|
|
442
|
-
export declare function releasePrerelease(options:
|
|
444
|
+
export declare function releasePrerelease(options: ReleaseCiOptions, publish?: () => Promise<PublishedPackage[]>): Promise<PublishedPackage[] | undefined>;
|
|
443
445
|
export declare function enterPrerelease(tag: string, options: ReleaseOptions): Promise<void>;
|
|
444
446
|
export declare function exitPrerelease(options: ReleaseOptions): Promise<void>;
|
|
445
447
|
//#endregion
|
|
@@ -541,7 +543,7 @@ interface CheckTemplatesOptions {
|
|
|
541
543
|
}
|
|
542
544
|
export declare function checkTemplates(options?: CheckTemplatesOptions): Promise<TemplateHealthReport>;
|
|
543
545
|
//#endregion
|
|
544
|
-
//#region src/commands/verify/
|
|
546
|
+
//#region src/commands/verify/types.d.ts
|
|
545
547
|
interface VerifyCommandOptions {
|
|
546
548
|
/**
|
|
547
549
|
* 命令执行根目录。
|
|
@@ -597,6 +599,19 @@ interface PreCommitVerifyOptions extends VerifyCommandOptions {
|
|
|
597
599
|
*/
|
|
598
600
|
spawn?: typeof spawnSync;
|
|
599
601
|
}
|
|
602
|
+
//#endregion
|
|
603
|
+
//#region src/commands/verify/staged.d.ts
|
|
604
|
+
/**
|
|
605
|
+
* 对暂存区中涉及类型检查的文件,按最近的 workspace 归属执行 `typecheck`。
|
|
606
|
+
*
|
|
607
|
+
* 当前识别的扩展名:`.ts`、`.tsx`、`.mts`、`.cts`、`.vue`、`.astro`、`.mdx`。
|
|
608
|
+
*
|
|
609
|
+
* @param stagedFiles 暂存区文件路径列表
|
|
610
|
+
* @param options 运行参数
|
|
611
|
+
*/
|
|
612
|
+
export declare function verifyStagedTypecheck(stagedFiles: string[], options?: StagedTypecheckOptions): void;
|
|
613
|
+
//#endregion
|
|
614
|
+
//#region src/commands/verify/index.d.ts
|
|
600
615
|
/**
|
|
601
616
|
* 执行 pre-push 校验。
|
|
602
617
|
*
|
|
@@ -609,15 +624,6 @@ interface PreCommitVerifyOptions extends VerifyCommandOptions {
|
|
|
609
624
|
* @returns Promise<void>
|
|
610
625
|
*/
|
|
611
626
|
export declare function verifyPrePush(options?: PrePushVerifyOptions): Promise<void>;
|
|
612
|
-
/**
|
|
613
|
-
* 对暂存区中涉及类型检查的文件,按最近的 workspace 归属执行 `typecheck`。
|
|
614
|
-
*
|
|
615
|
-
* 当前识别的扩展名:`.ts`、`.tsx`、`.mts`、`.cts`、`.vue`。
|
|
616
|
-
*
|
|
617
|
-
* @param stagedFiles 暂存区文件路径列表
|
|
618
|
-
* @param options 运行参数
|
|
619
|
-
*/
|
|
620
|
-
export declare function verifyStagedTypecheck(stagedFiles: string[], options?: StagedTypecheckOptions): void;
|
|
621
627
|
/**
|
|
622
628
|
* 执行 commit-msg 校验。
|
|
623
629
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { $ as runRecommendedCheck, B as escapeStringRegexp, C as createContext, D as collectEnvSupportBundle, E as collectEnvSnapshot, F as inspectMonorepoConfig, G as isGitignoreFile, H as setByPath, I as cleanProjects, J as toWorkspaceGitignorePath, K as toPublishGitignorePath, L as getSkillTargetPaths, M as getTemplateMap, N as resolveCreateNewProjectPlan, O as runDoctor, P as templateMap, Q as resolveRecommendedCheckPlan, R as skillTargets, S as normalizeInitToolingTargets, T as collectEnvPaths, U as getFileHash, V as isMatch, W as isFileChanged, X as getKnownRepoCheckCommands, Y as updateIssueTemplateConfig, Z as resolveFullWorkspaceCheckPlan, _ as parsePublishSummary, a as createReleasePullRequest, at as defaultAgenticBaseDir, b as initMetadata, c as prepareStable, ct as loadAgenticTasks, d as reconcileRelease, et as verifyCommitMsg, f as enterPrerelease, g as GitHubApiError, h as GitHubClient, i as repairReleaseNotes, it as createTimestampFolderName, j as getCreateChoices, k as createNewProject, l as publishStable, lt as GitClient, m as releasePrerelease, n as upgradeMonorepo, nt as verifyPrePush, o as recoverUnpublished, ot as generateAgenticTemplate, p as exitPrerelease, q as toWorkspaceAssetPath, r as checkTemplates, rt as verifyStagedTypecheck, s as releaseCi, st as generateAgenticTemplates, tt as verifyPreCommit, u as releaseStable, v as setVscodeBinaryMirror, w as collectEnvInfo, x as initTooling, y as init, z as syncSkills } from "./commands-
|
|
1
|
+
import { $ as runRecommendedCheck, B as escapeStringRegexp, C as createContext, D as collectEnvSupportBundle, E as collectEnvSnapshot, F as inspectMonorepoConfig, G as isGitignoreFile, H as setByPath, I as cleanProjects, J as toWorkspaceGitignorePath, K as toPublishGitignorePath, L as getSkillTargetPaths, M as getTemplateMap, N as resolveCreateNewProjectPlan, O as runDoctor, P as templateMap, Q as resolveRecommendedCheckPlan, R as skillTargets, S as normalizeInitToolingTargets, T as collectEnvPaths, U as getFileHash, V as isMatch, W as isFileChanged, X as getKnownRepoCheckCommands, Y as updateIssueTemplateConfig, Z as resolveFullWorkspaceCheckPlan, _ as parsePublishSummary, a as createReleasePullRequest, at as defaultAgenticBaseDir, b as initMetadata, c as prepareStable, ct as loadAgenticTasks, d as reconcileRelease, et as verifyCommitMsg, f as enterPrerelease, g as GitHubApiError, h as GitHubClient, i as repairReleaseNotes, it as createTimestampFolderName, j as getCreateChoices, k as createNewProject, l as publishStable, lt as GitClient, m as releasePrerelease, n as upgradeMonorepo, nt as verifyPrePush, o as recoverUnpublished, ot as generateAgenticTemplate, p as exitPrerelease, q as toWorkspaceAssetPath, r as checkTemplates, rt as verifyStagedTypecheck, s as releaseCi, st as generateAgenticTemplates, tt as verifyPreCommit, u as releaseStable, v as setVscodeBinaryMirror, w as collectEnvInfo, x as initTooling, y as init, z as syncSkills } from "./commands-D4xZQ5t-.mjs";
|
|
2
2
|
import { i as getWorkspacePackages, n as getWorkspaceData, r as getWorkspacePackageSummaries, t as clearWorkspaceCache } from "./workspace-MCKewElu.mjs";
|
|
3
|
-
import { C as outputJson, D as remove, E as readJson, O as writeJSON, S as outputJSON, T as readJSON, _ as ensureFile, a as rootDir, b as isIgnorableFsError, g as ensureDir, h as copy, i as packageDir, k as writeJson, l as version, m as logger, n as assetsDir, o as templatesDir, r as cliName, s as name, t as initToolingTargets, v as exists, w as pathExists, x as outputFile } from "./types-
|
|
3
|
+
import { C as outputJson, D as remove, E as readJson, O as writeJSON, S as outputJSON, T as readJSON, _ as ensureFile, a as rootDir, b as isIgnorableFsError, g as ensureDir, h as copy, i as packageDir, k as writeJson, l as version, m as logger, n as assetsDir, o as templatesDir, r as cliName, s as name, t as initToolingTargets, v as exists, w as pathExists, x as outputFile } from "./types-MAUIQpfp.mjs";
|
|
4
4
|
import { a as loadMonorepoConfig, c as resolveToolingConfig, i as getRepoctlConfigCandidates, o as loadMonorepoConfigDetails, r as defineMonorepoConfig, s as resolveCommandConfig, t as configExtensions } from "./config-p842Knhq.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { i as loadMonorepoToolingConfig, n as defineTsconfigConfig, t as createMonorepoTsconfig } from "./tsconfig-BrjI_5yI.mjs";
|
|
6
|
+
import { a as createMonorepoCommitlintConfig, c as defineCommitlintConfig, d as createMonorepoLintStagedConfig, f as defineLintStagedConfig, i as defineVitestProjectConfig, l as defineEslintConfig, n as createMonorepoVitestProjectConfig, o as createMonorepoEslintConfig, r as defineVitestConfig, s as createMonorepoStylelintConfig, t as createMonorepoVitestConfig, u as defineStylelintConfig } from "./vitest-Blzbh8xZ.mjs";
|
|
6
7
|
export { GitClient, GitHubApiError, GitHubClient, assetsDir, checkTemplates, cleanProjects, clearWorkspaceCache, cliName, collectEnvInfo, collectEnvPaths, collectEnvSnapshot, collectEnvSupportBundle, configExtensions, copy, createContext, createMonorepoCommitlintConfig, createMonorepoEslintConfig, createMonorepoLintStagedConfig, createMonorepoStylelintConfig, createMonorepoTsconfig, createMonorepoVitestConfig, createMonorepoVitestProjectConfig, createNewProject, createReleasePullRequest, createTimestampFolderName, defaultAgenticBaseDir, defineCommitlintConfig, defineEslintConfig, defineLintStagedConfig, defineMonorepoConfig, defineStylelintConfig, defineTsconfigConfig, defineVitestConfig, defineVitestProjectConfig, ensureDir, ensureFile, enterPrerelease, escapeStringRegexp, exists, exitPrerelease, generateAgenticTemplate, generateAgenticTemplates, getCreateChoices, getFileHash, getKnownRepoCheckCommands, getRepoctlConfigCandidates, getSkillTargetPaths, getTemplateMap, getWorkspaceData, getWorkspacePackageSummaries, getWorkspacePackages, init, initMetadata, initTooling, initToolingTargets, inspectMonorepoConfig, isFileChanged, isGitignoreFile, isIgnorableFsError, isMatch, loadAgenticTasks, loadMonorepoConfig, loadMonorepoConfigDetails, loadMonorepoToolingConfig, logger, normalizeInitToolingTargets, outputFile, outputJSON, outputJson, packageDir, name as packageName, parsePublishSummary, pathExists, prepareStable, publishStable, readJSON, readJson, reconcileRelease, recoverUnpublished, releaseCi, releasePrerelease, releaseStable, remove, repairReleaseNotes, resolveCommandConfig, resolveCreateNewProjectPlan, resolveFullWorkspaceCheckPlan, resolveRecommendedCheckPlan, resolveToolingConfig, rootDir, runDoctor, runRecommendedCheck, setByPath, setVscodeBinaryMirror, skillTargets, syncSkills, templateMap, templatesDir, toPublishGitignorePath, toWorkspaceAssetPath, toWorkspaceGitignorePath, updateIssueTemplateConfig, upgradeMonorepo, verifyCommitMsg, verifyPreCommit, verifyPrePush, verifyStagedTypecheck, version, writeJSON, writeJson };
|
package/dist/tooling-entry.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as MonorepoVitestProjectConfigResult, C as MonorepoLintStagedConfigOptions, D as MonorepoVitestConfigOverrides, E as MonorepoVitestConfigOptions, O as MonorepoVitestConfigResult, S as MonorepoLintStagedConfig, T as MonorepoTsconfig, _ as DefineEslintConfigOptions, a as createMonorepoTsconfig, b as MonorepoCommitlintConfig, c as createMonorepoCommitlintConfig, d as defineCommitlintConfig, f as defineEslintConfig, g as DefineConfigOptions, h as defineLintStagedConfig, i as defineVitestProjectConfig, k as MonorepoVitestProjectConfigOptions, l as createMonorepoEslintConfig, m as createMonorepoLintStagedConfig, n as createMonorepoVitestProjectConfig, o as defineTsconfigConfig, p as defineStylelintConfig, r as defineVitestConfig, s as loadMonorepoToolingConfig, t as createMonorepoVitestConfig, u as createMonorepoStylelintConfig, v as DefineVitestConfigOptions, w as MonorepoStylelintConfig, x as MonorepoEslintConfig, y as DefineVitestProjectConfigOptions } from "./index-Bl_PB2Ch.mjs";
|
|
2
2
|
export { DefineConfigOptions, DefineEslintConfigOptions, DefineVitestConfigOptions, DefineVitestProjectConfigOptions, MonorepoCommitlintConfig, MonorepoEslintConfig, MonorepoLintStagedConfig, MonorepoLintStagedConfigOptions, MonorepoStylelintConfig, MonorepoTsconfig, MonorepoVitestConfigOptions, MonorepoVitestConfigOverrides, MonorepoVitestConfigResult, MonorepoVitestProjectConfigOptions, MonorepoVitestProjectConfigResult, createMonorepoCommitlintConfig, createMonorepoEslintConfig, createMonorepoLintStagedConfig, createMonorepoStylelintConfig, createMonorepoTsconfig, createMonorepoVitestConfig, createMonorepoVitestProjectConfig, defineCommitlintConfig, defineEslintConfig, defineLintStagedConfig, defineStylelintConfig, defineTsconfigConfig, defineVitestConfig, defineVitestProjectConfig, loadMonorepoToolingConfig };
|
package/dist/tooling-entry.mjs
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as loadMonorepoToolingConfig, n as defineTsconfigConfig, t as createMonorepoTsconfig } from "./tsconfig-BrjI_5yI.mjs";
|
|
2
|
+
import { a as createMonorepoCommitlintConfig, c as defineCommitlintConfig, d as createMonorepoLintStagedConfig, f as defineLintStagedConfig, i as defineVitestProjectConfig, l as defineEslintConfig, n as createMonorepoVitestProjectConfig, o as createMonorepoEslintConfig, r as defineVitestConfig, s as createMonorepoStylelintConfig, t as createMonorepoVitestConfig, u as defineStylelintConfig } from "./vitest-Blzbh8xZ.mjs";
|
|
2
3
|
export { createMonorepoCommitlintConfig, createMonorepoEslintConfig, createMonorepoLintStagedConfig, createMonorepoStylelintConfig, createMonorepoTsconfig, createMonorepoVitestConfig, createMonorepoVitestProjectConfig, defineCommitlintConfig, defineEslintConfig, defineLintStagedConfig, defineStylelintConfig, defineTsconfigConfig, defineVitestConfig, defineVitestProjectConfig, loadMonorepoToolingConfig };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { a as loadMonorepoConfig } from "./config-p842Knhq.mjs";
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { parse } from "comment-json";
|
|
6
|
+
//#region src/tooling/shared.ts
|
|
7
|
+
/**
|
|
8
|
+
* 读取当前工作目录下的 `repoctl.config.*` 中 `tooling` 配置块。
|
|
9
|
+
*
|
|
10
|
+
* @param cwd 配置文件解析起点。默认使用 `process.cwd()`
|
|
11
|
+
* @returns 标准化后的 tooling 配置;未配置时返回空对象
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { loadMonorepoToolingConfig } from 'repoctl/tooling'
|
|
16
|
+
*
|
|
17
|
+
* const tooling = await loadMonorepoToolingConfig()
|
|
18
|
+
* console.log(tooling.vitest?.includeWorkspaceRootConfig)
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
async function loadMonorepoToolingConfig(cwd = process.cwd()) {
|
|
22
|
+
return (await loadMonorepoConfig(cwd)).tooling ?? {};
|
|
23
|
+
}
|
|
24
|
+
async function loadToolingSection(key, cwd = process.cwd()) {
|
|
25
|
+
return (await loadMonorepoToolingConfig(cwd))[key];
|
|
26
|
+
}
|
|
27
|
+
function resolveConfigInput(input) {
|
|
28
|
+
return {
|
|
29
|
+
cwd: input?.cwd ?? process.cwd(),
|
|
30
|
+
options: input?.options
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function isDefineConfigWrapper(input) {
|
|
34
|
+
if (input === null || typeof input !== "object" || Array.isArray(input)) return false;
|
|
35
|
+
return "cwd" in input || "options" in input;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/tooling/tsconfig.ts
|
|
39
|
+
const monorepoTsconfigPath = fileURLToPath(import.meta.resolve("@icebreakers/monorepo/tsconfig"));
|
|
40
|
+
function mergeTsconfig(base, override) {
|
|
41
|
+
if (!override) return base;
|
|
42
|
+
return {
|
|
43
|
+
...base,
|
|
44
|
+
...override,
|
|
45
|
+
...base.compilerOptions || override.compilerOptions ? { compilerOptions: {
|
|
46
|
+
...base.compilerOptions ?? {},
|
|
47
|
+
...override.compilerOptions ?? {}
|
|
48
|
+
} } : {}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function loadBundledTsconfig() {
|
|
52
|
+
const configContent = fs.readFileSync(monorepoTsconfigPath, "utf8");
|
|
53
|
+
return parse(configContent);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* 创建 monorepo 内置的 TypeScript 基线配置。
|
|
57
|
+
*
|
|
58
|
+
* @param options 额外覆盖项,会与包内置 `tsconfig.base.json` 合并
|
|
59
|
+
* @returns 可直接写入或二次扩展的 `tsconfig.json` 配置对象
|
|
60
|
+
*/
|
|
61
|
+
function createMonorepoTsconfig(options = {}) {
|
|
62
|
+
return mergeTsconfig(loadBundledTsconfig(), options);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 从 `repoctl.config.ts` 读取 `tooling.tsconfig`,并生成最终的 TypeScript 配置对象。
|
|
66
|
+
*
|
|
67
|
+
* @param input `cwd` 用于指定配置文件解析起点,`options` 用于追加运行时覆盖项
|
|
68
|
+
* @returns 可直接写入或导出的 `tsconfig.json` 配置对象
|
|
69
|
+
*/
|
|
70
|
+
async function defineTsconfigConfig(input = {}) {
|
|
71
|
+
const resolved = resolveConfigInput(input);
|
|
72
|
+
return createMonorepoTsconfig(mergeTsconfig(await loadToolingSection("tsconfig", resolved.cwd) ?? {}, resolved.options));
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { loadToolingSection as a, loadMonorepoToolingConfig as i, defineTsconfigConfig as n, resolveConfigInput as o, isDefineConfigWrapper as r, createMonorepoTsconfig as t };
|
|
@@ -343,7 +343,7 @@ function message(key, values = {}) {
|
|
|
343
343
|
//#endregion
|
|
344
344
|
//#region package.json
|
|
345
345
|
var name = "@icebreakers/monorepo";
|
|
346
|
-
var version = "5.
|
|
346
|
+
var version = "5.6.0";
|
|
347
347
|
var package_default = {
|
|
348
348
|
name,
|
|
349
349
|
type: "module",
|
|
@@ -428,7 +428,7 @@ var package_default = {
|
|
|
428
428
|
"@pnpm/find-workspace-dir": "^1000.1.5",
|
|
429
429
|
"@pnpm/logger": "^1100.0.0",
|
|
430
430
|
"@pnpm/types": "^1102.1.1",
|
|
431
|
-
"@pnpm/worker": "^1100.4.
|
|
431
|
+
"@pnpm/worker": "^1100.4.6",
|
|
432
432
|
"@pnpm/workspace.find-packages": "^1000.0.65",
|
|
433
433
|
"@pnpm/workspace.read-manifest": "^1000.3.1",
|
|
434
434
|
"c12": "^3.3.4",
|