@icebreakers/monorepo-templates 1.2.0 → 1.3.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.
Files changed (65) hide show
  1. package/assets/.github/workflows/ci.yml +4 -4
  2. package/assets/.github/workflows/release.yml +10 -7
  3. package/assets/package.json +2 -1
  4. package/assets/pnpm-workspace.yaml +2 -9
  5. package/assets/renovate.json +0 -1
  6. package/assets-data.mjs +0 -1
  7. package/dist/cli.mjs +1 -1
  8. package/dist/index.mjs +1 -1
  9. package/dist/{prepare-CNCmvco-.mjs → prepare-D7eJqEqy.mjs} +21 -2
  10. package/package.json +5 -3
  11. package/templates/cli/package.json +1 -1
  12. package/templates/client/package.json +1 -1
  13. package/templates/server/package.json +1 -1
  14. package/templates/tsdown/package.json +1 -1
  15. package/templates/vitepress/.vitepress/config.ts +9 -119
  16. package/templates/vitepress/.vitepress/env.d.ts +1 -0
  17. package/templates/vitepress/.vitepress/home/content.ts +186 -0
  18. package/templates/vitepress/.vitepress/home/types.ts +65 -0
  19. package/templates/vitepress/.vitepress/navigation/routes.ts +138 -0
  20. package/templates/vitepress/.vitepress/seo.ts +40 -0
  21. package/templates/vitepress/.vitepress/theme/components/HomePage.vue +134 -0
  22. package/templates/vitepress/.vitepress/theme/home/foundation.css +180 -0
  23. package/templates/vitepress/.vitepress/theme/home/index.css +3 -0
  24. package/templates/vitepress/.vitepress/theme/home/responsive.css +49 -0
  25. package/templates/vitepress/.vitepress/theme/home/sections.css +153 -0
  26. package/templates/vitepress/.vitepress/theme/index.ts +9 -1
  27. package/templates/vitepress/ai/llms-txt.md +2 -2
  28. package/templates/vitepress/index.md +6 -60
  29. package/templates/vitepress/package.json +11 -4
  30. package/templates/vitepress/public/repoctl-doctor.png +0 -0
  31. package/templates/vitepress/repoctl/workflows.md +35 -0
  32. package/templates/vitepress/scripts/check-locales.ts +162 -0
  33. package/templates/vitepress/thinking.md +15 -0
  34. package/templates/vitepress/tools/changeset.md +17 -12
  35. package/templates/vitepress/tools/husky.md +41 -3
  36. package/templates/vitepress/tools/lint-staged.md +32 -5
  37. package/templates/vitepress/tools/pnpm.md +39 -7
  38. package/templates/vitepress/tools/renovate.md +27 -3
  39. package/templates/vitepress/tools/turborepo.md +33 -7
  40. package/templates/vitepress/tsconfig.json +7 -0
  41. package/templates/vitepress/why/examples/2.npm-basic-package/README.md +1 -1
  42. package/templates/vitepress/why/examples/3.npm-basic-package/README.md +1 -1
  43. package/templates/vitepress/why/how-to-reuse-js-code.md +36 -6
  44. package/templates/vitepress/why/js-cjs-mjs.md +31 -9
  45. package/templates/vitepress/why/js-keywords.md +33 -4
  46. package/templates/vitepress/why/modern/bundlers.md +37 -2
  47. package/templates/vitepress/why/modern/dts.md +44 -3
  48. package/templates/vitepress/why/modern/esm-vs-cjs.md +38 -3
  49. package/templates/vitepress/why/modern/index.md +33 -9
  50. package/templates/vitepress/why/modern/package-entry-points.md +33 -4
  51. package/templates/vitepress/why/modern/typescript.md +40 -4
  52. package/templates/vitepress/why/publish-basic-npm-package.md +37 -13
  53. package/templates/vitepress/why/what-is-npm-package.md +32 -3
  54. package/templates/vitepress/wrangler.jsonc +20 -3
  55. package/templates/vitepress/zh/ai/index.md +1 -1
  56. package/templates/vitepress/zh/ai/llms-txt.md +1 -1
  57. package/templates/vitepress/zh/index.md +6 -63
  58. package/templates/vitepress/zh/repoctl/workflows.md +35 -0
  59. package/templates/vitepress/zh/thinking.md +9 -6
  60. package/templates/vitepress/zh/why/examples/2.npm-basic-package/README.md +1 -1
  61. package/templates/vitepress/zh/why/examples/3.npm-basic-package/README.md +1 -1
  62. package/templates/vitepress/zh/why/index.md +38 -1
  63. package/templates/vue-lib/package.json +1 -1
  64. package/assets/.changeset/ledger.yaml +0 -51
  65. package/assets/netlify.toml +0 -14
@@ -1,7 +1,36 @@
1
1
  # What Is An npm Package?
2
2
 
3
- An npm package is a directory described by `package.json`. It can expose runtime code, types, command-line bins, assets, or configuration.
3
+ An npm package is a versioned archive with a `package.json` contract. It may provide runtime JavaScript, type declarations, a command-line binary, configuration presets, or assets. Publishing a folder is easy; maintaining that contract is the real work.
4
4
 
5
- The public contract includes the package name, version, `exports`, `types`, `bin`, supported runtimes, files included in the tarball, and semantic versioning behavior. Treat these fields as API design, not publishing metadata afterthoughts.
5
+ ## The package boundary
6
6
 
7
- Use `pnpm pack` to inspect the exact artifact before publishing.
7
+ ```text
8
+ package.json name, version, exports, files, engines
9
+ README.md install and supported usage
10
+ dist/ built runtime and type declarations
11
+ LICENSE license terms for consumers
12
+ ```
13
+
14
+ Only files named by `files`, exports, and package metadata should be treated as public. Internal source layout is free to change until it appears in the published contract.
15
+
16
+ ## Inspect what ships
17
+
18
+ ```bash
19
+ npm pack --dry-run
20
+ pnpm pack --pack-destination ./artifacts
21
+ ```
22
+
23
+ Review the archive after every material packaging change. This catches missing declarations, accidental source publication, and files referenced by `exports` that were not included.
24
+
25
+ ## Version with intent
26
+
27
+ - Patch: compatible fix or metadata correction.
28
+ - Minor: compatible capability, such as a new public command or template.
29
+ - Major: incompatible API, behavior, or supported runtime change.
30
+
31
+ Repository versioning tools record that decision, but they cannot determine whether a consumer will be broken. Write the release note from the consumer's point of view.
32
+
33
+ ## Keep Reading
34
+
35
+ - [Publishing A Package](./publish-basic-npm-package.md)
36
+ - [Modern Package Guide](./modern/)
@@ -1,5 +1,22 @@
1
1
  {
2
- "$schema": "https://unpkg.com/wrangler/config-schema.json",
3
- "name": "monorepo-template",
4
- "pages_build_output_dir": ".vitepress/dist"
2
+ "$schema": "./node_modules/wrangler/config-schema.json",
3
+ "name": "repoctl-docs",
4
+ "compatibility_date": "2026-08-16",
5
+ "compatibility_flags": ["nodejs_compat"],
6
+ "workers_dev": false,
7
+ "preview_urls": true,
8
+ "assets": {
9
+ "directory": ".vitepress/dist",
10
+ "not_found_handling": "404-page"
11
+ },
12
+ "routes": [
13
+ {
14
+ "pattern": "repoctl.icebreaker.top",
15
+ "custom_domain": true
16
+ }
17
+ ],
18
+ "observability": {
19
+ "enabled": true,
20
+ "head_sampling_rate": 1
21
+ }
5
22
  }
@@ -16,7 +16,7 @@ AI 文档入口用于给 Cursor、Claude Code、Codex 和其他 AI 编程工具
16
16
 
17
17
  ## 2. 在 AI 工具里怎么用
18
18
 
19
- 优先把 `https://repo.icebreaker.top/llms.txt` 作为入口提供给 AI 工具。只有当工具不能继续抓取链接,或者你需要离线提供完整上下文时,再使用 `https://repo.icebreaker.top/llms-full.txt`。
19
+ 优先把 `https://repoctl.icebreaker.top/llms.txt` 作为入口提供给 AI 工具。只有当工具不能继续抓取链接,或者你需要离线提供完整上下文时,再使用 `https://repoctl.icebreaker.top/llms-full.txt`。
20
20
 
21
21
  ```txt
22
22
  先给 llms.txt
@@ -16,7 +16,7 @@ description: 使用 llms.txt 为大语言模型提供更易读取的 repoctl 文
16
16
 
17
17
  ## 1. 使用方式
18
18
 
19
- 访问 `https://repo.icebreaker.top/llms.txt` 可以获取当前文档的 LLM 索引。如果需要一次性提供完整上下文,可以使用 `https://repo.icebreaker.top/llms-full.txt`。
19
+ 访问 `https://repoctl.icebreaker.top/llms.txt` 可以获取当前文档的 LLM 索引。如果需要一次性提供完整上下文,可以使用 `https://repoctl.icebreaker.top/llms-full.txt`。
20
20
 
21
21
  当你在 Cursor、Claude Code、Codex 或其他 AI 编程工具里引用 repoctl 文档时,优先提供 `llms.txt`,再按需要补充具体页面链接。
22
22
 
@@ -1,66 +1,9 @@
1
1
  ---
2
- layout: home
3
-
4
- hero:
5
- name: repoctl
6
- text: 让 pnpm monorepo 的日常操作更短、更稳
7
- tagline: 用一套 CLI 管理初始化、诊断、创建模板、提交前校验和模板资产同步。
8
- image:
9
- src: /logo.jpg
10
- alt: repoctl logo
11
- actions:
12
- - theme: brand
13
- text: 快速开始
14
- link: /zh/repoctl/getting-started
15
- - theme: alt
16
- text: 命令速查
17
- link: /zh/repoctl/commands
18
- - theme: alt
19
- text: AI 文档入口
20
- link: /zh/ai/
21
-
22
- features:
23
- - title: 从已有仓库开始
24
- details: 安装 repoctl 后运行 setup 和 doctor,先把 workspace、根脚本、配置冲突和提交链路检查清楚。
25
- - title: 用模板创建包和应用
26
- details: repo new 支持交互式创建、指定模板、dry-run、JSON 输出和创建计划落盘。
27
- - title: 把质量门禁变成日常命令
28
- details: repo check 统一预览和执行 lint、typecheck、build、test、tsd 等推荐校验。
29
- - title: 给 AI 工具的文档入口
30
- details: 构建时自动生成 llms.txt、llms-full.txt 和页面 Markdown,让 AI 编程工具更容易读取 repoctl 文档。
2
+ layout: page
3
+ aside: false
4
+ pageClass: repoctl-home-page
5
+ title: repoctl
6
+ description: 面向 pnpm 与 Turborepo monorepo 的任务型 CLI。
31
7
  ---
32
8
 
33
- ## 最短路径
34
-
35
- ```bash
36
- pnpm add -D repoctl
37
- pnpm exec repo init
38
- pnpm exec repo doctor
39
- pnpm exec repo new
40
- pnpm exec repo check
41
- ```
42
-
43
- 在由 repoctl 创建或初始化的仓库里,同一套工作流会暴露成更短的根脚本:
44
-
45
- ```bash
46
- pnpm run repo:init
47
- pnpm run repo:doctor
48
- pnpm run repo:new
49
- pnpm run repo:check
50
- ```
51
-
52
- ## 你可以继续阅读
53
-
54
- - [repoctl 概览](./repoctl/index.md)
55
- - [快速开始](./repoctl/getting-started.md)
56
- - [接入已有仓库](./repoctl/adopt-existing.md)
57
- - [按场景选命令](./repoctl/scenarios.md)
58
- - [执行模型](./repoctl/execution-model.md)
59
- - [命令速查](./repoctl/commands.md)
60
- - [校验链路](./repoctl/checks.md)
61
- - [doctor 诊断](./repoctl/doctor.md)
62
- - [配置文件](./repoctl/config.md)
63
- - [模板与创建](./repoctl/templates.md)
64
- - [模板资产治理](./repoctl/template-assets.md)
65
- - [工作流与 CI](./repoctl/workflows.md)
66
- - [报告与自动化输出](./repoctl/reports.md)
9
+ <HomePage locale="zh" />
@@ -110,6 +110,41 @@ repo ws ls --json --out reports/workspaces.json
110
110
  | 输出给脚本 | `--json --out <file>` |
111
111
  | 输出给人看并脱敏 | `--markdown --redact --out <file>` |
112
112
 
113
+ ## 文档 Worker
114
+
115
+ repoctl 文档通过名为 `repoctl-docs` 的 Cloudflare Worker 部署。VitePress 只生成静态资产,Workers Static Assets 直接提供这些文件,因此不需要应用 handler,也不声明 `ASSETS` binding。
116
+
117
+ ### Workers Builds 配置
118
+
119
+ | 配置项 | 值 |
120
+ | ---------- | ------------------------------------------------------- |
121
+ | 仓库根目录 | 仓库根目录 |
122
+ | 生产分支 | `main` |
123
+ | 构建命令 | `pnpm --filter @icebreakers/website build` |
124
+ | 生产部署 | `pnpm --filter @icebreakers/website run deploy` |
125
+ | 非生产部署 | `pnpm --filter @icebreakers/website run deploy:preview` |
126
+
127
+ 构建命令会先校验双语页面,再由 VitePress 生成 `.vitepress/dist`。Worker 配置会为不存在的路由返回生成后的 `404.html`,并继续读取 `public/_redirects`,兼容旧的 `/en/*` 链接。
128
+
129
+ ### 预览、发布与回滚
130
+
131
+ 修改生产部署前,先完成本地验证:
132
+
133
+ ```bash
134
+ pnpm --filter @icebreakers/website build
135
+ pnpm --filter @icebreakers/website run deploy:dry-run
136
+ pnpm --filter @icebreakers/website exec wrangler dev
137
+ ```
138
+
139
+ 非生产 Workers Builds 上传预览版本。验证通过后再执行生产部署。需要回滚时,先查看版本历史,再选择最近的稳定版本:
140
+
141
+ ```bash
142
+ pnpm --filter @icebreakers/website exec wrangler versions list
143
+ pnpm --filter @icebreakers/website exec wrangler rollback <VERSION_ID>
144
+ ```
145
+
146
+ `repoctl.icebreaker.top` 是唯一 canonical custom domain。Cloudflare Redirect Rules 把 `repo.icebreaker.top/*` 和 `monorepo.icebreaker.top/*` 永久跳转到主域名,同时保留路径和查询参数。
147
+
113
148
  ## 下一步
114
149
 
115
150
  - 查所有参数:[命令速查](./commands.md)
@@ -69,17 +69,20 @@
69
69
 
70
70
  此外,模板里还有许多为 `GitHub` 显示优化的 `md` 文档。
71
71
 
72
- ## 部署
72
+ ## 文档部署
73
73
 
74
- 文档网站通过 `netlify.toml` 配置部署在 `Netlify` 上。最初我使用的是 `Vercel`,但由于**国内**访问速度的原因,最终迁移到了 `Netlify`。
74
+ 文档是一个 VitePress 静态站点,以名为 `repoctl-docs` 的 Cloudflare Worker 发布。Workers Static Assets 直接托管 `.vitepress/dist`,同时处理自定义 404 页面和 `_redirects` 兼容规则。站点没有动态请求逻辑,因此不额外编写 Worker handler,也不声明 `ASSETS` binding。
75
75
 
76
- 而且由于我是开源项目贡献者的原因,`Netlify` 为我 `免费` 提供了 `Pro` 版本的计划 (通常这需要 `$19/per member/month`)
76
+ Cloudflare Workers Builds 从仓库根目录执行:
77
77
 
78
- 感谢 `Netlify`! 爱你❤️😍。
78
+ ```bash
79
+ pnpm --filter @icebreakers/website build
80
+ pnpm --filter @icebreakers/website run deploy
81
+ ```
79
82
 
80
- 如果看到这里的哥们,你也有一定影响力的开源项目,也可以通过下方的链接申请。
83
+ 非生产分支使用 `pnpm --filter @icebreakers/website run deploy:preview` 上传预览版本。生产发布前运行 `pnpm --filter @icebreakers/website run deploy:dry-run`,校验静态资产清单和 Wrangler 配置。需要回滚时,先用 `wrangler versions list` 确认版本,再执行 `wrangler rollback <VERSION_ID>`。
81
84
 
82
- https://www.netlify.com/legal/open-source-policy/
85
+ 唯一主域名是 `https://repoctl.icebreaker.top`。`repo.icebreaker.top` 和 `monorepo.icebreaker.top` 只作为兼容入口,由 Cloudflare 301 跳转到主域名,并保留原路径与查询参数。
83
86
 
84
87
  ## 总结
85
88
 
@@ -1 +1 @@
1
- https://repo.icebreaker.top/
1
+ https://repoctl.icebreaker.top/
@@ -1 +1 @@
1
- https://repo.icebreaker.top/
1
+ https://repoctl.icebreaker.top/
@@ -1 +1,38 @@
1
- # 从 0 到 1 构建 monorepo
1
+ # 包的演进
2
+
3
+ 一个可发布的 npm 包不只是源代码目录。消费者依赖它的运行时格式、类型声明、入口点、发布文件和兼容性承诺。这里按这些公开边界整理现代包的基础知识。
4
+
5
+ ## 先从消费者开始
6
+
7
+ 在选择打包器或模块格式前,先回答:
8
+
9
+ - 消费者使用 ESM、CommonJS,还是两者都需要?
10
+ - 包发布运行时代码、类型、CLI、配置预设还是资源?
11
+ - 需要支持哪些 Node 版本?
12
+ - 对外只暴露一个入口,还是需要明确的子路径?
13
+
14
+ 这些答案定义了包的边界。工具链应该实现边界,而不是替代边界决策。
15
+
16
+ ## 推荐目录
17
+
18
+ ```text
19
+ src/ 源代码
20
+ dist/ 生成的 ESM、CommonJS 与声明文件
21
+ package.json 公开 metadata 与 exports 映射
22
+ README.md 安装和使用契约
23
+ ```
24
+
25
+ 使用 `files` 控制发布内容,并在发布前执行 `npm pack --dry-run` 检查实际 tarball。
26
+
27
+ ## 专题
28
+
29
+ - [ESM 与 CommonJS](./modern/esm-vs-cjs.md)
30
+ - [类型声明](./modern/dts.md)
31
+ - [包入口](./modern/package-entry-points.md)
32
+ - [构建工具](./modern/bundlers.md)
33
+ - [TypeScript](./modern/typescript.md)
34
+
35
+ ## 继续阅读
36
+
37
+ - [什么是 npm 包](./what-is-npm-package.md)
38
+ - [发布 npm 包](./publish-basic-npm-package.md)
@@ -6,7 +6,7 @@
6
6
  "description": "Internal Vue library template shipped with repoctl",
7
7
  "author": "ice breaker <hi@sonofmagic.top>",
8
8
  "license": "ISC",
9
- "homepage": "https://repo.icebreaker.top",
9
+ "homepage": "https://repoctl.icebreaker.top",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "git+https://github.com/sonofmagic/repoctl.git",
@@ -1,51 +0,0 @@
1
- "@icebreakers/monorepo-templates@1.1.0":
2
- dir: packages/monorepo-templates
3
- intents:
4
- - pnpm-native-versioning
5
- - release-ci-token
6
- - repoctl-release-orchestration
7
- - vitest-native-config
8
- "@icebreakers/monorepo-templates@1.2.0":
9
- dir: packages/monorepo-templates
10
- intents:
11
- - repoctl-brand-and-i18n
12
- "@icebreakers/monorepo@5.1.0":
13
- dir: packages/monorepo
14
- intents:
15
- - close-legacy-release-pr
16
- - human-readable-release-notes
17
- - pnpm-native-versioning
18
- - publish-versioned-packages
19
- - release-ci-token
20
- - release-links
21
- - release-npm-links
22
- - release-npm-links-prepublish
23
- - release-pr-body
24
- - release-pr-layout
25
- - release-test-isolation
26
- - repoctl-release-orchestration
27
- "@icebreakers/monorepo@5.1.1":
28
- dir: packages/monorepo
29
- intents:
30
- - release-publish-summary
31
- - repair-release-notes
32
- "@icebreakers/monorepo@5.2.0":
33
- dir: packages/monorepo
34
- intents:
35
- - repoctl-brand-and-i18n
36
- create-icebreaker@1.1.0:
37
- dir: packages/create-icebreaker
38
- intents:
39
- - pnpm-native-versioning
40
- create-icebreaker@1.1.1:
41
- dir: packages/create-icebreaker
42
- intents:
43
- - repoctl-brand-and-i18n
44
- create-repoctl@0.1.0:
45
- dir: packages/create-repoctl
46
- intents:
47
- - repoctl-brand-and-i18n
48
- repoctl@5.2.0:
49
- dir: packages/repoctl
50
- intents:
51
- - repoctl-brand-and-i18n
@@ -1,14 +0,0 @@
1
- [build]
2
- publish = "dist"
3
- command = "pnpm run build"
4
-
5
- [build.environment]
6
- NODE_VERSION = "22"
7
-
8
- [[redirects]]
9
- from = "/*"
10
- to = "/index.html"
11
- status = 200
12
-
13
- [context.deploy-preview]
14
- ignore = "exit 0"