@icebreakers/monorepo-templates 1.1.0 → 1.2.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/README.md +12 -8
- package/README.zh-CN.md +16 -0
- package/assets/.changeset/ledger.yaml +25 -0
- package/assets/.github/ISSUE_TEMPLATE/config.yml +1 -1
- package/assets/AGENTS.md +4 -3
- package/assets/CONTRIBUTING.md +27 -2
- package/assets/SECURITY.md +12 -14
- package/assets/package.json +13 -4
- package/package.json +6 -4
- package/templates/cli/package.json +11 -4
- package/templates/client/package.json +17 -1
- package/templates/server/package.json +11 -4
- package/templates/tsdown/package.json +11 -4
- package/templates/vitepress/.vitepress/config.ts +146 -165
- package/templates/vitepress/ai/index.md +12 -23
- package/templates/vitepress/ai/llms-txt.md +13 -31
- package/templates/vitepress/getting-started.md +3 -32
- package/templates/vitepress/index.md +27 -30
- package/templates/vitepress/knowledge/index.md +17 -41
- package/templates/vitepress/monorepo/commands.md +13 -18
- package/templates/vitepress/monorepo/index.md +22 -100
- package/templates/vitepress/monorepo/manage.md +15 -227
- package/templates/vitepress/monorepo/publish.md +15 -70
- package/templates/vitepress/monorepo/templates.md +10 -17
- package/templates/vitepress/monorepo/troubleshooting.md +13 -16
- package/templates/vitepress/package.json +10 -4
- package/templates/vitepress/public/_redirects +3 -0
- package/templates/vitepress/repoctl/adopt-existing.md +51 -53
- package/templates/vitepress/repoctl/aliases.md +18 -18
- package/templates/vitepress/repoctl/checks.md +21 -68
- package/templates/vitepress/repoctl/commands.md +16 -64
- package/templates/vitepress/repoctl/config.md +14 -35
- package/templates/vitepress/repoctl/doctor.md +20 -60
- package/templates/vitepress/repoctl/execution-model.md +16 -69
- package/templates/vitepress/repoctl/getting-started.md +34 -40
- package/templates/vitepress/repoctl/index.md +33 -61
- package/templates/vitepress/repoctl/reports.md +20 -74
- package/templates/vitepress/repoctl/scenarios.md +26 -28
- package/templates/vitepress/repoctl/template-assets.md +19 -88
- package/templates/vitepress/repoctl/templates.md +50 -81
- package/templates/vitepress/repoctl/troubleshooting.md +32 -46
- package/templates/vitepress/repoctl/workflows.md +38 -67
- package/templates/vitepress/thinking.md +4 -85
- package/templates/vitepress/tools/changeset.md +9 -59
- package/templates/vitepress/tools/husky.md +6 -124
- package/templates/vitepress/tools/index.md +13 -32
- package/templates/vitepress/tools/lint-staged.md +5 -96
- package/templates/vitepress/tools/llms-txt.md +4 -6
- package/templates/vitepress/tools/pnpm.md +7 -119
- package/templates/vitepress/tools/renovate.md +3 -87
- package/templates/vitepress/tools/turborepo.md +5 -157
- package/templates/vitepress/why/how-to-reuse-js-code.md +6 -247
- package/templates/vitepress/why/index.md +14 -1
- package/templates/vitepress/why/js-cjs-mjs.md +9 -96
- package/templates/vitepress/why/js-keywords.md +4 -129
- package/templates/vitepress/why/modern/bundlers.md +3 -50
- package/templates/vitepress/why/modern/dts.md +4 -90
- package/templates/vitepress/why/modern/esm-vs-cjs.md +4 -81
- package/templates/vitepress/why/modern/index.md +10 -51
- package/templates/vitepress/why/modern/package-entry-points.md +6 -117
- package/templates/vitepress/why/modern/typescript.md +4 -152
- package/templates/vitepress/why/publish-basic-npm-package.md +17 -144
- package/templates/vitepress/why/what-is-npm-package.md +4 -159
- package/templates/vitepress/zh/ai/index.md +33 -0
- package/templates/vitepress/zh/ai/llms-txt.md +42 -0
- package/templates/vitepress/zh/getting-started.md +40 -0
- package/templates/vitepress/zh/index.md +66 -0
- package/templates/vitepress/zh/knowledge/index.md +50 -0
- package/templates/vitepress/zh/monorepo/commands.md +21 -0
- package/templates/vitepress/zh/monorepo/index.md +115 -0
- package/templates/vitepress/zh/monorepo/manage.md +243 -0
- package/templates/vitepress/zh/monorepo/publish.md +87 -0
- package/templates/vitepress/zh/monorepo/templates.md +21 -0
- package/templates/vitepress/zh/monorepo/troubleshooting.md +20 -0
- package/templates/vitepress/zh/repoctl/adopt-existing.md +135 -0
- package/templates/vitepress/{en → zh}/repoctl/aliases.md +18 -18
- package/templates/vitepress/zh/repoctl/checks.md +86 -0
- package/templates/vitepress/zh/repoctl/commands.md +168 -0
- package/templates/vitepress/zh/repoctl/config.md +90 -0
- package/templates/vitepress/zh/repoctl/doctor.md +86 -0
- package/templates/vitepress/zh/repoctl/execution-model.md +81 -0
- package/templates/vitepress/zh/repoctl/getting-started.md +122 -0
- package/templates/vitepress/zh/repoctl/index.md +102 -0
- package/templates/vitepress/zh/repoctl/reports.md +94 -0
- package/templates/vitepress/{en → zh}/repoctl/scenarios.md +28 -26
- package/templates/vitepress/zh/repoctl/template-assets.md +116 -0
- package/templates/vitepress/zh/repoctl/templates.md +159 -0
- package/templates/vitepress/zh/repoctl/troubleshooting.md +110 -0
- package/templates/vitepress/zh/repoctl/workflows.md +118 -0
- package/templates/vitepress/zh/thinking.md +88 -0
- package/templates/vitepress/zh/tools/changeset.md +75 -0
- package/templates/vitepress/zh/tools/husky.md +130 -0
- package/templates/vitepress/zh/tools/index.md +38 -0
- package/templates/vitepress/zh/tools/lint-staged.md +103 -0
- package/templates/vitepress/zh/tools/llms-txt.md +9 -0
- package/templates/vitepress/zh/tools/pnpm.md +127 -0
- package/templates/vitepress/zh/tools/renovate.md +91 -0
- package/templates/vitepress/zh/tools/turborepo.md +166 -0
- package/templates/vitepress/zh/why/assets/npm-dt.svg +15 -0
- package/templates/vitepress/zh/why/assets/npm-ts.svg +19 -0
- package/templates/vitepress/zh/why/examples/0.npm-basic-package/index.js +10 -0
- package/templates/vitepress/zh/why/examples/0.npm-basic-package/package.json +11 -0
- package/templates/vitepress/zh/why/examples/1.npm-basic-package/index.cjs +12 -0
- package/templates/vitepress/zh/why/examples/1.npm-basic-package/index.d.ts +1 -0
- package/templates/vitepress/zh/why/examples/1.npm-basic-package/index.js +8 -0
- package/templates/vitepress/zh/why/examples/1.npm-basic-package/package.json +19 -0
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/README.md +1 -0
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/package-lock.json +30 -0
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/package.json +35 -0
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/rename-ext.js +24 -0
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/src/index.ts +8 -0
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/tsconfig.cjs.json +8 -0
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/tsconfig.esm.json +7 -0
- package/templates/vitepress/zh/why/examples/2.npm-basic-package/tsconfig.json +18 -0
- package/templates/vitepress/zh/why/examples/3.npm-basic-package/README.md +1 -0
- package/templates/vitepress/zh/why/examples/3.npm-basic-package/package-lock.json +1496 -0
- package/templates/vitepress/zh/why/examples/3.npm-basic-package/package.json +31 -0
- package/templates/vitepress/zh/why/examples/3.npm-basic-package/src/index.ts +8 -0
- package/templates/vitepress/zh/why/examples/3.npm-basic-package/tsconfig.json +16 -0
- package/templates/vitepress/zh/why/examples/3.npm-basic-package/tsdown.config.ts +16 -0
- package/templates/vitepress/zh/why/examples/usage-cjs/cjs.cjs +4 -0
- package/templates/vitepress/zh/why/examples/usage-cjs/esm.mjs +4 -0
- package/templates/vitepress/zh/why/examples/usage-cjs/index.js +8 -0
- package/templates/vitepress/zh/why/examples/usage-cjs/package-lock.json +36 -0
- package/templates/vitepress/zh/why/examples/usage-cjs/package.json +20 -0
- package/templates/vitepress/zh/why/examples/usage-esm/cjs.cjs +4 -0
- package/templates/vitepress/zh/why/examples/usage-esm/createRequire.js +7 -0
- package/templates/vitepress/zh/why/examples/usage-esm/esm.mjs +4 -0
- package/templates/vitepress/zh/why/examples/usage-esm/index.js +8 -0
- package/templates/vitepress/zh/why/examples/usage-esm/package-lock.json +36 -0
- package/templates/vitepress/zh/why/examples/usage-esm/package.json +21 -0
- package/templates/vitepress/zh/why/how-to-reuse-js-code.md +250 -0
- package/templates/vitepress/zh/why/index.md +1 -0
- package/templates/vitepress/zh/why/js-cjs-mjs.md +99 -0
- package/templates/vitepress/zh/why/js-keywords.md +132 -0
- package/templates/vitepress/zh/why/modern/bundlers.md +52 -0
- package/templates/vitepress/zh/why/modern/dts.md +93 -0
- package/templates/vitepress/zh/why/modern/esm-vs-cjs.md +84 -0
- package/templates/vitepress/zh/why/modern/index.md +55 -0
- package/templates/vitepress/zh/why/modern/package-entry-points.md +128 -0
- package/templates/vitepress/zh/why/modern/typescript.md +155 -0
- package/templates/vitepress/zh/why/publish-basic-npm-package.md +146 -0
- package/templates/vitepress/zh/why/what-is-npm-package.md +162 -0
- package/templates/vue-lib/package.json +12 -5
- package/templates/vitepress/en/index.md +0 -63
- package/templates/vitepress/en/knowledge/monorepo.md +0 -37
- package/templates/vitepress/en/repoctl/adopt-existing.md +0 -133
- package/templates/vitepress/en/repoctl/commands.md +0 -120
- package/templates/vitepress/en/repoctl/config.md +0 -69
- package/templates/vitepress/en/repoctl/getting-started.md +0 -116
- package/templates/vitepress/en/repoctl/index.md +0 -74
- package/templates/vitepress/en/repoctl/templates.md +0 -128
- package/templates/vitepress/en/repoctl/troubleshooting.md +0 -96
- package/templates/vitepress/en/repoctl/workflows.md +0 -89
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Choose By Scenario
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Start here when you know what you want to do, but not which repoctl command to use.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## I Just Opened A Repository
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
pnpm install
|
|
9
9
|
pnpm run repo:doctor
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
If the `repo:*` scripts do not exist yet:
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
pnpm add -D repoctl
|
|
@@ -17,9 +17,9 @@ pnpm exec repo init --yes
|
|
|
17
17
|
pnpm exec repo doctor
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Keep reading: [Getting Started](./getting-started.md).
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## I Want To Adopt repoctl In An Existing Repo
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
pnpm add -D repoctl
|
|
@@ -29,9 +29,9 @@ pnpm exec repo upgrade --no-overwrite
|
|
|
29
29
|
pnpm exec repo doctor --markdown --redact --out reports/doctor-after.md
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Keep reading: [Adopt Existing Repositories](./adopt-existing.md).
|
|
33
33
|
|
|
34
|
-
##
|
|
34
|
+
## I Want To Create A Package Or App
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
37
|
pnpm exec repo templates
|
|
@@ -39,15 +39,15 @@ pnpm exec repo new sdk --template tsdown
|
|
|
39
39
|
pnpm exec repo new docs --template vitepress --dry-run
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
For daily development, root scripts also work:
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
45
|
pnpm run repo:new -- sdk --template tsdown
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
Keep reading: [Templates](./templates.md).
|
|
49
49
|
|
|
50
|
-
##
|
|
50
|
+
## I Want To Check Before Committing
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
53
|
pnpm run repo:check
|
|
@@ -55,16 +55,16 @@ pnpm exec repo check --dry-run
|
|
|
55
55
|
pnpm exec repo check --full
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
Save the plan when automation needs it:
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
61
|
pnpm exec repo check --json --out reports/check-plan.json
|
|
62
62
|
pnpm exec repo check --markdown --redact --out reports/check-plan.md
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
Keep reading: [Workflows and CI](./workflows.md).
|
|
66
66
|
|
|
67
|
-
##
|
|
67
|
+
## I Want To Debug CI Or Another Machine
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
70
|
pnpm exec repo doctor --markdown --redact --out reports/doctor.md
|
|
@@ -72,9 +72,9 @@ pnpm exec repo env support --markdown --redact --out reports/support.md
|
|
|
72
72
|
pnpm exec repo env snapshot --json --out reports/snapshot.json
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
Keep reading: [Troubleshooting](./troubleshooting.md).
|
|
76
76
|
|
|
77
|
-
##
|
|
77
|
+
## I Want To Sync Standard Assets
|
|
78
78
|
|
|
79
79
|
```bash
|
|
80
80
|
pnpm exec repo upgrade --no-overwrite
|
|
@@ -82,15 +82,13 @@ pnpm exec repo upgrade --yes
|
|
|
82
82
|
pnpm exec repo upgrade --core
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
| Goal | Command |
|
|
86
|
+
| ------------------------------------------ | ----------------------------- |
|
|
87
|
+
| First adoption pass, preserve local config | `repo upgrade --no-overwrite` |
|
|
88
|
+
| Explicitly overwrite managed assets | `repo upgrade --yes` |
|
|
89
|
+
| Sync only core config | `repo upgrade --core` |
|
|
86
90
|
|
|
87
|
-
|
|
88
|
-
| ------------------------ | ----------------------------- |
|
|
89
|
-
| 第一次接入,保留已有配置 | `repo upgrade --no-overwrite` |
|
|
90
|
-
| 明确要覆盖标准资产 | `repo upgrade --yes` |
|
|
91
|
-
| 只同步核心配置 | `repo upgrade --core` |
|
|
92
|
-
|
|
93
|
-
## 我要看 workspace 结构
|
|
91
|
+
## I Want To Inspect Workspace Structure
|
|
94
92
|
|
|
95
93
|
```bash
|
|
96
94
|
pnpm exec repo ws ls
|
|
@@ -98,16 +96,16 @@ pnpm exec repo ws ls --json --out reports/workspaces.json
|
|
|
98
96
|
pnpm exec repo ws ls --markdown --redact --out reports/workspaces.md
|
|
99
97
|
```
|
|
100
98
|
|
|
101
|
-
##
|
|
99
|
+
## I Want To Inspect Config
|
|
102
100
|
|
|
103
101
|
```bash
|
|
104
102
|
pnpm exec repo config inspect
|
|
105
103
|
pnpm exec repo cfg i --json --out reports/config.json
|
|
106
104
|
```
|
|
107
105
|
|
|
108
|
-
|
|
106
|
+
Keep reading: [Configuration](./config.md).
|
|
109
107
|
|
|
110
|
-
##
|
|
108
|
+
## I Want Shorter Commands
|
|
111
109
|
|
|
112
110
|
```bash
|
|
113
111
|
repo tpl
|
|
@@ -116,4 +114,4 @@ repo e support --markdown --redact
|
|
|
116
114
|
repo cfg i
|
|
117
115
|
```
|
|
118
116
|
|
|
119
|
-
|
|
117
|
+
Keep reading: [Command Aliases](./aliases.md).
|
|
@@ -1,116 +1,47 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
outline: deep
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
#
|
|
5
|
+
# Template Asset Management
|
|
6
6
|
|
|
7
|
-
repoctl
|
|
7
|
+
Templates are one repoctl capability. `@icebreakers/monorepo-templates` packages built-in project templates and managed repository assets; templates under `templates/*` are private source workspaces and are not published independently.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Built-In Mapping
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
| ------------- | --------------------- | ------------------ | --------------------- |
|
|
13
|
-
| `tsdown` | `templates/tsdown` | `packages/tsdown` | TypeScript library |
|
|
14
|
-
| `vue-lib` | `templates/vue-lib` | `packages/vue-lib` | Vue component library |
|
|
15
|
-
| `hono-server` | `templates/server` | `apps/server` | Hono service |
|
|
16
|
-
| `vue-hono` | `templates/client` | `apps/client` | Vue + Hono app |
|
|
17
|
-
| `vitepress` | `templates/vitepress` | `apps/website` | docs site |
|
|
18
|
-
| `cli` | `templates/cli` | `apps/cli` | command line tool |
|
|
19
|
-
|
|
20
|
-
查看实际可用模板:
|
|
11
|
+
Template metadata defines a stable key, category, source directory, default target, and description. The CLI, create commands, and documentation consume the same registry.
|
|
21
12
|
|
|
22
13
|
```bash
|
|
23
14
|
repo templates
|
|
24
|
-
repo templates
|
|
25
|
-
repo templates --
|
|
15
|
+
repo templates tsdown
|
|
16
|
+
repo templates --category library
|
|
26
17
|
```
|
|
27
18
|
|
|
28
|
-
##
|
|
29
|
-
|
|
30
|
-
`repo new` 会先解析创建计划,再决定是否写入文件。计划包含:
|
|
31
|
-
|
|
32
|
-
| 字段 | 含义 |
|
|
33
|
-
| ------------------- | ------------------------------------------------ |
|
|
34
|
-
| `requestedTemplate` | 用户请求的模板 key |
|
|
35
|
-
| `template` | 实际使用的模板 key |
|
|
36
|
-
| `sourceDir` | 模板源目录 |
|
|
37
|
-
| `targetDir` | 输出目录 |
|
|
38
|
-
| `targetExists` | 目标目录是否已存在 |
|
|
39
|
-
| `packageName` | 写入 package.json 的包名 |
|
|
40
|
-
| `renameJson` | 是否把 `package.json` 输出为 `package.mock.json` |
|
|
41
|
-
|
|
42
|
-
预览创建:
|
|
19
|
+
## Creation Plans
|
|
43
20
|
|
|
44
21
|
```bash
|
|
45
|
-
repo new
|
|
22
|
+
repo new sdk --template tsdown --dry-run
|
|
46
23
|
repo new docs --template vitepress --json --out plans/docs.json
|
|
47
24
|
```
|
|
48
25
|
|
|
49
|
-
|
|
26
|
+
A plan records the selected template, source, destination, package name, workspace pattern, and whether fallback behavior was used. Unknown explicit keys fail with a suggestion.
|
|
50
27
|
|
|
51
|
-
##
|
|
52
|
-
|
|
53
|
-
显式传入 `--template` 时,repoctl 会先校验模板 key:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
repo new sdk --template tsdown
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
如果模板 key 拼错,命令会失败并提示相近 key。它不会静默回退到默认模板,这样 CI 和脚本不会生成错误类型的项目。
|
|
60
|
-
|
|
61
|
-
## 4. 健康检查
|
|
62
|
-
|
|
63
|
-
模板资产可以通过 `repo templates --check` 检查:
|
|
28
|
+
## Health Checks
|
|
64
29
|
|
|
65
30
|
```bash
|
|
66
31
|
repo templates --check
|
|
67
|
-
repo templates --check --json
|
|
32
|
+
repo templates --check --json
|
|
68
33
|
```
|
|
69
34
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
| 检查 | 目的 |
|
|
73
|
-
| -------------- | ------------------------------------ |
|
|
74
|
-
| source 唯一性 | 避免多个模板 key 指向同一源目录 |
|
|
75
|
-
| target 唯一性 | 避免多个模板默认写到同一目标目录 |
|
|
76
|
-
| source 目录 | 确认模板目录存在 |
|
|
77
|
-
| package.json | 确认模板根目录包含包元数据 |
|
|
78
|
-
| metadata | 确认模板有 category 和 description |
|
|
79
|
-
| filtered files | 避免把临时、缓存或生成文件放入模板源 |
|
|
80
|
-
|
|
81
|
-
## 5. 自定义模板
|
|
82
|
-
|
|
83
|
-
可以在 `repoctl.config.ts` 里扩展模板映射:
|
|
84
|
-
|
|
85
|
-
```ts
|
|
86
|
-
import { defineMonorepoConfig } from 'repoctl'
|
|
87
|
-
|
|
88
|
-
export default defineMonorepoConfig({
|
|
89
|
-
commands: {
|
|
90
|
-
create: {
|
|
91
|
-
defaultTemplate: 'internal-service',
|
|
92
|
-
templateMap: {
|
|
93
|
-
'internal-service': {
|
|
94
|
-
source: 'templates/internal-service',
|
|
95
|
-
target: 'apps/internal-service',
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
})
|
|
101
|
-
```
|
|
35
|
+
Health checks validate unique sources and targets, source directories, package manifests, metadata, and filtered temporary files.
|
|
102
36
|
|
|
103
|
-
|
|
37
|
+
## Managed Assets
|
|
104
38
|
|
|
105
|
-
|
|
39
|
+
`repo init` and `repo upgrade` synchronize root scripts, configuration, hooks, and release assets. Existing custom files are preserved unless overwrite behavior is explicitly selected.
|
|
106
40
|
|
|
107
|
-
|
|
41
|
+
Repository maintainers refresh packaged copies with:
|
|
108
42
|
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
-> repo templates --check
|
|
112
|
-
-> repo new demo --template <name> --json --out plans/demo.json
|
|
113
|
-
-> 构建或测试生成后的 workspace
|
|
43
|
+
```bash
|
|
44
|
+
pnpm --filter @icebreakers/monorepo-templates sync:assets
|
|
114
45
|
```
|
|
115
46
|
|
|
116
|
-
|
|
47
|
+
Generated copies should never be edited by hand.
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Templates
|
|
2
2
|
|
|
3
|
-
repoctl
|
|
3
|
+
repoctl templates are maintained by `@icebreakers/monorepo-templates`. The CLI, scaffolder, and docs share the same template metadata.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Built-In Templates
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
| Key | Category | Default target | Use case |
|
|
8
|
+
| ------------- | -------- | ------------------ | ----------------------- |
|
|
9
|
+
| `tsdown` | library | `packages/tsdown` | TypeScript library |
|
|
10
|
+
| `vue-lib` | library | `packages/vue-lib` | Vue 3 component library |
|
|
11
|
+
| `vue-hono` | app | `apps/client` | Vue 3 + Hono app |
|
|
12
|
+
| `hono-server` | service | `apps/server` | Hono API service |
|
|
13
|
+
| `vitepress` | docs | `apps/website` | VitePress docs site |
|
|
14
|
+
| `cli` | tool | `apps/cli` | TypeScript CLI |
|
|
8
15
|
|
|
9
|
-
|
|
10
|
-
| ------------- | -------- | ------------------ | --------------------------- |
|
|
11
|
-
| `tsdown` | library | `packages/tsdown` | TypeScript 库包 |
|
|
12
|
-
| `vue-lib` | library | `packages/vue-lib` | Vue 3 组件库 |
|
|
13
|
-
| `vue-hono` | app | `apps/client` | Vue 3 + Hono 前后端一体应用 |
|
|
14
|
-
| `hono-server` | service | `apps/server` | Hono API 服务 |
|
|
15
|
-
| `vitepress` | docs | `apps/website` | VitePress 文档站 |
|
|
16
|
-
| `cli` | tool | `apps/cli` | TypeScript 命令行工具 |
|
|
17
|
-
|
|
18
|
-
## 查看模板
|
|
16
|
+
## Discover Templates
|
|
19
17
|
|
|
20
18
|
```bash
|
|
21
19
|
repo templates
|
|
@@ -25,7 +23,7 @@ repo templates --json
|
|
|
25
23
|
repo templates --markdown --out docs/templates.md
|
|
26
24
|
```
|
|
27
25
|
|
|
28
|
-
##
|
|
26
|
+
## Create From A Template
|
|
29
27
|
|
|
30
28
|
```bash
|
|
31
29
|
repo new sdk --template tsdown
|
|
@@ -35,72 +33,72 @@ repo new website --template vitepress
|
|
|
35
33
|
repo new toolbox --template cli
|
|
36
34
|
```
|
|
37
35
|
|
|
38
|
-
|
|
36
|
+
Simple names are placed in the conventional target folder. Library templates go under `packages/`; app templates go under `apps/`. If you pass an explicit path such as `packages/shared-utils`, repoctl respects it.
|
|
39
37
|
|
|
40
|
-
##
|
|
38
|
+
## Choose By Goal
|
|
41
39
|
|
|
42
|
-
###
|
|
40
|
+
### Publish an npm library
|
|
43
41
|
|
|
44
42
|
```bash
|
|
45
43
|
repo new sdk --template tsdown
|
|
46
44
|
```
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
Check first:
|
|
49
47
|
|
|
50
|
-
- `package.json`
|
|
51
|
-
- `tsdown.config.ts`
|
|
52
|
-
-
|
|
48
|
+
- `package.json` `name`, `exports`, and `types`.
|
|
49
|
+
- Whether `tsdown.config.ts` matches the desired output format.
|
|
50
|
+
- Whether public types need `tsd` tests.
|
|
53
51
|
|
|
54
|
-
###
|
|
52
|
+
### Build reusable Vue components
|
|
55
53
|
|
|
56
54
|
```bash
|
|
57
55
|
repo new ui --template vue-lib
|
|
58
56
|
```
|
|
59
57
|
|
|
60
|
-
|
|
58
|
+
Check first:
|
|
61
59
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
60
|
+
- Component entry points only expose stable APIs.
|
|
61
|
+
- Styles pass Stylelint.
|
|
62
|
+
- A docs site or example app should be created alongside it if needed.
|
|
65
63
|
|
|
66
|
-
###
|
|
64
|
+
### Create an app or service
|
|
67
65
|
|
|
68
66
|
```bash
|
|
69
67
|
repo new web --template vue-hono
|
|
70
68
|
repo new api --template hono-server
|
|
71
69
|
```
|
|
72
70
|
|
|
73
|
-
|
|
71
|
+
Check first:
|
|
74
72
|
|
|
75
|
-
-
|
|
76
|
-
- `dev
|
|
77
|
-
-
|
|
73
|
+
- Runtime environment variables and deployment constraints.
|
|
74
|
+
- `dev`, `build`, and `typecheck` scripts are part of root tasks.
|
|
75
|
+
- CI needs integration or E2E tests.
|
|
78
76
|
|
|
79
|
-
###
|
|
77
|
+
### Create a docs site
|
|
80
78
|
|
|
81
79
|
```bash
|
|
82
80
|
repo new docs --template vitepress
|
|
83
81
|
```
|
|
84
82
|
|
|
85
|
-
|
|
83
|
+
Check first:
|
|
86
84
|
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
85
|
+
- Nav and sidebar are organized around the product or package.
|
|
86
|
+
- A second locale is required.
|
|
87
|
+
- `repo templates --markdown` output should be written into docs.
|
|
90
88
|
|
|
91
|
-
###
|
|
89
|
+
### Create a CLI
|
|
92
90
|
|
|
93
91
|
```bash
|
|
94
92
|
repo new toolbox --template cli
|
|
95
93
|
```
|
|
96
94
|
|
|
97
|
-
|
|
95
|
+
Check first:
|
|
98
96
|
|
|
99
|
-
- `bin`
|
|
100
|
-
-
|
|
101
|
-
-
|
|
97
|
+
- The `bin` field matches the final command name.
|
|
98
|
+
- Argument parsing, exit codes, and help output are testable.
|
|
99
|
+
- README documents command usage.
|
|
102
100
|
|
|
103
|
-
##
|
|
101
|
+
## Preview Creation
|
|
104
102
|
|
|
105
103
|
```bash
|
|
106
104
|
repo new website --template vitepress --dry-run
|
|
@@ -108,52 +106,23 @@ repo new website --template vitepress --json
|
|
|
108
106
|
repo new website --template vitepress --json --out plans/website.json
|
|
109
107
|
```
|
|
110
108
|
|
|
111
|
-
`--dry-run`
|
|
112
|
-
|
|
113
|
-
`--json` 输出同一份创建计划的结构化数据,隐含 `--dry-run`。
|
|
114
|
-
|
|
115
|
-
`--out <file>` 可以把文本或 JSON 预览写入文件,也隐含 `--dry-run`。
|
|
109
|
+
`--dry-run` does not write files. It shows the template, source directory, target directory, package name, and output files.
|
|
116
110
|
|
|
117
|
-
|
|
111
|
+
`--json` emits the same plan as structured data and implies `--dry-run`.
|
|
118
112
|
|
|
119
|
-
|
|
120
|
-
import { defineMonorepoConfig } from 'repoctl'
|
|
113
|
+
`--out <file>` persists the preview and also implies `--dry-run`.
|
|
121
114
|
|
|
122
|
-
|
|
123
|
-
commands: {
|
|
124
|
-
create: {
|
|
125
|
-
defaultTemplate: 'tsdown',
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
})
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
之后:
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
repo new utils
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
会直接创建 `tsdown` 库包。
|
|
138
|
-
|
|
139
|
-
## 检查模板健康状态
|
|
115
|
+
## Check Template Health
|
|
140
116
|
|
|
141
117
|
```bash
|
|
142
118
|
repo templates --check
|
|
143
119
|
repo templates --check --json
|
|
144
120
|
```
|
|
145
121
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
- 模板 source 和 target 没有重复。
|
|
149
|
-
- 每个模板 source 目录都存在。
|
|
150
|
-
- 每个模板根目录都有 `package.json`。
|
|
151
|
-
- 每个模板都有 category 和 description。
|
|
152
|
-
- 模板源目录里没有会被脚手架过滤掉的临时或生成文件。
|
|
122
|
+
The check validates duplicate sources and targets, existing source directories, package metadata, categories, descriptions, and temporary files that would be filtered by the scaffolder.
|
|
153
123
|
|
|
154
|
-
##
|
|
124
|
+
## Keep Reading
|
|
155
125
|
|
|
156
|
-
- [
|
|
157
|
-
- [
|
|
158
|
-
- [
|
|
159
|
-
- [模板资产治理](./template-assets.md)
|
|
126
|
+
- [Adopt Existing Repositories](./adopt-existing.md)
|
|
127
|
+
- [Workflows and CI](./workflows.md)
|
|
128
|
+
- [Configuration](./config.md)
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Troubleshooting
|
|
2
2
|
|
|
3
|
-
repoctl
|
|
3
|
+
repoctl focuses on reports that can be reproduced, saved, and shared.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Start With Doctor
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
repo doctor
|
|
9
9
|
repo doctor --strict
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
`doctor`
|
|
12
|
+
`doctor` checks:
|
|
13
13
|
|
|
14
|
-
-
|
|
15
|
-
- Node
|
|
16
|
-
- `pnpm-workspace.yaml
|
|
17
|
-
- `repoctl`
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
- Husky
|
|
14
|
+
- Current directory and repository root.
|
|
15
|
+
- Node.js version.
|
|
16
|
+
- `pnpm-workspace.yaml`.
|
|
17
|
+
- The `repoctl` CLI dependency.
|
|
18
|
+
- Recommended root scripts.
|
|
19
|
+
- Conflicting config files.
|
|
20
|
+
- Husky and lint-staged wiring.
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## Save A Diagnostic Report
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
repo doctor --json --out reports/doctor.json
|
|
26
26
|
repo doctor --markdown --redact --out reports/doctor.md
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
Markdown reports are useful in issues and PRs. `--redact` removes local absolute paths.
|
|
30
30
|
|
|
31
|
-
##
|
|
31
|
+
## Inspect The Verification Plan
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
34
|
repo check --dry-run
|
|
@@ -36,9 +36,9 @@ repo check --json --out reports/check-plan.json
|
|
|
36
36
|
repo check --markdown --redact --out reports/check-plan.md
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Use this when you need to understand why a file triggers a workspace typecheck or which tasks pre-push would run.
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## Collect Environment Information
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
44
|
repo env info
|
|
@@ -47,51 +47,41 @@ repo env snapshot --json --out reports/snapshot.json
|
|
|
47
47
|
repo env paths --markdown --redact --out reports/paths.md
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
These commands help compare local, CI, Git, Node, pnpm, and workspace differences.
|
|
51
51
|
|
|
52
|
-
##
|
|
52
|
+
## Common Fixes
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
| ------------------------------ | ----------------------------------------- | ------------------------------------ |
|
|
56
|
-
| 不确定当前目录是不是仓库根目录 | `repo doctor` | [doctor 诊断](./doctor.md) |
|
|
57
|
-
| 不知道 `repo check` 会跑什么 | `repo check --dry-run` | [校验链路](./checks.md) |
|
|
58
|
-
| CI 失败但日志不完整 | `repo env support --markdown --redact` | [报告与自动化输出](./reports.md) |
|
|
59
|
-
| 模板创建结果不符合预期 | `repo new <name> --template <key> --json` | [模板资产治理](./template-assets.md) |
|
|
60
|
-
| 模板列表或元数据异常 | `repo templates --check` | [模板资产治理](./template-assets.md) |
|
|
54
|
+
### Not At Repository Root
|
|
61
55
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
### 当前目录不是仓库根目录
|
|
65
|
-
|
|
66
|
-
切回包含 `pnpm-workspace.yaml` 和根 `package.json` 的目录,再运行:
|
|
56
|
+
Change into the directory that contains `pnpm-workspace.yaml` and the root `package.json`, then run:
|
|
67
57
|
|
|
68
58
|
```bash
|
|
69
59
|
repo doctor
|
|
70
60
|
```
|
|
71
61
|
|
|
72
|
-
###
|
|
62
|
+
### Conflicting Config Files
|
|
73
63
|
|
|
74
|
-
|
|
64
|
+
Keep only:
|
|
75
65
|
|
|
76
66
|
```txt
|
|
77
67
|
repoctl.config.ts
|
|
78
68
|
```
|
|
79
69
|
|
|
80
|
-
`monorepo.config.ts`
|
|
70
|
+
`monorepo.config.ts` is no longer loaded at runtime; rename it to `repoctl.config.ts`.
|
|
81
71
|
|
|
82
|
-
###
|
|
72
|
+
### Unknown Template Key
|
|
83
73
|
|
|
84
|
-
|
|
74
|
+
List available templates:
|
|
85
75
|
|
|
86
76
|
```bash
|
|
87
77
|
repo templates
|
|
88
78
|
```
|
|
89
79
|
|
|
90
|
-
|
|
80
|
+
Explicit `--template` values are validated first. Invalid keys fail with suggestions.
|
|
91
81
|
|
|
92
|
-
###
|
|
82
|
+
### Automation Should Not Prompt
|
|
93
83
|
|
|
94
|
-
|
|
84
|
+
Use non-interactive options:
|
|
95
85
|
|
|
96
86
|
```bash
|
|
97
87
|
repo init --yes
|
|
@@ -99,12 +89,8 @@ repo upgrade --no-overwrite
|
|
|
99
89
|
repo check --json --out reports/check-plan.json
|
|
100
90
|
```
|
|
101
91
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
## 继续阅读
|
|
92
|
+
## Keep Reading
|
|
105
93
|
|
|
106
|
-
- [
|
|
107
|
-
- [
|
|
108
|
-
- [
|
|
109
|
-
- [报告与自动化输出](./reports.md)
|
|
110
|
-
- [命令别名](./aliases.md)
|
|
94
|
+
- [Workflows and CI](./workflows.md)
|
|
95
|
+
- [Command Reference](./commands.md)
|
|
96
|
+
- [Command Aliases](./aliases.md)
|