@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.
Files changed (32) hide show
  1. package/CHANGELOG.md +9 -4
  2. package/docs/en/components/debug-app.mdx +1 -1
  3. package/docs/en/components/deploy.mdx +1 -0
  4. package/docs/en/components/init-app.mdx +3 -7
  5. package/docs/en/components/release-note.mdx +1 -0
  6. package/docs/en/guides/get-started/glossary.mdx +12 -12
  7. package/docs/en/guides/get-started/introduction.mdx +17 -20
  8. package/docs/en/guides/get-started/quick-start.mdx +21 -37
  9. package/docs/en/guides/get-started/upgrade.mdx +15 -14
  10. package/docs/en/guides/topic-detail/changesets/add.mdx +16 -14
  11. package/docs/en/guides/topic-detail/changesets/changelog.mdx +28 -28
  12. package/docs/en/guides/topic-detail/changesets/commit.mdx +23 -23
  13. package/docs/en/guides/topic-detail/changesets/config.mdx +10 -10
  14. package/docs/en/guides/topic-detail/changesets/github.mdx +12 -12
  15. package/docs/en/guides/topic-detail/changesets/introduce.mdx +13 -13
  16. package/docs/en/guides/topic-detail/changesets/release-note.mdx +38 -34
  17. package/docs/en/guides/topic-detail/changesets/release-pre.mdx +6 -6
  18. package/docs/en/guides/topic-detail/changesets/release.mdx +42 -42
  19. package/docs/zh/community/blog/v2-release-note.mdx +1 -1
  20. package/docs/zh/components/init-app.mdx +5 -9
  21. package/docs/zh/guides/get-started/quick-start.mdx +7 -10
  22. package/docs/zh/guides/get-started/upgrade.mdx +1 -1
  23. package/docs/zh/guides/topic-detail/changesets/add.mdx +10 -8
  24. package/docs/zh/guides/topic-detail/changesets/changelog.mdx +9 -9
  25. package/docs/zh/guides/topic-detail/changesets/commit.mdx +10 -10
  26. package/docs/zh/guides/topic-detail/changesets/config.mdx +1 -1
  27. package/docs/zh/guides/topic-detail/changesets/github.mdx +9 -9
  28. package/docs/zh/guides/topic-detail/changesets/introduce.mdx +9 -9
  29. package/docs/zh/guides/topic-detail/changesets/release-note.mdx +28 -24
  30. package/docs/zh/guides/topic-detail/changesets/release-pre.mdx +5 -5
  31. package/docs/zh/guides/topic-detail/changesets/release.mdx +22 -22
  32. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,18 +1,23 @@
1
1
  # @modern-js/main-doc
2
2
 
3
- ## 0.0.0-next-1686037191101
3
+ ## 0.0.0-next-1686045734613
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - 411d047d98: docs: fix reset command
7
+ - 411d047d9: docs: fix reset command
8
8
 
9
9
  docs: 修复 reset command 翻译问题
10
10
 
11
- - 7267a1ae6c: docs(main): update changeset doc
11
+ - aa250e277: docs(main): update start doc
12
+
13
+ docs(main): 更新开始文档
14
+
15
+ - 7267a1ae6: docs(main): update changeset doc
12
16
 
13
17
  docs(main): 更新包版本管理文档
14
18
 
15
- - @modern-js/builder-doc@0.0.0-next-1686037191101
19
+ - Updated dependencies [aa250e277]
20
+ - @modern-js/builder-doc@0.0.0-next-1686045734613
16
21
 
17
22
  ## 2.22.0
18
23
 
@@ -1,4 +1,4 @@
1
- Execute `pnpm run dev` in the project to start the project:
1
+ Run `pnpm run dev` in the project to start the project:
2
2
 
3
3
  ```bash
4
4
  $ pnpm run dev
@@ -0,0 +1 @@
1
+ After local verification, you can organize the artifacts in `dist/` into the structure required by the server for deployment.
@@ -1,12 +1,13 @@
1
- Modern.js generator will provide an interactive Q & A interface, initialization items according to the result, according to the default selection:
1
+ `@modern-js/create` provides an interactive Q & A interface to initialize the project based on the results, with initialization performed according to the default settings:
2
2
 
3
3
  ```bash
4
4
  ? Please select the type of project you want to create: Web App
5
5
  ? Please select the programming language: TS
6
6
  ? Please select the package manager: pnpm
7
+ ? Please select the bundler: webpack
7
8
  ```
8
9
 
9
- After create the project, Modern.js automatically installs dependency and creates a git repository.
10
+ After create the project, Modern.js will automatically install dependencies and create a git repository.
10
11
 
11
12
  ```bash
12
13
  [INFO] dependencies are automatically installed
@@ -20,11 +21,6 @@ pnpm run lint # Run ESLint and automatically fix problems
20
21
  pnpm run new # Enable optional features or add a new entry
21
22
  ```
22
23
 
23
- :::note
24
- In addition to working during project initialization, the Modern.js generator can also generate modules of the project in subsequent development, which is not thrown away as soon as it is used.
25
-
26
- :::
27
-
28
24
  Now, the project structure is as follows:
29
25
 
30
26
  ```
@@ -0,0 +1 @@
1
+ According to the [Release Note](https://github.com/web-infra-dev/modern.js/releases) on the official website, developers can also manually upgrade the project to the desired version.
@@ -6,9 +6,9 @@ sidebar_position: 4
6
6
 
7
7
  ## BFF
8
8
 
9
- BFF stands for "Backend For Frontend". It is an architectural pattern where a dedicated backend service is created for frontend applications.
9
+ BFF is short for "Backend For Frontend". It is an architecture pattern that involves creating a backend service for frontend applications.
10
10
 
11
- The BFF service acts as an intermediary between the frontend application and the backend APIs, providing a tailored API for the frontend to consume. This allows the frontend developers to have more control over the data and functionality that they need, without having to rely on a monolithic backend API to provide coresponding capabilities.
11
+ The BFF service acts as an intermediary between the frontend application and the server API, and can provide customized APIs for the frontend to use. This allows frontend developers to have more control over the data and functionality they need, without relying on the backend service to provide the corresponding capabilities.
12
12
 
13
13
  ## Bundler
14
14
 
@@ -24,15 +24,15 @@ import Builder from '@modern-js/builder-doc/docs/en/shared/builder.md';
24
24
 
25
25
  ## CSR
26
26
 
27
- CSR stands for "Client-Side Rendering". It means that pages are rendered directly in the browser using JavaScript. All the logic, data fetching, templating and routing is done on the client rather than the server.
27
+ CSR stands for "Client-Side Rendering". It means that the page is rendered in the browser using JavaScript, and logic such as data fetching, templates, and routing is completed on the client side rather than the server.
28
28
 
29
- In CSR, the server sends an empty HTML shell to the client along with some JavaScript bundles, which then fetches data from the server's APIs and populates the page with dynamic content.
29
+ In CSR, the server sends an empty HTML shell and some JavaScript scripts to the browser, and the browser fetching data from the server's API and renders dynamic content to the page.
30
30
 
31
31
  ## Garfish
32
32
 
33
- [Garfish](https://garfish.bytedance.net/) is a set of micro front-end solutions mainly used to solve problems such as cross-team collaboration and technical system diversification of web applications.
33
+ [Garfish](https://garfish.bytedance.net/) is a micro-frontend solution mainly used to solve problems such as cross-team collaboration and diversified technology systems in web applications.
34
34
 
35
- Starting from the architectural level, it integrates several independently delivered front-end applications. These front-end applications can be developed, tested and deployed independently, but from the user's point of view they are still a cohesive single product.
35
+ Starting from the architecture level, it combines multiple independently delivered frontend applications into a whole. These frontend applications can be developed, tested, and deployed independently, but in the user's perspective, they are still cohesive single products.
36
36
 
37
37
  ## Rspack
38
38
 
@@ -42,19 +42,19 @@ import Rspack from '@modern-js/builder-doc/docs/en/shared/rspack.md';
42
42
 
43
43
  ## SSR
44
44
 
45
- SSR stands for "Server-Side Rendering". It is a technique where the server generates the HTML of a web page and sends it to the client, instead of sending just an empty HTML shell and relying on JavaScript to populate the page.
45
+ SSR stands for "Server-Side Rendering". It means that the HTML of the web page is generated by the server and sent to the client, rather than sending only an empty HTML shell and relying on JavaScript to generate the page content.
46
46
 
47
- In traditional client-side rendering, the server sends an empty HTML shell to the client along with some JavaScript bundles, which then fetches data from the server's APIs and populates the page with dynamic content. This can result in a slower initial load time, which can be detrimental to user experience and SEO.
47
+ In traditional client-side rendering, the server sends an empty HTML shell and some JavaScript scripts to the client, and then fetching data from the server's API and fills the page with dynamic content. This leads to slow initial page loading times and is not conducive to user experience and SEO.
48
48
 
49
- With SSR, the server generates the HTML with the dynamic content already populated, and sends it to the client. This can result in a faster initial load time and better SEO, as search engines can crawl the fully rendered page.
49
+ With SSR, the server generates HTML that already contains dynamic content and sends it to the client. This makes the initial page loading faster and more SEO-friendly, as search engines can crawl the rendered page.
50
50
 
51
51
  ## SSG
52
52
 
53
- SSG stands for "Static Site Generation". It is a technique where a web page is pre-rendered into static HTML, and then served directly to the client without the need for a server to generate the HTML on the fly.
53
+ SSG stands for "Static Site Generation". It means that web pages are pre-rendered as static HTML and served directly to the client, without the need for the server to generate HTML in real-time.
54
54
 
55
- In traditional SSR, the server generates the HTML on the fly each time a user requests a page. With SSG, the HTML is generated ahead of time during the build process and can be served directly from a CDN or other static hosting service.
55
+ In traditional SSR, the server generates HTML in real-time every time a user requests a page. With SSG, HTML can be generated in advance during the build process and hosted on a CDN or other static resource service.
56
56
 
57
- SSG can provide faster load times and less server overhead to traditional SSR, as there is no need to maintain a server to generate the HTML on the fly. However, it is not suitable for websites that require dynamic content, as the HTML is generated during the build process and cannot be updated in real-time.
57
+ Compared to traditional SSR, SSG can provide faster loading speeds and less server-side overhead, as there is no need to maintain a server to generate HTML in real-time. However, SSG is not suitable for websites that require dynamic content, as the HTML is generated during the build process and does not support real-time updates.
58
58
 
59
59
  ## SWC
60
60
 
@@ -7,7 +7,7 @@ sidebar_position: 1
7
7
 
8
8
  **Modern.js is an open source web engineering system from ByteDance**, which provides multiple solutions to help developers solve problems in different development scenarios.
9
9
 
10
- Currently, Modern.js includes three solutions, each targeting at different development scenarios: web application development, npm package development, and document site development:
10
+ Currently, Modern.js includes three solutions, targeting web application development, npm package development, and document site development:
11
11
 
12
12
  import { SolutionCards } from '@site/src/components/SolutionCards';
13
13
 
@@ -31,40 +31,37 @@ import { SolutionCards } from '@site/src/components/SolutionCards';
31
31
  ]}
32
32
  />
33
33
 
34
- As a part of the Modern.js engineering system, each of these solutions can be used separately and has its own independent documentation site. Developers can choose one or more solutions as needed.
34
+ As part of the Modern.js engineering system, each of the above solutions can be used separately and has its own independent documentation site. Developers can choose one or more solutions as needed.
35
35
 
36
36
  ## About Documentation
37
37
 
38
- **This documentation site corresponds to the Modern.js framework**, which is used to developing web applications.
38
+ **The current documentation site corresponds to the Modern.js framework**, which is used to developing web applications.
39
39
 
40
- - If you are developing an npm package, please refer to the [Modern.js Module](https://modernjs.dev/module-tools/en) documentation.
41
- - If you are developing a document site, please refer to the [Modern.js Doc](https://modernjs.dev/doc-tools) documentation.
42
- - If you want to use the Modern.js's builder engine to implement a web framework, please refer to the [Modern.js Builder](https://modernjs.dev/builder/en) documentation.
40
+ - If you need to develop an npm package, please refer to the [Modern.js Module](https://modernjs.dev/module-tools) documentation.
41
+ - If you need to develop a documentation site, please refer to the [Modern.js Doc](https://modernjs.dev/doc-tools/) documentation.
42
+ - If you need to implement a web development framework based on the Modern.js build engine, please refer to the [Modern.js Builder](https://modernjs.dev/builder) documentation.
43
43
 
44
44
  :::tip
45
- As the Modern.js framework is the most widely used, in this documentation site, we will omit the "framework" and simply call it as Modern.js.
45
+ Since the Modern.js framework is the most widely used, in this documentation site, we will omit "framework" and directly refer to it as Modern.js.
46
46
  :::
47
47
 
48
48
  ## Modern.js Framework
49
49
 
50
50
  **The Modern.js framework is a progressive web framework based on React**. At ByteDance, we use Modern.js to build upper-level frameworks that have supported the development of thousands of web applications.
51
51
 
52
- Modern.js can provide developers with the ultimate **development experience**, making the application get better **user experience**.
52
+ Modern.js can provide developers with an ultimate **Development Experience** and enable applications to have better **User Experience**.
53
53
 
54
- In the process of developing React applications, developers often need to design implementations for certain functions, or use other libraries and frameworks to solve these problems.
54
+ In the process of developing React applications, developers usually need to design implementation plans for certain features or use other libraries and frameworks to solve these problems. Modern.js supports all configurations and tools needed by React applications, and has built-in **additional features and optimizations**. Developers can use React to build the UI of the application, and then gradually adopt the features of Modern.js to solve common application requirements, such as routing, data acquisition, and state management.
55
55
 
56
- Modern.js supports all the configuration and tools required by React applications, and has additional features and optimisations built in. Developers can use React to build the UI of the application, and then gradually adopt Modern.js functions to solve common application requirements, such as routing, data fetching, state management, etc.
56
+ It mainly includes the following features:
57
57
 
58
- It mainly contains the following features:
59
-
60
- - 🚀 **Rust Bundler**: Easily switch to Rspack bundler with faster build speed.
61
- - 🪜 **Progressive**: Create projects with the most streamlined templates, gradually turn on plugin capabilities through generators, and customize solutions.
62
- - 🏠 **Integration**: The development is unique to the production environment Web Server, CSR and SSR are isomorphic development, and the function as the API service call.
63
- - 📦 **Out Of The Box**: Default TS support, built-in build core, ESLint, debugging tools, full functionality can be tested.
64
- - 🌏 **Ecology**: Self-developed state management, micro frontend, module packaging, Monorepo solution and other peripheral requirements.
65
- - 🕸 **Routing Modes**: Contains controlled routing, routing based on file conventions (nested routing), configurable routing, etc.
66
- - 🚀 **Independently Build Core**: Support a variety of packaging tools, deep optimization bundle.
58
+ - 🚀 **Rust Bundler**: Provides support for dual bundlers, easily switch to the Rspack for faster build speed.
59
+ - 🪜 **Progressive**: Create projects with the most streamlined templates, gradually enable plugin features through the generator, and customize solutions.
60
+ - 🏠 **Integration**: Development and production environment web server are unique, CSR and SSR are isomorphic development, and API service calls are functions as interfaces.
61
+ - 📦 **Out Of The Box**: Default TS support, built-in build, ESLint, debugging tools, fully functional and testable.
62
+ - 🌏 **Ecology**: Self-developed state management, micro-frontend, module packaging, Monorepo solutions, and other peripheral needs.
63
+ - 🕸 **Routing Modes**: Includes self-controlled routing, file-convention-based routing (nested routing), etc.
67
64
 
68
65
  ## Next
69
66
 
70
- If you want to know how to use Modern.js, you can try [Create your first app](/tutorials/first-app/c01-start), or read [Quick Start](/guides/get-started/quick-start).
67
+ If you want to learn how to use the Modern.js framework, you can try to [create your first application](/tutorials/first-app/c01-start), or read the [Quick Start](/guides/get-started/quick-start) guide.
@@ -13,16 +13,16 @@ import Prerequisites from "@site-docs-en/components/prerequisites"
13
13
 
14
14
  ## Installation
15
15
 
16
- Modern.js provides the `@modern-js/create` tool for creating new projects. You can use `npx` to run it.
16
+ Modern.js provides the `@modern-js/create` tool to create projects. Do not install it globally, use `npx` to run it.
17
17
 
18
- You can create the project in an existing empty directory:
18
+ You can create a project in an existing empty directory:
19
19
 
20
20
  ```bash
21
21
  mkdir myapp && cd myapp
22
22
  npx @modern-js/create@latest
23
23
  ```
24
24
 
25
- You can also directly create the project as a new folder:
25
+ You can also create a project directly in a new directory:
26
26
 
27
27
  ```bash
28
28
  npx @modern-js/create@latest myapp
@@ -36,31 +36,15 @@ import InitApp from "@site-docs-en/components/init-app"
36
36
 
37
37
  ## Development
38
38
 
39
- Execute `pnpm run dev` in the project to start the project:
39
+ import DebugApp from "@site-docs-en/components/debug-app"
40
40
 
41
- ```bash
42
- $ pnpm run dev
43
-
44
- > modern dev
45
-
46
- info Starting dev server...
47
- info App running at:
48
-
49
- > Local: http://localhost:8080/
50
- > Network: http://192.168.0.1:8080/
51
-
52
- Client ✔ done in 76.10ms
53
- ```
54
-
55
- Open `http://localhost:8000/` in your browser and you will see the following:
56
-
57
- ![dev](https://lf3-static.bytednsdoc.com/obj/eden-cn/nuvjhpqnuvr/modern-website/dev.png)
41
+ <DebugApp />
58
42
 
59
43
  ## Configuration
60
44
 
61
- The `modern.config.ts` files exist in Modern.js projects created by the generator.
45
+ In a Modern.js project created using `@modern-js/create`, a `modern.config.ts` file is generated by default.
62
46
 
63
- Features can be enabled through the configuration file, or the default behavior of the coverage Modern.js. For example, add the following configuration to enable SSR:
47
+ You can modify the configuration through this file to override the default behavior of Modern.js. For example, to enable SSR, add the following configuration:
64
48
 
65
49
  ```ts
66
50
  import { defineConfig } from '@modern-js/app-tools';
@@ -76,11 +60,11 @@ export default defineConfig({
76
60
  });
77
61
  ```
78
62
 
79
- Re-execute `pnpm run dev`, in the browser Network menu, you can find that the project has completed page rendering at the server level.
63
+ After running `pnpm run dev` again, you can find that the project has completed page rendering on the server in the browser's Network menu.
80
64
 
81
- ## Build
65
+ ## Build the project
82
66
 
83
- Execute `pnpm run build` in the project to build the project production environment product:
67
+ To build the production artifacts of the project, run `pnpm run build` in the project:
84
68
 
85
69
  ```bash
86
70
  $ pnpm run build
@@ -106,27 +90,25 @@ info File sizes after production build:
106
90
  Client ✔ done in 3.57s
107
91
  ```
108
92
 
109
- The bundle is generated to `dist/` by default, and the directory structure is as follows:
93
+ By default, the build artifacts are generated in `dist/`, with the following directory structure:
110
94
 
111
95
  ```
112
- .
113
- ├── asset-manifest.json
96
+ dist
114
97
  ├── html
115
- └── main
116
- ├── loader-routes
117
- │ └── main
98
+    └── main
118
99
  ├── modern.config.json
119
100
  ├── route.json
101
+ ├── routes-manifest.json
120
102
  └── static
121
103
  ├── css
122
104
  └── js
123
105
  ```
124
106
 
125
- > If you want to customize the output directory, please refer to [Output Files](https://modernjs.dev/builder/en/guide/basic/output-files.html).
107
+ > If you need to customize the directory of the build artifacts, please refer to [Output files](https://modernjs.dev/builder/guide/basic/output-files.html).
126
108
 
127
109
  ## Verify
128
110
 
129
- Execute `pnpm run serve` in the project to verify locally that the bundle is running correctly:
111
+ Run `pnpm run serve` in the project to verify whether the build artifacts run normally locally:
130
112
 
131
113
  ```bash
132
114
  $ pnpm run serve
@@ -140,8 +122,10 @@ info App running at:
140
122
  > Network: http://192.168.0.1:8080/
141
123
  ```
142
124
 
143
- Open http://localhost:8000/ in the browser and the content should be the same as when `pnpm run dev`.
125
+ Open `http://localhost:8000/` in the browser, and the content should be consistent with that of `pnpm run dev`.
126
+
127
+ ## Deployment
144
128
 
145
- ## Deploy
129
+ import Deploy from "@site-docs-en/components/deploy"
146
130
 
147
- Once the local verification is complete, the outputs under `dist` folder can be organized into the structure required by the server for deployment.
131
+ <Deploy />
@@ -7,42 +7,43 @@ sidebar_position: 3
7
7
 
8
8
  ## Upgrade with command
9
9
 
10
- Modern.js provides the `upgrade` command to support projects to upgrade to the latest version.
10
+ Modern.js provides the `upgrade` command to support upgrading the project to the latest version of Modern.js.
11
11
 
12
- Execute `pnpm run upgrade` in the project:
12
+ Run `pnpm run upgrade` in the project:
13
13
 
14
14
  ```bash
15
15
  $ pnpm run upgrade
16
16
 
17
17
  > modern upgrade
18
18
 
19
- [INFO] [Project Type]: Application
19
+ [INFO] [Project Type]: Web App
20
20
  [INFO] [Modern.js Latest Version]: 2.0.0
21
21
  [INFO] Upgrade Modern.js package version success!
22
22
  ```
23
23
 
24
- You can see that the dependency in the project `package.json` has been changed to the latest.
24
+ You can see that the dependencies in the project's `package.json` have been updated to the latest version.
25
25
 
26
- ## Specify version upgrade
26
+ ## Upgrade to a specified version
27
27
 
28
- All packages of Modern.js are published using the **unified version number**.
28
+ All packages of Modern.js are currently released with a **uniform version number**.
29
29
 
30
- According to the website release note, developers can also manually upgrade the project to the desired version.
30
+ import ReleaseNote from "@site-docs-en/components/release-note"
31
+
32
+ <ReleaseNote />
31
33
 
32
34
  :::tip
33
- When upgrading, you need to upgrade to all packages provided by the Modern.js, rather than upgrading a single dependency.
35
+ When upgrading, you need to upgrade all packages provided by Modern.js, instead of upgrading a single dependency.
34
36
 
35
37
  :::
36
38
 
37
39
  ## Lock nested dependency
38
40
 
39
- When there is a problem with one of the nested dependencies of the project, and the Modern.js cannot be updated immediately, you can use the package manager to lock the child dependency version.
41
+ When a nested dependency of the project has a problem and Modern.js cannot be updated immediately, you can use the package manager to lock the version of the nested dependency.
40
42
 
41
43
  ### pnpm
42
44
 
43
- For projects using pnpm, add the following configuration to the `package.json` in the **project root directory** and re-execute `pnpm install`:
45
+ For projects using pnpm, add the following configuration to the `package.json` in the **root directory** of the project, and then run `pnpm install` again:
44
46
 
45
- ```json title="package.json"
46
47
  {
47
48
  "pnpm": {
48
49
  "overrides": {
@@ -54,7 +55,7 @@ For projects using pnpm, add the following configuration to the `package.json` i
54
55
 
55
56
  ### Yarn
56
57
 
57
- For projects using Yarn, add the following configuration to the `package.json` in the **project root directory** and re-execute `yarn install`:
58
+ For projects using Yarn, add the following configuration to the `package.json` in the **root directory** of the project, and then run `yarn install` again:
58
59
 
59
60
  ```json title="package.json"
60
61
  {
@@ -66,7 +67,7 @@ For projects using Yarn, add the following configuration to the `package.json` i
66
67
 
67
68
  ### Npm
68
69
 
69
- For projects using Npm, add the following configuration to the `package.json` in the **project root directory** and re-execute `npm install`:
70
+ For projects using Npm, add the following configuration to the `package.json` in the **root directory** of the project, and then run `npm install` again:
70
71
 
71
72
  ```json title="package.json"
72
73
  {
@@ -77,6 +78,6 @@ For projects using Npm, add the following configuration to the `package.json` in
77
78
  ```
78
79
 
79
80
  :::info
80
- For Monorepo repositories, the dependency version can only be locked in the `package.json` in the project root directory, and all packages in Monorepo are affected.
81
+ For Monorepo repositories, you can only lock dependency versions in the `package.json` in the root directory of the project, and it will affect all packages in the Monorepo.
81
82
 
82
83
  :::
@@ -4,7 +4,7 @@ sidebar_position: 2
4
4
 
5
5
  # Add Changesets
6
6
 
7
- When we finish development, we need to add a changeset to declare the current changes for future version releases.
7
+ When we finish development, we need to add a changeset to declare the current changes for version releases.
8
8
 
9
9
  ## Information
10
10
 
@@ -12,29 +12,29 @@ A changeset includes:
12
12
 
13
13
  - Which packages are affected by this change.
14
14
 
15
- - The type of version number upgrade needed for this change, which complies with the [semver](https://semver.org/) specification.
15
+ - The type of version for this change, which complies with the [semver](https://semver.org/) specification.
16
16
 
17
17
  - Changelog information for this change.
18
18
 
19
19
  ## Steps
20
20
 
21
21
  :::info
22
- The following example commands are all using pnpm as the package management tool. If you need to use other package management tools, please replace them as needed.
22
+ The following example commands are all using pnpm. If you need to use other package management tools, please replace them as needed.
23
23
  :::
24
24
 
25
- ### Module project scheme
25
+ ### NPM Module
26
26
 
27
- #### Run the following command in the root directory:
27
+ #### Run the change command in the root directory:
28
28
 
29
29
  ```bash
30
30
  pnpm run change
31
31
  ```
32
32
 
33
- #### Select the type of version number upgrade needed for this change and press Enter:
33
+ #### Select the type of version for this change
34
34
 
35
35
  ![](https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/changeset-select-version.png)
36
36
 
37
- #### Fill in the changelog information and press Enter twice:
37
+ #### Fill in the changelog information
38
38
 
39
39
  ![](https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/changeset-input-changelog.png)
40
40
 
@@ -52,15 +52,15 @@ This file contains all the information of the changeset.
52
52
 
53
53
  ### Monorepo
54
54
 
55
- Assuming there are three module packages in the monorepo, `module-1`, `module-2`, and `module-3`.
55
+ There are three NPM module packages in the monorepo, `module-1`, `module-2`, and `module-3`.
56
56
 
57
- #### Run the following command in the root directory:
57
+ #### Run the change command in the root directory
58
58
 
59
59
  ```bash
60
60
  pnpm run change
61
61
  ```
62
62
 
63
- #### Select the list of packages to upgrade for this change:
63
+ #### Select the list of packages to upgrade for this change
64
64
 
65
65
  Changesets will categorize the packages in the Monorepo into two categories, `changed packages` and `unchanged packages`, based on the current code changes (`git diff Head...baseBranch`), making it easy for users to choose.
66
66
 
@@ -68,11 +68,13 @@ Use the space key to select the corresponding package or category, and then pres
68
68
 
69
69
  ![](https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/changeset-select-packages.png)
70
70
 
71
- #### Select the packages corresponding to different version types. Changesets will ask about the `major` and `minor` types. If there are packages that have not selected these two types, the `patch` type will be used by default:
71
+ #### Select the packages corresponding to different version types
72
+
73
+ Changesets will ask about the `major` and `minor` types. If there are packages that have not selected these two types, the `patch` type will be used by default.
72
74
 
73
75
  ![](https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/changeset-auto-select-patch.png)
74
76
 
75
- #### Fill in the changelog information and press Enter twice:
77
+ #### Fill in the changelog information
76
78
 
77
79
  ![](https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/changeset-input-changelog-monorepo.png)
78
80
 
@@ -93,7 +95,7 @@ This file contains all the information of the changeset, and different packages
93
95
 
94
96
  The `change` command supports the following parameters:
95
97
 
96
- - `--empty` Adds an empty changeset.
98
+ - `--empty`: Adds an empty changeset.
97
99
 
98
100
  ```bash
99
101
  pnpm run change --empty
@@ -106,7 +108,7 @@ After running, an empty changeset file will be created in the `.changeset` direc
106
108
  ---
107
109
  ```
108
110
 
109
- - `--open` When using this parameter, the system default editor will be opened for filling in the changelog.
111
+ - `--open`: When using this parameter, the system default editor will be opened for filling in the changelog.
110
112
 
111
113
  ## Notes
112
114
 
@@ -2,15 +2,15 @@
2
2
  sidebar_position: 6
3
3
  ---
4
4
 
5
- # Customizing Changelog Generation
5
+ # Customizing Changelog
6
6
 
7
- By default, Changesets will use `@changesets/cli/changelog` to generate changelog information. If the default changelog information cannot meet the requirements, you can customize the generation of changelog.
7
+ By default, Changesets will use `@changesets/cli/changelog` to generate changelog. If the default changelog cannot meet the requirements, you can customize the generation of changelog.
8
8
 
9
9
  ## Customizing Changelog Content
10
10
 
11
- Changelog information mainly includes the following two types of information:
11
+ Changelog mainly includes the following two types of information:
12
12
 
13
- - Changelog information written in the changeset.
13
+ - Changelog written in the changeset.
14
14
 
15
15
  - Version change information of related packages in this version upgrade.
16
16
 
@@ -28,10 +28,10 @@ export type VersionType = 'major' | 'minor' | 'patch' | 'none';
28
28
  export type Release = { name: string; type: VersionType };
29
29
 
30
30
  export type Changeset = {
31
- id: string; // changeset 的文件名称
32
- commit?: string; // changeset 提交时的 commit id 信息
33
- summary: string; // changeset 内容信息
34
- releases: Array<Release>; // 当前计算出的 changeset 升级包名称及类型信息
31
+ id: string; // changeset id
32
+ commit?: string; // changeset commit id
33
+ summary: string; // changeset summary content
34
+ releases: Array<Release>; // The name and type information of the current computed changeset upgrade package.
35
35
  };
36
36
  ```
37
37
 
@@ -77,13 +77,13 @@ All associated changeset information, which is an array of `getReleaseLine` chan
77
77
 
78
78
  ```ts
79
79
  type ModCompWithPackage = {
80
- name: string; // 依赖模块名称
81
- type: VersionType; // 依赖模块的升级类型
82
- oldVersion: string; // 依赖模块当前版本号
83
- newVersion: string; // 依赖模块新版本号
84
- changesets: string[]; // 关联的 changeset id 列表
85
- packageJson: PackageJSON; // 依赖模块完整的 package.json 内容
86
- dir: string; // 依赖模块的路径(绝对路径)
80
+ name: string; // Name of the dependent module
81
+ type: VersionType; // Upgrade type of the dependent module
82
+ oldVersion: string; // Current version of the dependent module
83
+ newVersion: string; // New version of the dependent module
84
+ changesets: string[]; // List of associated changeset ids
85
+ packageJson: PackageJSON; // Complete package.json content of the dependent module
86
+ dir: string; // Path (absolute path) of the dependent module
87
87
  };
88
88
 
89
89
  type DependenciesUpdated = ModCompWithPackage[];
@@ -95,7 +95,7 @@ Changelog content.
95
95
 
96
96
  #### Default Implementation
97
97
 
98
- By default, `@changesets/cli/changelog` will display the corresponding `Updated dependencies + commit id` information of the changesets as a list. Then, based on the `dependenciesUpdated` information, it will display the package name and new version number of the corresponding dependency package as a child list item of the list.
98
+ By default, `@changesets/cli/changelog` will display the corresponding `Updated dependencies + commit id` information of the changesets as a list. Then, based on the `dependenciesUpdated` information, it will display the package name and new version of the corresponding dependency package as a child list item of the list.
99
99
 
100
100
  ```ts
101
101
  async function getDependencyReleaseLine(changesets, dependenciesUpdated) {
@@ -128,11 +128,11 @@ It is displayed as follows:
128
128
 
129
129
  ## Configuration
130
130
 
131
- The `changelog` field in the changesets configuration file is used to mark the way to obtain changelog information.
131
+ The `changelog` field in the changesets configuration file is used to mark the way to get changelog.
132
132
 
133
- This configuration can be a string, directly declaring the module name or path of the changelog information acquisition module.
133
+ This configuration can be a string, directly declaring the module name or path of the changelog module.
134
134
 
135
- This configuration also supports configuring arrays. The first element in the array is the module name or path of the changelog information acquisition module, and the second element is the parameter value passed to the corresponding function, which will be passed as the third parameter of the `getReleaseLine` and `getDependencyReleaseLine` functions.
135
+ This configuration also supports configuring arrays. The first element in the array is the module name or path of the changelog module, and the second element is the parameter value passed to the corresponding function, which will be passed as the third parameter of the `getReleaseLine` and `getDependencyReleaseLine` functions.
136
136
 
137
137
  ### Configuring Relative Paths
138
138
 
@@ -160,9 +160,9 @@ Configure `changlog` as `./my-changelog-config.js`:
160
160
  }
161
161
  ```
162
162
 
163
- ### Using Module Project
163
+ ### Using Npm Module
164
164
 
165
- Customizing changelog can also be managed using the module project to provide a common solution.
165
+ Customizing changelog can also be managed using the NPM module project to provide a common solution.
166
166
 
167
167
  #### Use `npx @modern-js/create@latest` to create a module project.
168
168
 
@@ -181,11 +181,11 @@ export async function getReleaseLine() {}
181
181
  export async function getDependencyReleaseLine() {}
182
182
  ```
183
183
 
184
- #### Publish the module to NPM.
184
+ #### Publish the module to NPM
185
185
 
186
- #### Install the corresponding module in the root directory of the target repository, such as `custom-changelog`.
186
+ #### Install the module in the root directory of the target repository, such as `custom-changelog`.
187
187
 
188
- #### Configure the changelog configuration of Changesets as the package name.
188
+ #### Configure the changelog configuration of changesets as the package name.
189
189
 
190
190
  ```json title=".changesets/config.json"
191
191
  {
@@ -196,9 +196,9 @@ export async function getDependencyReleaseLine() {}
196
196
 
197
197
  ### Using Monorepo Sub-Project
198
198
 
199
- If your current repository is Monorepo, you can directly manage it using module sub-projects.
199
+ If your current repository is Monorepo, you can directly manage it using NPM module sub-projects.
200
200
 
201
- #### Run `pnpm run new` to create a module sub-project.
201
+ #### Run `pnpm run new` to create a NPM module sub-project
202
202
 
203
203
  ```bash
204
204
  ? Please select the type of project you want to create: Npm Module
@@ -215,7 +215,7 @@ export async function getReleaseLine() {}
215
215
  export async function getDependencyReleaseLine() {}
216
216
  ```
217
217
 
218
- #### Add the sub-project module dependency, such as `custom-changelog`, to the Monorepo root directory.
218
+ #### Add the sub-project module dependency, such as `custom-changelog`, to the Monorepo root directory
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
- #### Configure the changelog configuration of Changesets as the package name.
229
+ #### Configure the changelog configuration of Changesets as the package name
230
230
 
231
231
  ```json title=".changesets/config.json"
232
232
  {