@modern-js/main-doc 0.0.0-next-1686037191101 → 0.0.0-next-1686045734613
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/CHANGELOG.md +9 -4
- package/docs/en/components/debug-app.mdx +1 -1
- package/docs/en/components/deploy.mdx +1 -0
- package/docs/en/components/init-app.mdx +3 -7
- package/docs/en/components/release-note.mdx +1 -0
- package/docs/en/guides/get-started/glossary.mdx +12 -12
- package/docs/en/guides/get-started/introduction.mdx +17 -20
- package/docs/en/guides/get-started/quick-start.mdx +21 -37
- package/docs/en/guides/get-started/upgrade.mdx +15 -14
- package/docs/en/guides/topic-detail/changesets/add.mdx +16 -14
- package/docs/en/guides/topic-detail/changesets/changelog.mdx +28 -28
- package/docs/en/guides/topic-detail/changesets/commit.mdx +23 -23
- package/docs/en/guides/topic-detail/changesets/config.mdx +10 -10
- package/docs/en/guides/topic-detail/changesets/github.mdx +12 -12
- package/docs/en/guides/topic-detail/changesets/introduce.mdx +13 -13
- package/docs/en/guides/topic-detail/changesets/release-note.mdx +38 -34
- package/docs/en/guides/topic-detail/changesets/release-pre.mdx +6 -6
- package/docs/en/guides/topic-detail/changesets/release.mdx +42 -42
- package/docs/zh/community/blog/v2-release-note.mdx +1 -1
- package/docs/zh/components/init-app.mdx +5 -9
- package/docs/zh/guides/get-started/quick-start.mdx +7 -10
- package/docs/zh/guides/get-started/upgrade.mdx +1 -1
- package/docs/zh/guides/topic-detail/changesets/add.mdx +10 -8
- package/docs/zh/guides/topic-detail/changesets/changelog.mdx +9 -9
- package/docs/zh/guides/topic-detail/changesets/commit.mdx +10 -10
- package/docs/zh/guides/topic-detail/changesets/config.mdx +1 -1
- package/docs/zh/guides/topic-detail/changesets/github.mdx +9 -9
- package/docs/zh/guides/topic-detail/changesets/introduce.mdx +9 -9
- package/docs/zh/guides/topic-detail/changesets/release-note.mdx +28 -24
- package/docs/zh/guides/topic-detail/changesets/release-pre.mdx +5 -5
- package/docs/zh/guides/topic-detail/changesets/release.mdx +22 -22
- package/package.json +5 -5
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
sidebar_position: 3
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
# Publishing
|
|
5
|
+
# Publishing Version
|
|
6
6
|
|
|
7
|
-
When releasing a version, we need to upgrade the version
|
|
7
|
+
When releasing a version, we need to upgrade the version of the corresponding packages based on the changeset generated during development, and run the publish command to publish them to NPM.
|
|
8
8
|
|
|
9
9
|
## Steps
|
|
10
10
|
|
|
11
11
|
:::info
|
|
12
|
-
The following example commands are all using pnpm
|
|
12
|
+
The following example commands are all using pnpm. If you need to use other package management tools, please replace them as needed.
|
|
13
13
|
|
|
14
14
|
:::
|
|
15
15
|
|
|
16
16
|
### Npm Module
|
|
17
17
|
|
|
18
|
-
#### Run the
|
|
18
|
+
#### Run the bump command in the root directory
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
21
|
pnpm run bump
|
|
@@ -27,18 +27,18 @@ When running this command, changesets will automatically perform the following o
|
|
|
27
27
|
|
|
28
28
|
- Delete all changeset files under the `.changesets` directory.
|
|
29
29
|
|
|
30
|
-
- Upgrade the package version
|
|
30
|
+
- Upgrade the package version based on the changeset information.
|
|
31
31
|
|
|
32
|
-
- Write
|
|
32
|
+
- Write changelog information to the `CHANGELOG.md` file in the root directory. The file will be automatically created if it does not exist.
|
|
33
33
|
|
|
34
|
-
#### Confirm and submit the current changes
|
|
34
|
+
#### Confirm and submit the current changes
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
37
|
git add .
|
|
38
38
|
git commit -m "release: bump package"
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
#### Run the
|
|
41
|
+
#### Run the release command in the root directory to publish the package to NPM
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
44
|
pnpm run release
|
|
@@ -46,7 +46,7 @@ pnpm run release
|
|
|
46
46
|
|
|
47
47
|

|
|
48
48
|
|
|
49
|
-
#### Push the
|
|
49
|
+
#### Push the tag to the remote repository
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
52
|
git push --follow-tags
|
|
@@ -54,7 +54,7 @@ git push --follow-tags
|
|
|
54
54
|
|
|
55
55
|
### Monorepo
|
|
56
56
|
|
|
57
|
-
#### Run the
|
|
57
|
+
#### Run the bmp command in the root directory
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
60
|
pnpm run bump
|
|
@@ -66,14 +66,14 @@ When running this command, changesets will automatically perform the following o
|
|
|
66
66
|
|
|
67
67
|
- Delete all changeset files under the `.changesets` directory.
|
|
68
68
|
|
|
69
|
-
- Upgrade the version
|
|
69
|
+
- Upgrade the version of the relevant packages based on the changeset information. In addition to the packages written in the changeset, changesets will also analyze the dependency graph of all packages in the Monorepo during running. If is required, the version will be automatically upgraded accordingly.
|
|
70
70
|
|
|
71
|
-
- Write
|
|
71
|
+
- Write changelog to the `CHANGELOG.md` file in the directory of the package that needs to be upgraded. The file will be automatically created if it does not exist.
|
|
72
72
|
|
|
73
|
-
#### Confirm and submit the current changes
|
|
73
|
+
#### Confirm and submit the current changes
|
|
74
74
|
|
|
75
75
|
:::info
|
|
76
|
-
Make sure that the automatically upgraded version
|
|
76
|
+
Make sure that the automatically upgraded version meet the expected requirements. If you need to understand the version upgrade strategy, please refer to [Version Upgrade Strategy](/guides/topic-detail/changesets/release#version-upgrade-strategy).
|
|
77
77
|
:::
|
|
78
78
|
|
|
79
79
|
```bash
|
|
@@ -81,19 +81,19 @@ git add .
|
|
|
81
81
|
git commit -m "release: bump package"
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
#### Run the
|
|
84
|
+
#### Run the release command in the root directory to publish the package to NPM
|
|
85
85
|
|
|
86
86
|
```bash
|
|
87
87
|
pnpm run release
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
When running this command, it will sequentially determine whether the versions of all packages in the Monorepo exist on NPM. If they do not exist, the `publish` command will be
|
|
90
|
+
When running this command, it will sequentially determine whether the versions of all packages in the Monorepo exist on NPM. If they do not exist, the `publish` command will be run to publish them.
|
|
91
91
|
|
|
92
92
|
:::warning
|
|
93
|
-
When the dependencies between packages in the Monorepo are declared using workspace, do not directly
|
|
93
|
+
When the dependencies between packages in the Monorepo are declared using workspace, do not directly run `npm publish` to publish the package in the corresponding subdirectory of the package. Use the `release` command instead. When publishing, the workspace declaration will be automatically removed to ensure that the NPM package is available after publishing.
|
|
94
94
|
:::
|
|
95
95
|
|
|
96
|
-
#### Push the
|
|
96
|
+
#### Push the tag to the remote repository
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
99
|
git push --follow-tags
|
|
@@ -103,17 +103,17 @@ git push --follow-tags
|
|
|
103
103
|
|
|
104
104
|
### Parameters for the `bump` command
|
|
105
105
|
|
|
106
|
-
- `--snapshot
|
|
106
|
+
- `--snapshot`: Generates a timestamp-based version.
|
|
107
107
|
|
|
108
108
|
```bash
|
|
109
109
|
pnpm run bump --snapshot canary
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
After running, the corresponding upgraded version
|
|
112
|
+
After running, the corresponding upgraded version will become `0.0.0-canary-20220622092823`, and `canary` is the tag configured for snapshot. If not configured, it will directly generate the form of `0.0.0-20220622092823`.
|
|
113
113
|
|
|
114
114
|
This parameter is mainly used to publish temporary test versions for testing and does not require code submission.
|
|
115
115
|
|
|
116
|
-
- `--ignore
|
|
116
|
+
- `--ignore`: Manually ignore some packages during publishing.
|
|
117
117
|
|
|
118
118
|
For example, if you need to ignore the `module-2` package for this release:
|
|
119
119
|
|
|
@@ -121,7 +121,7 @@ For example, if you need to ignore the `module-2` package for this release:
|
|
|
121
121
|
pnpm run bump --ignore module-2
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
After
|
|
124
|
+
After running the command, the update of the `module-2` package will be ignored. Note that if there are packages that depend on `module-2`, the corresponding packages also need to be added to the `ignore` parameter, otherwise the `bump` command will fail.
|
|
125
125
|
|
|
126
126
|
The usage for adding multiple packages is as follows:
|
|
127
127
|
|
|
@@ -131,29 +131,29 @@ pnpm run bump --ignore module-2 --ignore module-3
|
|
|
131
131
|
|
|
132
132
|
### Parameters for the `release` command
|
|
133
133
|
|
|
134
|
-
- `--otp
|
|
134
|
+
- `--otp`: Uses `npm token` to publish the package.
|
|
135
135
|
|
|
136
136
|
```bash
|
|
137
137
|
pnpm run relese --otp <token>
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
-
- `--tag
|
|
140
|
+
- `--tag`: Uses a specific tag for publishing, and `latest` is used by default.
|
|
141
141
|
|
|
142
142
|
```bash
|
|
143
143
|
pnpm run release --tag <tag>
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
- `--ignore-scripts
|
|
146
|
+
- `--ignore-scripts`: Ignores npm scripts during publishing.
|
|
147
147
|
|
|
148
|
-
When
|
|
148
|
+
When running the `publish` command, npm will automatically trigger many commands, such as `prepare` and `prepublish`. Using this parameter can ignore the running of these commands. This parameter is only supported in Monorepo using pnpm.
|
|
149
149
|
|
|
150
150
|
```bash
|
|
151
151
|
pnpm run release --ignore-scripts
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
- `--no-git-checks
|
|
154
|
+
- `--no-git-checks`: Ignores checking the current branch during publishing.
|
|
155
155
|
|
|
156
|
-
By default, when
|
|
156
|
+
By default, when running the `release` command, it will automatically check whether the current branch is a release branch, whether there are uncommitted changes, etc. Using this parameter can ignore git-related checks.
|
|
157
157
|
|
|
158
158
|
```bash
|
|
159
159
|
pnpm run release --no-git-checks
|
|
@@ -161,9 +161,9 @@ pnpm run release --no-git-checks
|
|
|
161
161
|
|
|
162
162
|
## Version Upgrade Strategy
|
|
163
163
|
|
|
164
|
-
### dependencies or devDependencies
|
|
164
|
+
### dependencies or devDependencies
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
- Only upgrade the patch version of the package itself for patch version
|
|
167
167
|
|
|
168
168
|
For example, the following scenario exists:
|
|
169
169
|
|
|
@@ -171,9 +171,9 @@ There are two packages in Monorepo, `module-1` and `module-2`, and `module-1` ex
|
|
|
171
171
|
|
|
172
172
|
The current changeset is the patch version upgrade of `module-1`.
|
|
173
173
|
|
|
174
|
-
After
|
|
174
|
+
After running the `bump` command, only the patch version of `module-1` will be upgraded.
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
- Upgrade the major or minor version of the package itself for major/minor version upgrades, and upgrade the patch version of the dependent packages
|
|
177
177
|
|
|
178
178
|
For example, the following scenario exists:
|
|
179
179
|
|
|
@@ -181,11 +181,11 @@ There are two packages in Monorepo, `module-1` and `module-2`, and `module-1` ex
|
|
|
181
181
|
|
|
182
182
|
The current changeset is the minor version upgrade of `module-1`.
|
|
183
183
|
|
|
184
|
-
After
|
|
184
|
+
After running the `bump` command, `module-1` will upgrade the `minor` version, and `module-2` will upgrade the `patch` version number.
|
|
185
185
|
|
|
186
|
-
### peerDependencies
|
|
186
|
+
### peerDependencies
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
- Upgrade the patch version of the package itself and the dependent package for patch version dependencies
|
|
189
189
|
|
|
190
190
|
For example, the following scenario exists:
|
|
191
191
|
|
|
@@ -193,9 +193,9 @@ There are two packages in Monorepo, `module-1` and `module-2`, and `module-1` ex
|
|
|
193
193
|
|
|
194
194
|
The current changeset is the patch version upgrade of `module-1`.
|
|
195
195
|
|
|
196
|
-
After
|
|
196
|
+
After running the `bump` command, both `module-1` and `module-2` will upgrade the patch version.
|
|
197
197
|
|
|
198
|
-
|
|
198
|
+
- Upgrade the major version of the dependent package for major/minor version upgrades of the package itself
|
|
199
199
|
|
|
200
200
|
For example, the following scenario exists:
|
|
201
201
|
|
|
@@ -203,9 +203,9 @@ There are two packages in Monorepo, `module-1` and `module-2`, and `module-1` ex
|
|
|
203
203
|
|
|
204
204
|
The current changeset is the minor version upgrade of `module-1`.
|
|
205
205
|
|
|
206
|
-
After
|
|
206
|
+
After running the bump command, `module-1` will upgrade the `minor` version, and `module-2` will upgrade the `major` version number.
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
- Modify the upgrade strategy for peerDependencies
|
|
209
209
|
|
|
210
210
|
The upgrade strategy of `peerDependencies` can be modified by configuring `onlyUpdatePeerDependentsWhenOutOfRange`. When only the declared version type range is exceeded, the corresponding `peerDependencies` will be upgraded.
|
|
211
211
|
|
|
@@ -220,10 +220,10 @@ The upgrade strategy of `peerDependencies` can be modified by configuring `onlyU
|
|
|
220
220
|
|
|
221
221
|
For example, the following scenario exists:
|
|
222
222
|
|
|
223
|
-
There are two packages in Monorepo, `module-1` and `module-2`, and `module-1` exists in the `peerDependencies` of `module-2`, and the version
|
|
223
|
+
There are two packages in Monorepo, `module-1` and `module-2`, and `module-1` exists in the `peerDependencies` of `module-2`, and the version of `module-1` is declared using `^`.
|
|
224
224
|
|
|
225
225
|
The current changeset is the patch or minor version upgrade of `module-1`.
|
|
226
226
|
|
|
227
|
-
After
|
|
227
|
+
After running the `bump` command, only the version of `module-1` will be upgraded.
|
|
228
228
|
|
|
229
|
-
Note that if the package version
|
|
229
|
+
Note that if the package version is in the `0.x.x` range, upgrading the `minor` version is also beyond the declared version type range.
|
|
@@ -71,7 +71,7 @@ sidebar_position: 97
|
|
|
71
71
|
|
|
72
72
|
<div style={{ textAlign: 'center', fontStyle: 'italic' }}>Rspack Logo</div>
|
|
73
73
|
|
|
74
|
-
相较于
|
|
74
|
+
相较于 webpack,Rspack 的构建性能有明显提升,除了 Rust 带来的语言优势,这也来自于它的并行架构和增量编译等特性。经过 benchmark 验证,**Rspack 可以给 Modern.js 项目带来 5 ~ 10 倍编译性能的提升。**
|
|
75
75
|
|
|
76
76
|

|
|
77
77
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
`@modern-js/create` 会提供一个可交互的问答界面,根据结果初始化项目,按照默认的选择进行初始化:
|
|
2
2
|
|
|
3
3
|
```bash
|
|
4
|
-
?
|
|
5
|
-
?
|
|
6
|
-
?
|
|
4
|
+
? 请选择你想创建的工程类型 Web 应用
|
|
5
|
+
? 请选择开发语言 TS
|
|
6
|
+
? 请选择包管理工具 pnpm
|
|
7
|
+
? 请选择构建工具 webpack
|
|
7
8
|
```
|
|
8
9
|
|
|
9
10
|
在生成项目后,Modern.js 会自动安装依赖、创建 git 仓库。
|
|
@@ -20,11 +21,6 @@ pnpm run lint # 运行 ESLint 并自动修复问题
|
|
|
20
21
|
pnpm run new # 启用可选功能或创建项目要素
|
|
21
22
|
```
|
|
22
23
|
|
|
23
|
-
:::note
|
|
24
|
-
Modern.js 生成器除了在项目初始化时工作外,也能在后续研发中生成项目各种粒度的模块,并非一用即抛开。
|
|
25
|
-
|
|
26
|
-
:::
|
|
27
|
-
|
|
28
24
|
现在,项目结构如下:
|
|
29
25
|
|
|
30
26
|
```
|
|
@@ -12,9 +12,9 @@ import Prerequisites from "@site-docs/components/prerequisites"
|
|
|
12
12
|
|
|
13
13
|
## 安装
|
|
14
14
|
|
|
15
|
-
Modern.js 提供了 `@modern-js/create`
|
|
15
|
+
Modern.js 提供了 `@modern-js/create` 工具来创建项目,不要全局安装,使用 `npx` 按需运行。
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
可以在已有的空目录来创建项目:
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
20
|
mkdir myapp && cd myapp
|
|
@@ -41,9 +41,9 @@ import DebugApp from "@site-docs/components/debug-app"
|
|
|
41
41
|
|
|
42
42
|
## 使用配置
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
通过 `@modern-js/create` 创建的 Modern.js 项目中,会默认生成 `modern.config.ts` 文件。
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
可以通过该配置文件修改配置,覆盖 Modern.js 的默认行为。例如添加如下配置,开启 SSR:
|
|
47
47
|
|
|
48
48
|
```ts title="modern.config.ts"
|
|
49
49
|
import appTools, { defineConfig } from '@modern-js/app-tools';
|
|
@@ -51,7 +51,6 @@ import appTools, { defineConfig } from '@modern-js/app-tools';
|
|
|
51
51
|
export default defineConfig({
|
|
52
52
|
runtime: {
|
|
53
53
|
router: true,
|
|
54
|
-
state: true,
|
|
55
54
|
},
|
|
56
55
|
server: {
|
|
57
56
|
ssr: true,
|
|
@@ -93,14 +92,12 @@ info File sizes after production build:
|
|
|
93
92
|
构建产物默认生成到 `dist/`,目录结构如下:
|
|
94
93
|
|
|
95
94
|
```
|
|
96
|
-
|
|
97
|
-
├── asset-manifest.json
|
|
95
|
+
dist
|
|
98
96
|
├── html
|
|
99
|
-
│
|
|
100
|
-
├── loader-routes
|
|
101
|
-
│ └── main
|
|
97
|
+
│ └── main
|
|
102
98
|
├── modern.config.json
|
|
103
99
|
├── route.json
|
|
100
|
+
├── routes-manifest.json
|
|
104
101
|
└── static
|
|
105
102
|
├── css
|
|
106
103
|
└── js
|
|
@@ -25,13 +25,13 @@ sidebar_position: 2
|
|
|
25
25
|
|
|
26
26
|
### 模块工程方案
|
|
27
27
|
|
|
28
|
-
####
|
|
28
|
+
#### 在根目录执行 change 命令
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
31
|
pnpm run change
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
####
|
|
34
|
+
#### 选择本次变更需要升级的版本号类型
|
|
35
35
|
|
|
36
36
|

|
|
37
37
|
|
|
@@ -55,13 +55,13 @@ feat: test module solution changeset
|
|
|
55
55
|
|
|
56
56
|
我们假设 monorepo 中存在三个模块包,分别为 `module-1`,`module-2`,`module-3`。
|
|
57
57
|
|
|
58
|
-
####
|
|
58
|
+
#### 在根目录执行 change 命令
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
61
|
pnpm run change
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
####
|
|
64
|
+
#### 选择本次需要升级的包列表
|
|
65
65
|
|
|
66
66
|
Changesets 会根据当前代码变更(`git diff Head...baseBranch`),将 Monorepo 中的 package 分为两类,`changed packages` 和 `unchanged packages`,方便用户进行选择。
|
|
67
67
|
|
|
@@ -69,11 +69,13 @@ Changesets 会根据当前代码变更(`git diff Head...baseBranch`),将 Monor
|
|
|
69
69
|
|
|
70
70
|

|
|
71
71
|
|
|
72
|
-
####
|
|
72
|
+
#### 分别选择不同版本类型对应的包
|
|
73
|
+
|
|
74
|
+
changeset 会询问 `major` 和 `minor` 类型,如果存在包未选择这两种类型,将会默认使用 `patch` 类型。
|
|
73
75
|
|
|
74
76
|

|
|
75
77
|
|
|
76
|
-
#### 填入 changelog
|
|
78
|
+
#### 填入 changelog 信息
|
|
77
79
|
|
|
78
80
|

|
|
79
81
|
|
|
@@ -94,7 +96,7 @@ feat: test-changeset
|
|
|
94
96
|
|
|
95
97
|
change 命令支持以下参数:
|
|
96
98
|
|
|
97
|
-
- `--empty
|
|
99
|
+
- `--empty`: 添加一个空的 changeset。
|
|
98
100
|
|
|
99
101
|
```bash
|
|
100
102
|
pnpm run change --empty
|
|
@@ -107,7 +109,7 @@ pnpm run change --empty
|
|
|
107
109
|
---
|
|
108
110
|
```
|
|
109
111
|
|
|
110
|
-
- `--open
|
|
112
|
+
- `--open`: 使用该参数时,在填写 changelog 步骤会打开系统默认编辑器进行填写。
|
|
111
113
|
|
|
112
114
|
## 注意事项
|
|
113
115
|
|
|
@@ -164,7 +164,7 @@ module.exports = {
|
|
|
164
164
|
|
|
165
165
|
自定义 changelog 还可以使用模块工程方案进行管理,提供通用方案。
|
|
166
166
|
|
|
167
|
-
#### 使用 `npx @modern-js/create@latest`
|
|
167
|
+
#### 使用 `npx @modern-js/create@latest` 创建模块工程方案
|
|
168
168
|
|
|
169
169
|
```md
|
|
170
170
|
? 请选择你想创建的工程类型:Npm 模块
|
|
@@ -173,7 +173,7 @@ module.exports = {
|
|
|
173
173
|
? 请选择包管理工具:pnpm
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
-
####
|
|
176
|
+
#### 实现自定义内容
|
|
177
177
|
|
|
178
178
|
```ts title="src/index.ts"
|
|
179
179
|
export async function getReleaseLine() {}
|
|
@@ -181,11 +181,11 @@ export async function getReleaseLine() {}
|
|
|
181
181
|
export async function getDependencyReleaseLine() {}
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
-
#### 将模块发布到 NPM
|
|
184
|
+
#### 将模块发布到 NPM
|
|
185
185
|
|
|
186
|
-
#### 在目标仓库根目录安装对应模块,例如 `custom-changelog
|
|
186
|
+
#### 在目标仓库根目录安装对应模块,例如 `custom-changelog`
|
|
187
187
|
|
|
188
|
-
#### 配置 changeset 的 changelog
|
|
188
|
+
#### 配置 changeset 的 changelog 配置为包名称
|
|
189
189
|
|
|
190
190
|
```json title=".changesets/config.json"
|
|
191
191
|
{
|
|
@@ -198,7 +198,7 @@ export async function getDependencyReleaseLine() {}
|
|
|
198
198
|
|
|
199
199
|
如果你当前仓库为 Monorepo 工程方案,可以直接使用模块子项目进行管理。
|
|
200
200
|
|
|
201
|
-
#### 执行 `pnpm run new`
|
|
201
|
+
#### 执行 `pnpm run new` 创建模块子项目
|
|
202
202
|
|
|
203
203
|
```md
|
|
204
204
|
? 请选择你想创建的工程类型:Npm 模块
|
|
@@ -207,7 +207,7 @@ export async function getDependencyReleaseLine() {}
|
|
|
207
207
|
? 请选择开发语言:TS
|
|
208
208
|
```
|
|
209
209
|
|
|
210
|
-
####
|
|
210
|
+
#### 实现自定义内容
|
|
211
211
|
|
|
212
212
|
```ts title="src/index.ts"
|
|
213
213
|
export async function getReleaseLine() {}
|
|
@@ -215,7 +215,7 @@ export async function getReleaseLine() {}
|
|
|
215
215
|
export async function getDependencyReleaseLine() {}
|
|
216
216
|
```
|
|
217
217
|
|
|
218
|
-
#### 在 Monorepo 根目录添加子项目模块依赖,例如 `custom-changelog
|
|
218
|
+
#### 在 Monorepo 根目录添加子项目模块依赖,例如 `custom-changelog`
|
|
219
219
|
|
|
220
220
|
```json title="package.json"
|
|
221
221
|
{
|
|
@@ -226,7 +226,7 @@ export async function getDependencyReleaseLine() {}
|
|
|
226
226
|
}
|
|
227
227
|
```
|
|
228
228
|
|
|
229
|
-
#### 配置 changeset 的 changelog
|
|
229
|
+
#### 配置 changeset 的 changelog 配置为包名称
|
|
230
230
|
|
|
231
231
|
```json title=".changesets/config.json"
|
|
232
232
|
{
|
|
@@ -118,7 +118,7 @@ type ReleasePlan = {
|
|
|
118
118
|
|
|
119
119
|
- options
|
|
120
120
|
|
|
121
|
-
配置 commit
|
|
121
|
+
配置 commit 时的其他参数。
|
|
122
122
|
|
|
123
123
|
> commit 配置为数组时,第二个参数支持传入默认的配置信息,会对应的使用该参数传递。
|
|
124
124
|
|
|
@@ -195,7 +195,7 @@ commit 配置为 ./my-commit-config.js 即可:
|
|
|
195
195
|
|
|
196
196
|
自定义 commit 还可以使用模块工程方案进行管理,提供通用方案。
|
|
197
197
|
|
|
198
|
-
#### 使用 `npx @modern-js/create@latest`
|
|
198
|
+
#### 使用 `npx @modern-js/create@latest` 创建模块工程方案
|
|
199
199
|
|
|
200
200
|
```md
|
|
201
201
|
? 请选择你想创建的工程类型:Npm 模块
|
|
@@ -204,7 +204,7 @@ commit 配置为 ./my-commit-config.js 即可:
|
|
|
204
204
|
? 请选择包管理工具:pnpm
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
-
####
|
|
207
|
+
#### 实现自定义内容
|
|
208
208
|
|
|
209
209
|
```ts title="src/index.ts"
|
|
210
210
|
export async function getAddMessage() {}
|
|
@@ -212,11 +212,11 @@ export async function getAddMessage() {}
|
|
|
212
212
|
export async function getVersionMessage() {}
|
|
213
213
|
```
|
|
214
214
|
|
|
215
|
-
#### 将模块发布到 NPM
|
|
215
|
+
#### 将模块发布到 NPM
|
|
216
216
|
|
|
217
|
-
#### 在目标仓库根目录安装对应模块,例如 custom-commit
|
|
217
|
+
#### 在目标仓库根目录安装对应模块,例如 `custom-commit`
|
|
218
218
|
|
|
219
|
-
#### 配置 changeset 的 commit
|
|
219
|
+
#### 配置 changeset 的 commit 配置为包名称
|
|
220
220
|
|
|
221
221
|
```json title="package.json"
|
|
222
222
|
{
|
|
@@ -229,7 +229,7 @@ export async function getVersionMessage() {}
|
|
|
229
229
|
|
|
230
230
|
如果你当前仓库为 Monorepo 工程方案,可以直接使用模块子项目进行管理。
|
|
231
231
|
|
|
232
|
-
#### 执行 `pnpm run new`
|
|
232
|
+
#### 执行 `pnpm run new` 创建模块子项目
|
|
233
233
|
|
|
234
234
|
```md
|
|
235
235
|
? 请选择你想创建的工程类型:Npm 模块
|
|
@@ -238,7 +238,7 @@ export async function getVersionMessage() {}
|
|
|
238
238
|
? 请选择开发语言:TS
|
|
239
239
|
```
|
|
240
240
|
|
|
241
|
-
####
|
|
241
|
+
#### 实现自定义内容
|
|
242
242
|
|
|
243
243
|
```ts title="src/index.ts"
|
|
244
244
|
export async function getAddMessage() {}
|
|
@@ -246,7 +246,7 @@ export async function getAddMessage() {}
|
|
|
246
246
|
export async function getVersionMessage() {}
|
|
247
247
|
```
|
|
248
248
|
|
|
249
|
-
#### 在 Monorepo 根目录添加子项目模块依赖,例如 custom-commit
|
|
249
|
+
#### 在 Monorepo 根目录添加子项目模块依赖,例如 `custom-commit`
|
|
250
250
|
|
|
251
251
|
```json title="package.json"
|
|
252
252
|
{
|
|
@@ -257,7 +257,7 @@ export async function getVersionMessage() {}
|
|
|
257
257
|
}
|
|
258
258
|
```
|
|
259
259
|
|
|
260
|
-
#### 配置 changeset 的 commit
|
|
260
|
+
#### 配置 changeset 的 commit 配置为包名称
|
|
261
261
|
|
|
262
262
|
```json title=".changesets/config.json"
|
|
263
263
|
{
|
|
@@ -112,7 +112,7 @@ pkg-b @ version 1.0.0
|
|
|
112
112
|
|
|
113
113
|

|
|
114
114
|
|
|
115
|
-
配置为 `@changesets/cli/changelog` 将使用官方提供的
|
|
115
|
+
配置为 `@changesets/cli/changelog` 将使用官方提供的 changlog 生成规则,将 changeset 信息转换为 changlog 内容。
|
|
116
116
|
|
|
117
117
|
配置为数组时,第一个参数为自定义 NPM 包或者路径,第二个参数为需要传入的默认参数配置,自定义格式我们将在后续[自定义 changelog](/guides/topic-detail/changesets/changelog) 章节讲解。
|
|
118
118
|
|
|
@@ -48,7 +48,7 @@ Modern.js 提供了自动创建发版 Pull Request 的 Github Action,提供基
|
|
|
48
48
|
|
|
49
49
|
#### 使用
|
|
50
50
|
|
|
51
|
-
在仓库中创建 `.github/workflows/release-pull-request.yml` 文件,填入以下内容:
|
|
51
|
+
- 在仓库中创建 `.github/workflows/release-pull-request.yml` 文件,填入以下内容:
|
|
52
52
|
|
|
53
53
|
```yaml
|
|
54
54
|
name: Release Pull Request
|
|
@@ -93,15 +93,15 @@ jobs:
|
|
|
93
93
|
REF: ${{ github.ref }}
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
将 Workflow 合并到主分支后,进入 Github 仓库对应的 Action 页面,选择 Release Pull Request:
|
|
96
|
+
- 将 Workflow 合并到主分支后,进入 Github 仓库对应的 Action 页面,选择 Release Pull Request:
|
|
97
97
|
|
|
98
98
|

|
|
99
99
|
|
|
100
|
-
选择本次发布类型,点击 Run workflow 按钮:
|
|
100
|
+
- 选择本次发布类型,点击 Run workflow 按钮:
|
|
101
101
|
|
|
102
102
|

|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
- Workflow 运行完成后将自动创建 `Release-${version}` 的 Pull Request,自动完成 `bump` changeset 相关版本号并更新 lock 文件,Pull Request 的内容为执行 `gen-release-note` 命令自动生成的 Release Note。
|
|
105
105
|
|
|
106
106
|

|
|
107
107
|
|
|
@@ -111,7 +111,7 @@ Modern.js 提供了自动发布版本 的 Github Action,提供基于选择的
|
|
|
111
111
|
|
|
112
112
|
#### 使用
|
|
113
113
|
|
|
114
|
-
在仓库中创建 `.github/workflows/release.yml` 文件,填入以下内容:
|
|
114
|
+
- 在仓库中创建 `.github/workflows/release.yml` 文件,填入以下内容:
|
|
115
115
|
|
|
116
116
|
```yaml
|
|
117
117
|
name: Release
|
|
@@ -160,16 +160,16 @@ jobs:
|
|
|
160
160
|
REF: ${{ github.ref }}
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
-
配置仓库的 NPM_TOKEN:
|
|
163
|
+
- 配置仓库的 NPM_TOKEN:
|
|
164
164
|
|
|
165
165
|

|
|
166
166
|
|
|
167
|
-
将 Workflow 合并到主分支后,进入 Github 仓库对应的 Action 页面,选择 Release:
|
|
167
|
+
- 将 Workflow 合并到主分支后,进入 Github 仓库对应的 Action 页面,选择 Release:
|
|
168
168
|
|
|
169
169
|

|
|
170
170
|
|
|
171
|
-
选择分支名称和发布版本类型,点击 Run workflow 按钮:
|
|
171
|
+
- 选择分支名称和发布版本类型,点击 Run workflow 按钮:
|
|
172
172
|
|
|
173
173
|

|
|
174
174
|
|
|
175
|
-
Workflow 将自动完成仓库 build 和发布到 NPM 流程。
|
|
175
|
+
- Workflow 将自动完成仓库 build 和发布到 NPM 流程。
|