@icebreakers/monorepo-templates 1.0.15 → 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 +51 -0
- package/assets/.github/ISSUE_TEMPLATE/config.yml +1 -1
- package/assets/.github/workflows/release.yml +22 -97
- package/assets/AGENTS.md +5 -4
- package/assets/CONTRIBUTING.md +27 -2
- package/assets/SECURITY.md +12 -14
- package/assets/package.json +18 -10
- package/assets/pnpm-workspace.yaml +8 -0
- package/package.json +6 -4
- package/templates/cli/package.json +11 -4
- package/templates/client/package.json +22 -6
- package/templates/server/package.json +14 -7
- package/templates/server/vitest.config.ts +1 -4
- package/templates/tsdown/package.json +11 -4
- package/templates/tsdown/vitest.config.ts +1 -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 +17 -245
- package/templates/vitepress/monorepo/templates.md +10 -17
- package/templates/vitepress/monorepo/troubleshooting.md +13 -16
- package/templates/vitepress/package.json +11 -5
- 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 +12 -85
- 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/vue-lib/vitest.config.ts +1 -1
- package/assets/.changeset/config.json +0 -21
- package/assets/.changeset/publish-versioned-packages.md +0 -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,260 +1,32 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Publishing and Changelogs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
repoctl coordinates release tasks with pnpm versioning. It does not replace the registry, GitHub Actions, or package build scripts.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- 版本升级能自动联动内部依赖
|
|
7
|
-
- changelog 可以稳定产出
|
|
8
|
-
- 很容易接到 CI 里
|
|
9
|
-
|
|
10
|
-
repoctl 在发布流程里的位置很明确:它不替代 `changesets` 发布版本,而是在发布前帮你确认仓库状态、模板资产和校验计划。
|
|
11
|
-
|
|
12
|
-
## repoctl 在发布前做什么
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
pnpm exec repo doctor --strict
|
|
16
|
-
pnpm exec repo check --full
|
|
17
|
-
pnpm exec repo env support --markdown --redact --out reports/support.md
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
| 命令 | 发布前价值 |
|
|
21
|
-
| ---------------------- | -------------------------------------------------------- |
|
|
22
|
-
| `repo doctor --strict` | 确认仓库结构、Node、脚本、配置和提交链路没有漂移 |
|
|
23
|
-
| `repo check --full` | 跑根脚本里的 lint/typecheck/test/build 计划 |
|
|
24
|
-
| `repo env support` | 保存环境、配置、doctor 和 check plan,方便发布失败后回溯 |
|
|
25
|
-
|
|
26
|
-
发布本身仍交给 `changesets`:
|
|
5
|
+
## Development Flow
|
|
27
6
|
|
|
28
7
|
```bash
|
|
29
|
-
pnpm
|
|
30
|
-
pnpm
|
|
8
|
+
pnpm change
|
|
9
|
+
pnpm change status
|
|
10
|
+
repo release stable prepare
|
|
11
|
+
repo release stable publish
|
|
31
12
|
```
|
|
32
13
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## 一条务实的发布流程
|
|
14
|
+
Change intents record the affected package and release level. The release preparation step updates versions and repository changelogs; publish sends built packages to the configured registry.
|
|
36
15
|
|
|
37
|
-
|
|
16
|
+
## Versioning Configuration
|
|
38
17
|
|
|
39
|
-
|
|
40
|
-
2. 跑校验
|
|
41
|
-
3. 生成 changeset
|
|
42
|
-
4. 合并后 version / publish
|
|
18
|
+
Fixed groups and repository changelog storage live in `pnpm-workspace.yaml`. `repo doctor` reports missing or legacy release configuration.
|
|
43
19
|
|
|
44
|
-
|
|
20
|
+
## Prerelease Lanes
|
|
45
21
|
|
|
46
22
|
```bash
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
pnpm tsd
|
|
51
|
-
pnpm test
|
|
52
|
-
pnpm changeset
|
|
23
|
+
repo release pre enter beta
|
|
24
|
+
repo release pre publish
|
|
25
|
+
repo release pre exit
|
|
53
26
|
```
|
|
54
27
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
## 为什么推荐 `changesets`
|
|
58
|
-
|
|
59
|
-
| 需求 | `changesets` 的做法 |
|
|
60
|
-
| -------------- | ----------------------------------------- |
|
|
61
|
-
| 记录哪些包变了 | 每次变更生成单独的 `.changeset/*.md` 文件 |
|
|
62
|
-
| 控制版本类型 | 明确选择 `patch` / `minor` / `major` |
|
|
63
|
-
| 自动生成日志 | `changeset version` 统一产出 changelog |
|
|
64
|
-
| 联动内部包版本 | 自动改内部依赖引用 |
|
|
65
|
-
| CI 自动发布 | 可接 `changesets/action` |
|
|
66
|
-
|
|
67
|
-
## 日常开发阶段怎么做
|
|
68
|
-
|
|
69
|
-
### 1. 本地先把质量门过掉
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
pnpm build
|
|
73
|
-
pnpm lint
|
|
74
|
-
pnpm typecheck
|
|
75
|
-
pnpm tsd
|
|
76
|
-
pnpm test
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
这一点和仓库的提交要求是一致的。
|
|
80
|
-
|
|
81
|
-
### 2. 记录 changeset
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
pnpm changeset
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
按提示选择:
|
|
88
|
-
|
|
89
|
-
1. 哪些包受影响
|
|
90
|
-
2. 这些包分别是 `patch` / `minor` / `major`
|
|
91
|
-
3. 这次改动怎么写进 changelog
|
|
92
|
-
|
|
93
|
-
示例:
|
|
94
|
-
|
|
95
|
-
```md
|
|
96
|
-
---
|
|
97
|
-
"@my/utils": minor
|
|
98
|
-
"@my/ui": patch
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
- feat(utils): 新增时间格式化工具
|
|
102
|
-
- fix(ui): 修复按钮禁用态样式
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### 3. 合并前看一眼影响面
|
|
106
|
-
|
|
107
|
-
changeset 文件本身就是最便宜的“发布预告”。代码评审时顺手看一下,通常就能避免:
|
|
108
|
-
|
|
109
|
-
- 漏记某个包
|
|
110
|
-
- 版本类型选错
|
|
111
|
-
- changelog 写得太含糊
|
|
112
|
-
|
|
113
|
-
## 发布阶段怎么做
|
|
114
|
-
|
|
115
|
-
### 手动流程
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
pnpm exec repo release stable
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
`repo release stable` 会先执行构建、lint 和测试,再调用 `changeset version` 与 `changeset publish`。其中 `changeset version` 会做这些事:
|
|
122
|
-
|
|
123
|
-
- 更新受影响包的版本号
|
|
124
|
-
- 调整内部依赖版本
|
|
125
|
-
- 生成或更新每个包的 `CHANGELOG.md`
|
|
126
|
-
|
|
127
|
-
### CI 自动流程
|
|
128
|
-
|
|
129
|
-
模板推荐结合 `changesets/action`。
|
|
130
|
-
|
|
131
|
-
一个常见的工作流结构如下:
|
|
132
|
-
|
|
133
|
-
```yaml
|
|
134
|
-
name: Release
|
|
135
|
-
|
|
136
|
-
on:
|
|
137
|
-
push:
|
|
138
|
-
branches:
|
|
139
|
-
- main
|
|
140
|
-
- alpha
|
|
141
|
-
- beta
|
|
142
|
-
- rc
|
|
143
|
-
- next
|
|
144
|
-
workflow_dispatch:
|
|
145
|
-
|
|
146
|
-
permissions:
|
|
147
|
-
contents: write
|
|
148
|
-
pull-requests: write
|
|
149
|
-
issues: write
|
|
150
|
-
id-token: write
|
|
151
|
-
|
|
152
|
-
env:
|
|
153
|
-
HUSKY: 0
|
|
154
|
-
|
|
155
|
-
jobs:
|
|
156
|
-
release:
|
|
157
|
-
if: github.ref_name == 'main'
|
|
158
|
-
runs-on: ubuntu-latest
|
|
159
|
-
steps:
|
|
160
|
-
- uses: actions/checkout@v7
|
|
161
|
-
- uses: pnpm/action-setup@v6
|
|
162
|
-
- uses: actions/setup-node@v7
|
|
163
|
-
with:
|
|
164
|
-
node-version: 24
|
|
165
|
-
cache: pnpm
|
|
166
|
-
registry-url: https://registry.npmjs.org
|
|
167
|
-
- run: pnpm install
|
|
168
|
-
- name: Create Release Pull Request or Publish to npm
|
|
169
|
-
uses: changesets/action@v2.0.0
|
|
170
|
-
with:
|
|
171
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
172
|
-
publish-script: pnpm exec repo release stable
|
|
173
|
-
env:
|
|
174
|
-
NPM_CONFIG_PROVENANCE: true
|
|
175
|
-
|
|
176
|
-
prerelease:
|
|
177
|
-
if: github.ref_name != 'main'
|
|
178
|
-
runs-on: ubuntu-latest
|
|
179
|
-
steps:
|
|
180
|
-
- uses: actions/checkout@v7
|
|
181
|
-
- uses: pnpm/action-setup@v6
|
|
182
|
-
- uses: actions/setup-node@v7
|
|
183
|
-
with:
|
|
184
|
-
node-version: 24
|
|
185
|
-
cache: pnpm
|
|
186
|
-
- run: pnpm install
|
|
187
|
-
- run: git config user.name "github-actions[bot]"
|
|
188
|
-
- run: git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
189
|
-
- name: Publish Prerelease
|
|
190
|
-
run: pnpm exec repo release pre publish
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
## 关于 npm 鉴权
|
|
194
|
-
|
|
195
|
-
现在更推荐在 CI 里使用 OIDC,而不是长期保存一个会过期的 `NPM_TOKEN`。
|
|
196
|
-
|
|
197
|
-
原因很现实:
|
|
198
|
-
|
|
199
|
-
- token 会过期
|
|
200
|
-
- token 泄漏风险更高
|
|
201
|
-
- OIDC 更适合自动化发布
|
|
202
|
-
|
|
203
|
-
所以工作流里建议保留:
|
|
204
|
-
|
|
205
|
-
```yaml
|
|
206
|
-
permissions:
|
|
207
|
-
id-token: write
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
## 常见发布约束
|
|
211
|
-
|
|
212
|
-
### 私有包不会被发布
|
|
213
|
-
|
|
214
|
-
如果一个包是:
|
|
215
|
-
|
|
216
|
-
```json
|
|
217
|
-
{
|
|
218
|
-
"private": true
|
|
219
|
-
}
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
那么它通常不会进入 npm 发布流程。
|
|
223
|
-
|
|
224
|
-
### 没有 changeset 就不会有版本 PR
|
|
225
|
-
|
|
226
|
-
如果你改了公开包,却没有提交 `.changeset/*.md`,那么后续版本流转通常会断掉。
|
|
227
|
-
|
|
228
|
-
### 先 build 再发
|
|
229
|
-
|
|
230
|
-
这个仓库的约定很明确:先 build,再 lint / typecheck / tsd / test,再谈发布。不要跳步。
|
|
231
|
-
|
|
232
|
-
## 常见问题
|
|
233
|
-
|
|
234
|
-
### 为什么没有生成 changelog?
|
|
235
|
-
|
|
236
|
-
通常是下面几种原因:
|
|
237
|
-
|
|
238
|
-
- 没有执行 `pnpm changeset version`
|
|
239
|
-
- `.changeset/*.md` 没有提交
|
|
240
|
-
- 受影响包实际没有进入版本计算
|
|
241
|
-
|
|
242
|
-
### 如何跳过某个包的发布?
|
|
243
|
-
|
|
244
|
-
- 在 changeset 里不要勾选它
|
|
245
|
-
- 或者把它标记为 `private: true`
|
|
246
|
-
|
|
247
|
-
### 为什么要在 PR 阶段就看 changeset?
|
|
248
|
-
|
|
249
|
-
因为它本质上是在回答一个非常具体的问题:
|
|
250
|
-
|
|
251
|
-
“这次改动准备怎么影响发布面?”
|
|
252
|
-
|
|
253
|
-
这个问题越早看,越不容易在合并后补救。
|
|
28
|
+
Supported lane names include `alpha`, `beta`, `rc`, and `next`.
|
|
254
29
|
|
|
255
|
-
##
|
|
30
|
+
## Recovery
|
|
256
31
|
|
|
257
|
-
-
|
|
258
|
-
- [repoctl 工作流与 CI](../repoctl/workflows.md)
|
|
259
|
-
- [repoctl 排障与报告](../repoctl/troubleshooting.md)
|
|
260
|
-
- [命令别名](../repoctl/aliases.md)
|
|
32
|
+
Use the publish-unpublished release mode to recover versions that were prepared but not published. Inspect the generated report before retrying a partial release.
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Template Systems
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Templates make repository conventions executable. repoctl ships internal source workspaces for libraries, Vue components, apps, services, documentation sites, and CLIs.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
```bash
|
|
6
|
+
repo templates
|
|
7
|
+
repo templates --category library
|
|
8
|
+
repo new sdk --template tsdown --dry-run
|
|
9
|
+
repo templates --check
|
|
10
|
+
```
|
|
7
11
|
|
|
8
|
-
|
|
12
|
+
The publishable `@icebreakers/monorepo-templates` package owns the registry and packaged assets. Individual `templates/*` workspaces are private and are not release units.
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
| 产物 | 常见目录 | 关注点 |
|
|
13
|
-
| ------------- | ------------------------ | ------------------------------ |
|
|
14
|
-
| TypeScript 库 | `packages/*` | exports、types、构建和 tsd |
|
|
15
|
-
| Vue 组件库 | `packages/*` | SFC、样式校验、类型声明 |
|
|
16
|
-
| 应用 | `apps/*` | dev、build、部署资产 |
|
|
17
|
-
| 服务 | `apps/*` | API 入口、运行时类型、环境变量 |
|
|
18
|
-
| 文档站 | `apps/*` | VitePress 配置、导航、内容结构 |
|
|
19
|
-
| CLI | `apps/*` 或 `packages/*` | bin 入口、参数解析、发布 |
|
|
20
|
-
|
|
21
|
-
repoctl 的 `repo templates` 和 `repo new` 负责把这些约定落实到文件系统。
|
|
14
|
+
See [Templates](../repoctl/templates.md) and [Template Asset Management](../repoctl/template-assets.md).
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Monorepo Troubleshooting
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Start by identifying the problem class: workspace discovery, dependency installation, task orchestration, repository policy, or release state.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
```bash
|
|
6
|
+
repo doctor
|
|
7
|
+
repo env support --markdown --redact --out reports/support.md
|
|
8
|
+
repo check --full --dry-run
|
|
9
|
+
pnpm change status
|
|
10
|
+
```
|
|
7
11
|
|
|
8
|
-
|
|
12
|
+
- Workspace discovery failures usually point to `pnpm-workspace.yaml` patterns.
|
|
13
|
+
- Missing task output or cache behavior belongs to Turbo task configuration.
|
|
14
|
+
- Tooling drift belongs to managed config and `repo upgrade`.
|
|
15
|
+
- Release failures require checking both versioning state and registry publication.
|
|
9
16
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
| 类型 | 先看什么 | 常用命令 |
|
|
13
|
-
| -------------- | ------------------------------------- | --------------------------------------- |
|
|
14
|
-
| 仓库结构问题 | 根目录、workspace 文件、Node 版本 | `repo doctor` |
|
|
15
|
-
| 模板创建问题 | 模板 key、目标目录、创建计划 | `repo templates` / `repo new --dry-run` |
|
|
16
|
-
| 提交前校验问题 | staged 文件、workspace 归属、任务路由 | `repo check --dry-run` |
|
|
17
|
-
| 环境差异问题 | Node、pnpm、Git、CI、路径 | `repo env support --markdown --redact` |
|
|
18
|
-
| 遗留配置问题 | `repoctl.config.ts` 与旧配置文件 | `repo config inspect` |
|
|
19
|
-
|
|
20
|
-
旧页面继续保留为知识点索引,具体排查步骤以后优先维护在 repoctl 分区。
|
|
17
|
+
Do not overwrite custom files until the diagnostic report and planned changes are understood.
|
|
@@ -2,18 +2,24 @@
|
|
|
2
2
|
"name": "@icebreakers/website",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"version": "0.0.1",
|
|
5
|
-
"
|
|
5
|
+
"private": true,
|
|
6
|
+
"description": "Documentation website for repoctl",
|
|
6
7
|
"author": "ice breaker <hi@sonofmagic.top>",
|
|
7
8
|
"homepage": "https://repo.icebreaker.top",
|
|
8
9
|
"repository": {
|
|
9
10
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/sonofmagic/
|
|
11
|
+
"url": "git+https://github.com/sonofmagic/repoctl.git",
|
|
11
12
|
"directory": "templates/vitepress"
|
|
12
13
|
},
|
|
13
14
|
"bugs": {
|
|
14
|
-
"url": "https://github.com/sonofmagic/
|
|
15
|
+
"url": "https://github.com/sonofmagic/repoctl/issues"
|
|
15
16
|
},
|
|
16
|
-
"keywords": [
|
|
17
|
+
"keywords": [
|
|
18
|
+
"repoctl",
|
|
19
|
+
"documentation",
|
|
20
|
+
"vitepress",
|
|
21
|
+
"monorepo"
|
|
22
|
+
],
|
|
17
23
|
"scripts": {
|
|
18
24
|
"dev": "vitepress dev",
|
|
19
25
|
"build": "vitepress build",
|
|
@@ -35,7 +41,7 @@
|
|
|
35
41
|
"mermaid": "^11.16.1",
|
|
36
42
|
"tailwindcss": "^4.3.3",
|
|
37
43
|
"vitepress": "^1.6.4",
|
|
38
|
-
"vitepress-plugin-llms": "^1.13.
|
|
44
|
+
"vitepress-plugin-llms": "^1.13.5",
|
|
39
45
|
"vitepress-plugin-mermaid": "^2.0.17"
|
|
40
46
|
}
|
|
41
47
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Adopt Existing Repositories
|
|
2
2
|
|
|
3
|
-
repoctl
|
|
3
|
+
repoctl is not only for newly generated repositories. It can be adopted gradually in existing pnpm workspaces by using diagnostics and conservative asset syncs.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Good Candidates
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A repository is a good fit when:
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
9
|
+
- It already uses pnpm, or is ready to move to pnpm.
|
|
10
|
+
- It has a root `package.json`.
|
|
11
|
+
- It can use workspace folders such as `apps/*`, `packages/*`, or `examples/*`.
|
|
12
|
+
- The team wants stable daily entries such as `repo:init`, `repo:doctor`, `repo:new`, and `repo:check`.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
If the repository is not yet a pnpm workspace, start with a minimal `pnpm-workspace.yaml`:
|
|
15
15
|
|
|
16
16
|
```yaml
|
|
17
17
|
packages:
|
|
@@ -19,47 +19,47 @@ packages:
|
|
|
19
19
|
- packages/*
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## Step 1: Install And Setup
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
pnpm add -D repoctl
|
|
26
26
|
pnpm exec repo init --yes
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
`repo init --yes`
|
|
29
|
+
`repo init --yes` uses safe defaults. It adds recommended scripts and workspace patterns, but it does not blindly overwrite existing README, package.json, pnpm-workspace.yaml, or tooling files.
|
|
30
30
|
|
|
31
|
-
##
|
|
31
|
+
## Step 2: Save The First Diagnostic Report
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
34
|
pnpm exec repo doctor --markdown --redact --out reports/doctor-before.md
|
|
35
35
|
pnpm exec repo doctor --json --out reports/doctor-before.json
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Prefer saving the first report as a PR comment or CI artifact instead of relying only on terminal output.
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
Watch these checks:
|
|
41
41
|
|
|
42
|
-
|
|
|
43
|
-
| ---------------------------- |
|
|
44
|
-
| `package-json` |
|
|
45
|
-
| `workspace-manifest` |
|
|
46
|
-
| `node-version` |
|
|
47
|
-
| `tool-package` |
|
|
48
|
-
| `root-scripts` |
|
|
49
|
-
| `config-file` |
|
|
50
|
-
| `commit-hooks` | Husky
|
|
51
|
-
| `workspace-package-coverage` | package.json
|
|
42
|
+
| Check | Common Issue |
|
|
43
|
+
| ---------------------------- | ----------------------------------------------------------------- |
|
|
44
|
+
| `package-json` | Current directory is not the repository root |
|
|
45
|
+
| `workspace-manifest` | `pnpm-workspace.yaml` is missing |
|
|
46
|
+
| `node-version` | Root package has no `engines.node`, or the version does not match |
|
|
47
|
+
| `tool-package` | `repoctl` is not installed |
|
|
48
|
+
| `root-scripts` | `repo:init/repo:new/repo:check/repo:doctor` scripts are missing |
|
|
49
|
+
| `config-file` | A stale `monorepo.config.ts` file is still present |
|
|
50
|
+
| `commit-hooks` | Husky and lint-staged are only partially configured |
|
|
51
|
+
| `workspace-package-coverage` | Some package.json files are not covered by workspace patterns |
|
|
52
52
|
|
|
53
|
-
##
|
|
53
|
+
## Step 3: Sync Conservatively
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
56
|
pnpm exec repo upgrade --no-overwrite
|
|
57
57
|
pnpm exec repo doctor --markdown --redact --out reports/doctor-after.md
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
`--no-overwrite`
|
|
60
|
+
Use `--no-overwrite` for the first adoption pass. It syncs missing assets while preserving changed managed files.
|
|
61
61
|
|
|
62
|
-
##
|
|
62
|
+
## Step 4: Preview Verification
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
65
|
pnpm exec repo check --dry-run
|
|
@@ -67,11 +67,11 @@ pnpm exec repo check --json --out reports/check-plan.json
|
|
|
67
67
|
pnpm exec repo check --markdown --redact --out reports/check-plan.md
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
Review the plan before wiring hooks or CI.
|
|
71
71
|
|
|
72
|
-
##
|
|
72
|
+
## Step 5: Use Root Scripts
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
After `repo init`, team docs can use:
|
|
75
75
|
|
|
76
76
|
```bash
|
|
77
77
|
pnpm run repo:doctor
|
|
@@ -79,57 +79,55 @@ pnpm run repo:new -- sdk
|
|
|
79
79
|
pnpm run repo:check
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
CI
|
|
82
|
+
CI and automation should still prefer explicit commands:
|
|
83
83
|
|
|
84
84
|
```bash
|
|
85
85
|
pnpm exec repo doctor --strict
|
|
86
86
|
pnpm exec repo check --full
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
##
|
|
89
|
+
## Step 6: Resolve Legacy Config
|
|
90
90
|
|
|
91
|
-
###
|
|
91
|
+
### Config Conflicts
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
Keep only:
|
|
94
94
|
|
|
95
95
|
```txt
|
|
96
96
|
repoctl.config.ts
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
`monorepo.config.ts`
|
|
99
|
+
`monorepo.config.ts` is no longer loaded at runtime; rename it to `repoctl.config.ts`.
|
|
100
100
|
|
|
101
|
-
###
|
|
101
|
+
### Local Tooling Loader
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
If `doctor` reports local source tooling loaders, migrate with:
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
106
|
pnpm exec repo upgrade --yes
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
The same migration also converts simple wrappers from `@icebreakers/commitlint-config`, `@icebreakers/eslint-config`, and `@icebreakers/stylelint-config` to `repoctl/tooling`. Complex ESLint configs keep their rules, ignores, overrides, and extra flat config semantics.
|
|
110
110
|
|
|
111
|
-
###
|
|
111
|
+
### Workspace Pattern Gaps
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
Run:
|
|
114
114
|
|
|
115
115
|
```bash
|
|
116
116
|
pnpm exec repo init --yes
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
or manually extend `pnpm-workspace.yaml`.
|
|
120
120
|
|
|
121
|
-
##
|
|
121
|
+
## Recommended PR Shape
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
1. Install `repoctl` and add root scripts.
|
|
124
|
+
2. Attach `doctor-before` and `doctor-after` reports.
|
|
125
|
+
3. Sync or migrate tooling config.
|
|
126
|
+
4. Wire hooks and CI.
|
|
127
|
+
5. Verify scaffolding paths with `repo new --dry-run`.
|
|
124
128
|
|
|
125
|
-
|
|
126
|
-
2. 提交 `doctor-before` 和 `doctor-after` 报告。
|
|
127
|
-
3. 同步或迁移 tooling 配置。
|
|
128
|
-
4. 接入 hook 和 CI。
|
|
129
|
-
5. 用 `repo new --dry-run` 验证模板创建路径。
|
|
129
|
+
## Keep Reading
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
- [
|
|
134
|
-
- [排障与报告](./troubleshooting.md)
|
|
135
|
-
- [配置文件](./config.md)
|
|
131
|
+
- [Workflows and CI](./workflows.md)
|
|
132
|
+
- [Troubleshooting](./troubleshooting.md)
|
|
133
|
+
- [Configuration](./config.md)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Command Aliases
|
|
2
2
|
|
|
3
|
-
repoctl
|
|
3
|
+
repoctl keeps several aliases for terminal convenience. Team docs should still prefer full commands because they are easier for new users to read.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Binary Aliases
|
|
6
6
|
|
|
7
|
-
`repoctl`
|
|
7
|
+
The `repoctl` package exposes these bins:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
repo
|
|
@@ -14,9 +14,9 @@ rc
|
|
|
14
14
|
mo
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
The docs recommend `repo`.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
These bins all enter the same command implementation:
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
repoctl doctor
|
|
@@ -25,16 +25,16 @@ rc doctor
|
|
|
25
25
|
mo doctor
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## Top-Level Aliases
|
|
29
29
|
|
|
30
|
-
|
|
|
31
|
-
| ---------------- | ----------- |
|
|
32
|
-
| `repo init` | `repo init` |
|
|
33
|
-
| `repo templates` | `repo tpl` |
|
|
30
|
+
| Recommended | Alias | Purpose |
|
|
31
|
+
| ---------------- | ----------- | ----------------------------- |
|
|
32
|
+
| `repo init` | `repo init` | Initialize workspace defaults |
|
|
33
|
+
| `repo templates` | `repo tpl` | Inspect or check templates |
|
|
34
34
|
|
|
35
|
-
##
|
|
35
|
+
## Group Aliases
|
|
36
36
|
|
|
37
|
-
|
|
|
37
|
+
| Full Command | Alias |
|
|
38
38
|
| ------------------------------ | --------------- |
|
|
39
39
|
| `repo workspace` | `repo ws` |
|
|
40
40
|
| `repo workspace upgrade` | `repo ws up` |
|
|
@@ -62,9 +62,9 @@ mo doctor
|
|
|
62
62
|
| `repo ai prompt` | `repo ai p` |
|
|
63
63
|
| `repo ai prompt create` | `repo ai p new` |
|
|
64
64
|
|
|
65
|
-
##
|
|
65
|
+
## Recommendation
|
|
66
66
|
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
- CI
|
|
67
|
+
- Use full commands in onboarding docs.
|
|
68
|
+
- Use `repo:*` root scripts in project README files, for example `pnpm run repo:doctor`.
|
|
69
|
+
- Use short aliases in maintainer scripts only when the surrounding docs explain them.
|
|
70
|
+
- Prefer full commands in CI logs.
|