@modern-js/main-doc 0.0.0-next-1686037191101 → 0.0.0-next-1686044917772
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 +4 -8
- 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 +18 -21
- 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
|
@@ -4,7 +4,7 @@ sidebar_position: 8
|
|
|
4
4
|
|
|
5
5
|
# Customizing Release Note Format
|
|
6
6
|
|
|
7
|
-
Modern.js provides the `modern gen-release-note` command, which supports automatically generating Release Note
|
|
7
|
+
Modern.js provides the `modern gen-release-note` command, which supports automatically generating Release Note through the current existing changeset and git commit information. Before running the release command, you can run this command to generate the Release Note for this release.
|
|
8
8
|
|
|
9
9
|
The default generated Release Note format is:
|
|
10
10
|
|
|
@@ -12,25 +12,23 @@ The default generated Release Note format is:
|
|
|
12
12
|
- fix: add missing type definitions by @zllkjc in https://github.com/web-infra-dev/modern.js/pull/3835
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Get the Pull Request ID of the changeset through the commit information, and generate a Github link, which includes the changeset's changelog information and author information.
|
|
16
16
|
|
|
17
17
|
:::info
|
|
18
|
-
To
|
|
18
|
+
To get author information, you need to provide the Github Token environment variable, which is passed in through GITHUB_AUTH_TOKEN.
|
|
19
19
|
:::
|
|
20
20
|
|
|
21
21
|
When the default generated Release Note logic cannot meet the requirements, custom Release Note format is supported.
|
|
22
22
|
|
|
23
23
|
## Information
|
|
24
24
|
|
|
25
|
-
###
|
|
25
|
+
### getReleaseInfo
|
|
26
26
|
|
|
27
27
|
To generate Release Note information, some information needs to be collected, such as commit ID, Pull Request ID, commit message, etc.
|
|
28
28
|
|
|
29
29
|
This logic can be implemented through the `getReleaseInfo` function.
|
|
30
30
|
|
|
31
|
-
####
|
|
32
|
-
|
|
33
|
-
##### Params
|
|
31
|
+
#### Params
|
|
34
32
|
|
|
35
33
|
- commit
|
|
36
34
|
|
|
@@ -42,29 +40,37 @@ The result of executing `git log --pretty=format:%h--%s--%ae .changeset/${change
|
|
|
42
40
|
|
|
43
41
|
- commitObj
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
Basic information about commit.
|
|
46
44
|
|
|
47
45
|
```ts
|
|
46
|
+
export enum CommitType {
|
|
47
|
+
Performance = 'performance',
|
|
48
|
+
Features = 'features',
|
|
49
|
+
BugFix = 'bugFix',
|
|
50
|
+
Doc = 'doc',
|
|
51
|
+
Other = 'other',
|
|
52
|
+
}
|
|
53
|
+
|
|
48
54
|
interface Commit {
|
|
49
55
|
id: string; // commit id
|
|
50
|
-
type:
|
|
51
|
-
repository?: string; //
|
|
56
|
+
type: CommitType;
|
|
57
|
+
repository?: string; // Repo information passed in as a parameter or defined in package.json
|
|
52
58
|
pullRequestId?: string;
|
|
53
59
|
author?: string;
|
|
54
|
-
message: string; //
|
|
55
|
-
summary: string; //
|
|
56
|
-
summary_zh: string; //
|
|
60
|
+
message: string; // Commit message
|
|
61
|
+
summary: string; // Changeset summary
|
|
62
|
+
summary_zh: string; // Changeset summary in Chinese
|
|
57
63
|
[key: string]: string | undefined;
|
|
58
64
|
}
|
|
59
65
|
```
|
|
60
66
|
|
|
61
|
-
|
|
67
|
+
#### Returns
|
|
62
68
|
|
|
63
69
|
commitObj, the complete commit object after supplementation.
|
|
64
70
|
|
|
65
|
-
|
|
71
|
+
#### Default Implementation
|
|
66
72
|
|
|
67
|
-
The default implementation of Modern.js is to split out the Pull Request ID based on the commit information, and
|
|
73
|
+
The default implementation of Modern.js is to split out the Pull Request ID based on the commit information, and get the user information based on the commit ID and add it to the commitObj.
|
|
68
74
|
|
|
69
75
|
```ts
|
|
70
76
|
function getReleaseInfo(commit: string, commitObj: Commit) {
|
|
@@ -108,19 +114,17 @@ const commitRegex = /(.*)\(#(\d*)\)/;
|
|
|
108
114
|
}
|
|
109
115
|
```
|
|
110
116
|
|
|
111
|
-
###
|
|
117
|
+
### getReleaseNoteLine
|
|
112
118
|
|
|
113
|
-
Generate the corresponding Release Note based on the commit object information
|
|
119
|
+
Generate the corresponding Release Note based on the commit object information getted in `getReleaseInfo`.
|
|
114
120
|
|
|
115
121
|
This logic can be implemented through the `getReleaseNoteLine` function.
|
|
116
122
|
|
|
117
|
-
####
|
|
118
|
-
|
|
119
|
-
##### Params
|
|
123
|
+
#### Params
|
|
120
124
|
|
|
121
125
|
- commit
|
|
122
126
|
|
|
123
|
-
The type is the same as the above commitObj type.
|
|
127
|
+
The type is the same as the above `commitObj` type.
|
|
124
128
|
|
|
125
129
|
- lang
|
|
126
130
|
|
|
@@ -128,11 +132,11 @@ Type: string;
|
|
|
128
132
|
|
|
129
133
|
Get the Release Note information of the corresponding language, supporting `en` and `zh`, the default is `en`.
|
|
130
134
|
|
|
131
|
-
|
|
135
|
+
#### Returns
|
|
132
136
|
|
|
133
137
|
The generated Release Note.
|
|
134
138
|
|
|
135
|
-
|
|
139
|
+
#### Default Implementation
|
|
136
140
|
|
|
137
141
|
The default implementation of Modern.js is:
|
|
138
142
|
|
|
@@ -200,11 +204,11 @@ You can also define the command parameters directly in `package.json`:
|
|
|
200
204
|
|
|
201
205
|
Run the command `pnpm run gen-release-note` directly.
|
|
202
206
|
|
|
203
|
-
### Using Module
|
|
207
|
+
### Using NPM Module
|
|
204
208
|
|
|
205
|
-
Customizing release note can also be managed using the module project to provide a common solution.
|
|
209
|
+
Customizing release note can also be managed using the NPM module project to provide a common solution.
|
|
206
210
|
|
|
207
|
-
#### Use `npx @modern-js/create@latest` to create a module project
|
|
211
|
+
#### Use `npx @modern-js/create@latest` to create a module project
|
|
208
212
|
|
|
209
213
|
```md
|
|
210
214
|
? Please select the type of project you want to create: Npm Module
|
|
@@ -221,9 +225,9 @@ export function getReleaseInfo() {}
|
|
|
221
225
|
export function getReleaseNoteLine() {}
|
|
222
226
|
```
|
|
223
227
|
|
|
224
|
-
#### Publish the module to NPM
|
|
225
|
-
#### Install the corresponding module in the root directory of the target repository, such as `custom-release-note
|
|
226
|
-
#### Run the `gen-release-note` command with the `custom` parameter added
|
|
228
|
+
#### Publish the module to NPM
|
|
229
|
+
#### Install the corresponding module in the root directory of the target repository, such as `custom-release-note`
|
|
230
|
+
#### Run the `gen-release-note` command with the `custom` parameter added
|
|
227
231
|
|
|
228
232
|
```bash
|
|
229
233
|
pnpm run gen-release-note --custom custom-release-note
|
|
@@ -231,9 +235,9 @@ pnpm run gen-release-note --custom custom-release-note
|
|
|
231
235
|
|
|
232
236
|
### Using Monorepo Sub-Project
|
|
233
237
|
|
|
234
|
-
If your current repository is Monorepo, you can directly manage it using module sub-projects.
|
|
238
|
+
If your current repository is Monorepo, you can directly manage it using NPM module sub-projects.
|
|
235
239
|
|
|
236
|
-
#### Run `pnpm run new` to create a module sub-project
|
|
240
|
+
#### Run `pnpm run new` to create a module sub-project
|
|
237
241
|
|
|
238
242
|
```md
|
|
239
243
|
? Please select the type of project you want to create: Npm Module
|
|
@@ -250,7 +254,7 @@ export function getReleaseInfo() {}
|
|
|
250
254
|
export function getReleaseNoteLine() {}
|
|
251
255
|
```
|
|
252
256
|
|
|
253
|
-
#### Add the sub-project module dependency, such as `custom-release-note`, to the Monorepo root directory
|
|
257
|
+
#### Add the sub-project module dependency, such as `custom-release-note`, to the Monorepo root directory
|
|
254
258
|
|
|
255
259
|
```json title="package.json"
|
|
256
260
|
{
|
|
@@ -260,7 +264,7 @@ export function getReleaseNoteLine() {}
|
|
|
260
264
|
}
|
|
261
265
|
```
|
|
262
266
|
|
|
263
|
-
#### Run the `gen-release-note` command with the `custom` parameter added
|
|
267
|
+
#### Run the `gen-release-note` command with the `custom` parameter added
|
|
264
268
|
|
|
265
269
|
```bash
|
|
266
270
|
pnpm run gen-release-note --custom custom-release-note
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
sidebar_position: 4
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
# Publishing
|
|
5
|
+
# Publishing Pre-Release Version
|
|
6
6
|
|
|
7
7
|
Before doing an actual release, we also need to publish a pre-release version for internal testing and user use. Changesets also support publishing pre-release versions.
|
|
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
|
-
#### Run the
|
|
15
|
+
#### Run the bump command to upgrade the version of the pre-release
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
pnpm run bump --canary --preid <preid>
|
|
@@ -24,17 +24,17 @@ After using the `--canary` parameter, the `bump` command completes the following
|
|
|
24
24
|
|
|
25
25
|
- `changeset pre enter <preid>`: Enters pre-release mode.
|
|
26
26
|
|
|
27
|
-
- `changeset version`: Upgrades the version
|
|
27
|
+
- `changeset version`: Upgrades the version.
|
|
28
28
|
|
|
29
29
|
- `changeset pre exit`: Exits pre-release mode.
|
|
30
30
|
|
|
31
31
|
#### Check the changes and submit
|
|
32
32
|
|
|
33
|
-
Check whether the version
|
|
33
|
+
Check whether the version changes are correct and submit the changes.
|
|
34
34
|
|
|
35
35
|
It is recommended to perform pre-release operations not on the main branch and not merge them into the main branch. After the pre-release verification is completed, an actual version can be directly released based on the main branch.
|
|
36
36
|
|
|
37
|
-
#### Run the
|
|
37
|
+
#### Run the release command to publish the pre-release version:
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
40
|
pnpm run release --tag <tag>
|
|
@@ -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
|
|