@icebreakers/monorepo-templates 0.1.15 → 1.0.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 -0
- package/assets/.changeset/config.json +7 -2
- package/assets/.github/workflows/ci.yml +8 -2
- package/assets/.github/workflows/release.yml +2 -2
- package/assets/.husky/commit-msg +1 -1
- package/assets/.husky/pre-commit +1 -1
- package/assets/.husky/pre-push +5 -0
- package/assets/.vscode/settings.json +1 -6
- package/assets/AGENTS.md +8 -7
- package/assets/commitlint.config.ts +2 -2
- package/assets/eslint.config.js +2 -6
- package/assets/lint-staged.config.js +3 -0
- package/assets/package.json +39 -28
- package/assets/repoctl.config.ts +68 -0
- package/assets/stylelint.config.js +2 -2
- package/assets/tooling/ensure-tooling-built.mjs +24 -0
- package/assets/tooling/load-tooling-module.mjs +71 -0
- package/assets/tsconfig.json +1 -49
- package/assets/turbo.json +17 -6
- package/assets/vitest.config.ts +2 -125
- package/assets-data.mjs +4 -2
- package/dist/index.d.mts +22 -1
- package/dist/index.mjs +114 -30
- package/package.json +12 -8
- package/template-data.mjs +48 -8
- package/templates/client/eslint.config.js +6 -4
- package/templates/client/package.json +22 -22
- package/templates/client/vite.config.ts +4 -3
- package/templates/client/wrangler.jsonc +1 -6
- package/templates/server/package.json +4 -4
- package/templates/server/src/app.ts +4 -4
- package/templates/server/tsconfig.json +1 -2
- package/templates/server/vitest.config.ts +6 -5
- package/templates/server/wrangler.jsonc +1 -6
- package/templates/tsdown/package.json +2 -1
- package/templates/tsdown/test-d/index.test-d.ts +5 -0
- package/templates/tsdown/tsconfig.json +1 -2
- package/templates/tsdown/vitest.config.ts +6 -5
- package/templates/vitepress/.vitepress/config.ts +34 -36
- package/templates/vitepress/getting-started.md +243 -0
- package/templates/vitepress/gitignore +2 -1
- package/templates/vitepress/index.md +144 -79
- package/templates/vitepress/monorepo/commands.md +281 -0
- package/templates/vitepress/monorepo/index.md +103 -34
- package/templates/vitepress/monorepo/manage.md +181 -80
- package/templates/vitepress/monorepo/publish.md +128 -57
- package/templates/vitepress/monorepo/templates.md +67 -0
- package/templates/vitepress/monorepo/troubleshooting.md +207 -0
- package/templates/vitepress/package.json +5 -5
- package/templates/vitepress/thinking.md +1 -1
- package/templates/vitepress/tools/husky.md +7 -2
- package/templates/vitepress/tools/lint-staged.md +15 -1
- package/templates/vitepress/why/examples/usage-cjs/index.js +2 -6
- package/templates/vitepress/why/examples/usage-cjs/package-lock.json +7 -13
- package/templates/vitepress/why/examples/usage-cjs/package.json +2 -2
- package/templates/vitepress/why/examples/usage-esm/index.js +2 -2
- package/templates/vitepress/why/examples/usage-esm/package-lock.json +7 -13
- package/templates/vitepress/why/examples/usage-esm/package.json +2 -2
- package/templates/vitepress/why/modern/bundlers.md +8 -46
- package/templates/vue-lib/eslint.config.js +6 -4
- package/templates/vue-lib/package.json +17 -12
- package/templates/vue-lib/test-d/index.test-d.ts +6 -0
- package/templates/vue-lib/tsconfig.test.json +1 -1
- package/templates/vue-lib/vitest.config.ts +8 -5
- package/assets/monorepo.config.ts +0 -22
- package/assets/nano-staged.js +0 -18
- package/templates/tsup/build.config.ts +0 -24
- package/templates/tsup/package.json +0 -49
- package/templates/tsup/src/index.ts +0 -12
- package/templates/tsup/test/index.test.ts +0 -18
- package/templates/tsup/tsconfig.json +0 -15
- package/templates/tsup/tsup.config.ts +0 -18
- package/templates/tsup/vitest.config.ts +0 -15
- package/templates/unbuild/build.config.ts +0 -24
- package/templates/unbuild/package.json +0 -49
- package/templates/unbuild/src/index.ts +0 -9
- package/templates/unbuild/src/utils.ts +0 -5
- package/templates/unbuild/test/index.test.ts +0 -18
- package/templates/unbuild/tsconfig.json +0 -15
- package/templates/unbuild/vitest.config.ts +0 -15
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"types": "./dist/index.d.ts"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@hono/node-server": "^
|
|
57
|
+
"@hono/node-server": "^2.0.1",
|
|
58
58
|
"consola": "^3.4.2",
|
|
59
|
-
"hono": "^4.12.
|
|
60
|
-
"wrangler": "^4.
|
|
61
|
-
"zod": "^4.
|
|
59
|
+
"hono": "^4.12.16",
|
|
60
|
+
"wrangler": "^4.87.0",
|
|
61
|
+
"zod": "^4.4.2"
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -117,13 +117,13 @@ const grads: ColorStop[][] = [
|
|
|
117
117
|
]
|
|
118
118
|
|
|
119
119
|
// Convert hour to CSS gradient
|
|
120
|
-
|
|
120
|
+
function toCSSGradient(hour: number): string {
|
|
121
121
|
let css = 'linear-gradient(to bottom,'
|
|
122
|
-
const data = grads[hour]
|
|
122
|
+
const data = grads[hour] ?? grads[0]!
|
|
123
123
|
const len = data.length
|
|
124
124
|
|
|
125
125
|
for (let i = 0; i < len; i++) {
|
|
126
|
-
const item = data[i]
|
|
126
|
+
const item = data[i]!
|
|
127
127
|
css += ` #${item.color} ${item.position}%`
|
|
128
128
|
if (i < len - 1) {
|
|
129
129
|
css += ','
|
|
@@ -168,7 +168,7 @@ app.get('*', async (c) => {
|
|
|
168
168
|
html_content += `<p>${timezone}<br/></p>`
|
|
169
169
|
|
|
170
170
|
// Add background gradient based on hour
|
|
171
|
-
html_style += `body{background:${
|
|
171
|
+
html_style += `body{background:${toCSSGradient(hour)};}`
|
|
172
172
|
|
|
173
173
|
// Complete HTML document
|
|
174
174
|
const html = `
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import path from 'node:path'
|
|
2
2
|
import { defineProject } from 'vitest/config'
|
|
3
|
+
import { loadRepoctlToolingModule } from '../../tooling/load-tooling-module.mjs'
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
const { defineVitestProjectConfig } = await loadRepoctlToolingModule()
|
|
6
|
+
|
|
7
|
+
export default defineProject(await defineVitestProjectConfig({
|
|
8
|
+
options: {
|
|
6
9
|
alias: [
|
|
7
10
|
{
|
|
8
11
|
find: '@',
|
|
9
12
|
replacement: path.resolve(__dirname, './src'),
|
|
10
13
|
},
|
|
11
14
|
],
|
|
12
|
-
globals: true,
|
|
13
|
-
testTimeout: 60_000,
|
|
14
15
|
},
|
|
15
|
-
})
|
|
16
|
+
}))
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
"release": "pnpm publish",
|
|
43
43
|
"lint": "eslint .",
|
|
44
44
|
"lint:fix": "eslint . --fix",
|
|
45
|
-
"typecheck": "tsc -p tsconfig.json"
|
|
45
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
46
|
+
"tsd": "pnpm build && tsd --files test-d/**/*.test-d.ts"
|
|
46
47
|
},
|
|
47
48
|
"publishConfig": {}
|
|
48
49
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import path from 'node:path'
|
|
2
2
|
import { defineProject } from 'vitest/config'
|
|
3
|
+
import { loadRepoctlToolingModule } from '../../tooling/load-tooling-module.mjs'
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
const { defineVitestProjectConfig } = await loadRepoctlToolingModule()
|
|
6
|
+
|
|
7
|
+
export default defineProject(await defineVitestProjectConfig({
|
|
8
|
+
options: {
|
|
6
9
|
alias: [
|
|
7
10
|
{
|
|
8
11
|
find: '@',
|
|
9
12
|
replacement: path.resolve(__dirname, './src'),
|
|
10
13
|
},
|
|
11
14
|
],
|
|
12
|
-
globals: true,
|
|
13
|
-
testTimeout: 60_000,
|
|
14
15
|
},
|
|
15
|
-
})
|
|
16
|
+
}))
|
|
@@ -3,13 +3,16 @@ import { defineConfig } from 'vitepress'
|
|
|
3
3
|
import { withMermaid } from 'vitepress-plugin-mermaid'
|
|
4
4
|
// https://vitepress.dev/reference/site-config
|
|
5
5
|
export default withMermaid(defineConfig({
|
|
6
|
-
outDir: '
|
|
6
|
+
outDir: '.vitepress/dist',
|
|
7
7
|
title: 'icebreaker\'s monorepo',
|
|
8
|
-
description: '
|
|
8
|
+
description: 'A practical pnpm + turbo monorepo template with short onboarding commands and repo tooling.',
|
|
9
9
|
themeConfig: {
|
|
10
10
|
// https://vitepress.dev/reference/default-theme-config
|
|
11
11
|
nav: [
|
|
12
|
-
{ text: '
|
|
12
|
+
{ text: '开始使用', link: '/' },
|
|
13
|
+
{ text: '新手指南', link: '/getting-started' },
|
|
14
|
+
{ text: 'Monorepo', link: '/monorepo/' },
|
|
15
|
+
{ text: '工具专题', link: '/tools/turborepo' },
|
|
13
16
|
{ text: '一些思考', link: '/thinking' },
|
|
14
17
|
],
|
|
15
18
|
socialLinks: [
|
|
@@ -22,56 +25,51 @@ export default withMermaid(defineConfig({
|
|
|
22
25
|
logo: '/logo.jpg',
|
|
23
26
|
sidebar: {
|
|
24
27
|
'/': [
|
|
25
|
-
{ text: '使用手册', link: '/' },
|
|
26
|
-
{ text: '一些思考', link: 'thinking' },
|
|
27
28
|
{
|
|
28
|
-
text: '
|
|
29
|
-
base: '/why/',
|
|
29
|
+
text: '开始使用',
|
|
30
30
|
items: [
|
|
31
|
-
{ text: '
|
|
32
|
-
{ text: '
|
|
33
|
-
{ text: '
|
|
34
|
-
{ text: '什么是 npm 包', link: '/what-is-npm-package' },
|
|
35
|
-
{ text: '如何发布 npm 包', link: '/publish-basic-npm-package' },
|
|
36
|
-
{
|
|
37
|
-
text: '改进并发布现代 npm 包',
|
|
38
|
-
link: 'index',
|
|
39
|
-
base: 'why/modern/',
|
|
40
|
-
items: [
|
|
41
|
-
{ text: 'package entry points 字段', link: '/package-entry-points' },
|
|
42
|
-
{ text: '添加 DTS', link: '/dts' },
|
|
43
|
-
{ text: 'ESM vs CJS', link: '/esm-vs-cjs' },
|
|
44
|
-
{ text: '使用 TypeScript', link: '/typescript' },
|
|
45
|
-
{ text: '使用打包器', link: '/bundlers' },
|
|
46
|
-
],
|
|
47
|
-
},
|
|
31
|
+
{ text: '首页', link: '/' },
|
|
32
|
+
{ text: '新手使用指南', link: '/getting-started' },
|
|
33
|
+
{ text: '一些思考', link: '/thinking' },
|
|
48
34
|
],
|
|
49
35
|
},
|
|
50
36
|
{
|
|
51
37
|
text: 'Monorepo',
|
|
52
|
-
base: '/monorepo/',
|
|
53
38
|
items: [
|
|
54
|
-
{ text: '为什么往 monorepo 方向演进', link: '/' },
|
|
55
|
-
{ text: '如何管理 monorepo', link: '/manage' },
|
|
56
|
-
{ text: '
|
|
39
|
+
{ text: '为什么往 monorepo 方向演进', link: '/monorepo/' },
|
|
40
|
+
{ text: '如何管理 monorepo', link: '/monorepo/manage' },
|
|
41
|
+
{ text: '模板速查', link: '/monorepo/templates' },
|
|
42
|
+
{ text: '命令速查', link: '/monorepo/commands' },
|
|
43
|
+
{ text: '常见问题排障', link: '/monorepo/troubleshooting' },
|
|
44
|
+
{ text: '发包与变更日志', link: '/monorepo/publish' },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
text: 'npm 与包',
|
|
49
|
+
items: [
|
|
50
|
+
{ text: '如何复用 js 代码', link: '/why/how-to-reuse-js-code' },
|
|
51
|
+
{ text: 'JS 文件的各种后缀', link: '/why/js-cjs-mjs' },
|
|
52
|
+
{ text: 'CJS 和 ESM 关键字/全局变量对比', link: '/why/js-keywords' },
|
|
53
|
+
{ text: '什么是 npm 包', link: '/why/what-is-npm-package' },
|
|
54
|
+
{ text: '如何发布 npm 包', link: '/why/publish-basic-npm-package' },
|
|
55
|
+
{ text: '改进并发布现代 npm 包', link: '/why/index' },
|
|
57
56
|
],
|
|
58
57
|
},
|
|
59
58
|
{
|
|
60
59
|
text: '相关的工具',
|
|
61
|
-
base: '/tools/',
|
|
62
60
|
items: [
|
|
63
|
-
{ text: 'pnpm', link: '/pnpm' },
|
|
64
|
-
{ text: 'turborepo', link: '/turborepo' },
|
|
65
|
-
{ text: 'changeset', link: '/changeset' },
|
|
66
|
-
{ text: 'husky', link: '/husky' },
|
|
67
|
-
{ text: 'lint-staged', link: '/lint-staged' },
|
|
68
|
-
{ text: 'renovate', link: '/renovate' },
|
|
61
|
+
{ text: 'pnpm', link: '/tools/pnpm' },
|
|
62
|
+
{ text: 'turborepo', link: '/tools/turborepo' },
|
|
63
|
+
{ text: 'changeset', link: '/tools/changeset' },
|
|
64
|
+
{ text: 'husky', link: '/tools/husky' },
|
|
65
|
+
{ text: 'lint-staged', link: '/tools/lint-staged' },
|
|
66
|
+
{ text: 'renovate', link: '/tools/renovate' },
|
|
69
67
|
],
|
|
70
68
|
},
|
|
71
69
|
],
|
|
72
70
|
},
|
|
73
71
|
editLink: {
|
|
74
|
-
pattern: 'https://github.com/sonofmagic/monorepo-template/edit/main/
|
|
72
|
+
pattern: 'https://github.com/sonofmagic/monorepo-template/edit/main/templates/vitepress/:path',
|
|
75
73
|
text: '为此页提供修改建议',
|
|
76
74
|
},
|
|
77
75
|
},
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: doc
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# 新手使用指南
|
|
6
|
+
|
|
7
|
+
这篇指南按第一次接手仓库的顺序写。你不需要先理解所有工具,只要先把仓库跑起来,再慢慢看更细的命令。
|
|
8
|
+
|
|
9
|
+
## 你需要先准备什么
|
|
10
|
+
|
|
11
|
+
- Node.js 20 或更高版本。
|
|
12
|
+
- pnpm。推荐通过 Corepack 启用:`corepack enable`。
|
|
13
|
+
- Git。`repo doctor` 会读取仓库信息,用来补全新包的 repository、bugs 和 author。
|
|
14
|
+
|
|
15
|
+
确认版本:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
node -v
|
|
19
|
+
pnpm -v
|
|
20
|
+
git --version
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 第一次进入仓库
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pnpm install
|
|
27
|
+
pnpm setup
|
|
28
|
+
pnpm doctor
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
这三步分别解决三件事:
|
|
32
|
+
|
|
33
|
+
| 命令 | 作用 |
|
|
34
|
+
| -------------- | ---------------------------------- |
|
|
35
|
+
| `pnpm install` | 安装 workspace 依赖 |
|
|
36
|
+
| `pnpm setup` | 同步推荐的根脚本、配置和工具链入口 |
|
|
37
|
+
| `pnpm doctor` | 检查当前仓库能不能顺利开始开发 |
|
|
38
|
+
|
|
39
|
+
如果 `doctor` 报错,先按输出里的 `fix:` 处理。处理完再跑一次 `pnpm doctor`,直到没有 blocking issue。
|
|
40
|
+
|
|
41
|
+
如果要在 CI 或脚本里读取诊断结果:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pnpm exec repo doctor --json
|
|
45
|
+
pnpm exec repo doctor --json --out reports/doctor.json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
如果希望 CI 把建议项也当成失败,使用 strict 模式:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pnpm exec repo doctor --strict
|
|
52
|
+
pnpm exec repo doctor --strict --json --out reports/doctor.json
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 创建第一个包或应用
|
|
56
|
+
|
|
57
|
+
不知道要用哪个模板时,先看列表:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pnpm exec repo templates
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
只看库包模板:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pnpm exec repo templates --category library
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
常用模板:
|
|
70
|
+
|
|
71
|
+
| 模板 | 适合什么 |
|
|
72
|
+
| ------------- | ----------------- |
|
|
73
|
+
| `tsdown` | TypeScript 库包 |
|
|
74
|
+
| `vue-lib` | Vue 3 组件库 |
|
|
75
|
+
| `vue-hono` | Vue 3 + Hono 应用 |
|
|
76
|
+
| `hono-server` | Hono API 服务 |
|
|
77
|
+
| `vitepress` | 文档站 |
|
|
78
|
+
| `cli` | 命令行工具 |
|
|
79
|
+
|
|
80
|
+
创建时可以走交互式:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pnpm new
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
也可以直接指定:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pnpm new my-lib --template tsdown
|
|
90
|
+
pnpm new website --template vitepress
|
|
91
|
+
pnpm new api --template hono-server
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
创建前想先确认目标目录:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pnpm new website --template vitepress --dry-run
|
|
98
|
+
pnpm new website --template vitepress --json
|
|
99
|
+
pnpm new website --template vitepress --json --out plans/website.json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
如果模板 key 拼错,CLI 会直接失败并提示最接近的模板 key;它不会静默回退到默认模板。
|
|
103
|
+
`--json` 用于脚本读取创建计划,隐含 `--dry-run`,不会写入文件。
|
|
104
|
+
`--out` 会把创建计划写入文件,也隐含 `--dry-run`。
|
|
105
|
+
|
|
106
|
+
普通名字会自动放进合适目录,比如库包放到 `packages/`,应用放到 `apps/`。如果你传入了带 `/` 的路径,例如 `packages/shared-utils`,CLI 会尊重这个路径。
|
|
107
|
+
|
|
108
|
+
## 开发时怎么跑
|
|
109
|
+
|
|
110
|
+
先看新建 workspace 的 `package.json`,确认它提供了哪些脚本。常见流程是:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pnpm dev
|
|
114
|
+
pnpm build
|
|
115
|
+
pnpm typecheck
|
|
116
|
+
pnpm test
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
整仓命令由 Turborepo 调度。你在根目录执行 `pnpm build`,会构建所有声明了 `build` 脚本的 workspace 包。
|
|
120
|
+
|
|
121
|
+
## 提交前检查
|
|
122
|
+
|
|
123
|
+
提交前推荐按这个顺序跑:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
pnpm build
|
|
127
|
+
pnpm lint
|
|
128
|
+
pnpm typecheck
|
|
129
|
+
pnpm test
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
如果只是想跑模板推荐的本地检查:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
pnpm check
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
如果你改了公开类型 API,并且对应包有 `tsd`:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
pnpm tsd
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## 什么时候用 repo 命令
|
|
145
|
+
|
|
146
|
+
生成仓库里优先记住短命令:
|
|
147
|
+
|
|
148
|
+
| 日常命令 | 等价 CLI |
|
|
149
|
+
| ------------- | ----------------------- |
|
|
150
|
+
| `pnpm setup` | `pnpm exec repo setup` |
|
|
151
|
+
| `pnpm new` | `pnpm exec repo new` |
|
|
152
|
+
| `pnpm doctor` | `pnpm exec repo doctor` |
|
|
153
|
+
| `pnpm check` | `pnpm exec repo check` |
|
|
154
|
+
|
|
155
|
+
需要更细的能力时再用 `repo`:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
pnpm exec repo templates
|
|
159
|
+
pnpm exec repo env paths
|
|
160
|
+
pnpm exec repo env support --json --out reports/support.json
|
|
161
|
+
pnpm exec repo config inspect
|
|
162
|
+
pnpm exec repo ws ls
|
|
163
|
+
pnpm exec repo ws ls --json --out reports/workspaces.json
|
|
164
|
+
pnpm exec repo tg init --all
|
|
165
|
+
pnpm exec repo upgrade
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
`repoctl`、`monorepo`、`rc`、`mo` 这些入口仍然兼容。新项目文档统一推荐 `repo`,减少新人记忆负担。
|
|
169
|
+
|
|
170
|
+
## 更新模板标准资产
|
|
171
|
+
|
|
172
|
+
当模板仓库升级后,可以同步最新推荐配置:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
pnpm exec repo upgrade
|
|
176
|
+
pnpm doctor
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
如果只想同步核心配置,跳过 GitHub、Renovate、开源社区文件:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
pnpm exec repo upgrade --core
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
如果你不希望覆盖已有文件:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
pnpm exec repo upgrade --skip-overwrite
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## 常见问题
|
|
192
|
+
|
|
193
|
+
### 提示目录已经存在
|
|
194
|
+
|
|
195
|
+
`pnpm new` 不会覆盖已有目录。换一个名字,或者手动处理已有目录后再创建。
|
|
196
|
+
|
|
197
|
+
### 不知道模板 key 怎么写
|
|
198
|
+
|
|
199
|
+
运行:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
pnpm exec repo templates
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
查看单个模板详情:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
pnpm exec repo templates tsdown
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
需要给脚本读取时:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
pnpm exec repo templates --json
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### `repoctl.config.ts` 和 `monorepo.config.ts` 同时存在
|
|
218
|
+
|
|
219
|
+
只保留一个。推荐保留 `repoctl.config.ts`,旧文件名仅作为兼容入口。
|
|
220
|
+
|
|
221
|
+
### 新建包之后依赖没装上
|
|
222
|
+
|
|
223
|
+
新建模板只负责生成文件。生成后回到根目录运行:
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
pnpm install
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
然后再跑:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
pnpm build
|
|
233
|
+
pnpm typecheck
|
|
234
|
+
pnpm test
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## 下一步
|
|
238
|
+
|
|
239
|
+
- 想看完整命令:[命令速查](./monorepo/commands.md)
|
|
240
|
+
- 想选择合适模板:[模板速查](./monorepo/templates.md)
|
|
241
|
+
- 想理解 workspace 管理:[如何管理 monorepo](./monorepo/manage.md)
|
|
242
|
+
- 遇到校验问题:[常见问题排障](./monorepo/troubleshooting.md)
|
|
243
|
+
- 准备发包:[发包与变更日志](./monorepo/publish.md)
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
.vitepress/cache
|
|
1
|
+
.vitepress/cache
|
|
2
|
+
.vitepress/dist
|