@modern-js/main-doc 0.0.0-nightly-20240605170621 → 0.0.0-nightly-20240606170638

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 (58) hide show
  1. package/docs/en/guides/get-started/tech-stack.mdx +0 -6
  2. package/docs/en/guides/topic-detail/framework-plugin/plugin-api.mdx +1 -1
  3. package/docs/en/guides/topic-detail/generator/create/option.md +0 -5
  4. package/docs/en/guides/topic-detail/generator/create/use.mdx +1 -10
  5. package/docs/en/guides/topic-detail/generator/new/config.md +0 -29
  6. package/docs/en/guides/topic-detail/generator/new/use.md +0 -20
  7. package/docs/zh/guides/get-started/tech-stack.mdx +0 -6
  8. package/docs/zh/guides/topic-detail/framework-plugin/plugin-api.mdx +1 -1
  9. package/docs/zh/guides/topic-detail/generator/create/option.md +0 -5
  10. package/docs/zh/guides/topic-detail/generator/create/use.mdx +1 -10
  11. package/docs/zh/guides/topic-detail/generator/new/config.md +0 -31
  12. package/docs/zh/guides/topic-detail/generator/new/use.md +0 -20
  13. package/package.json +5 -5
  14. package/docs/en/apis/app/runtime/testing/_category_.json +0 -4
  15. package/docs/en/apis/app/runtime/testing/act.mdx +0 -35
  16. package/docs/en/apis/app/runtime/testing/cleanup.mdx +0 -40
  17. package/docs/en/apis/app/runtime/testing/render.mdx +0 -71
  18. package/docs/en/apis/app/runtime/testing/renderApp.mdx +0 -34
  19. package/docs/en/configure/app/testing/_category_.json +0 -4
  20. package/docs/en/configure/app/testing/transformer.mdx +0 -17
  21. package/docs/en/configure/app/tools/jest.mdx +0 -40
  22. package/docs/en/guides/advanced-features/testing.mdx +0 -47
  23. package/docs/en/guides/topic-detail/changesets/_category_.json +0 -4
  24. package/docs/en/guides/topic-detail/changesets/add.mdx +0 -125
  25. package/docs/en/guides/topic-detail/changesets/changelog.mdx +0 -238
  26. package/docs/en/guides/topic-detail/changesets/commit.mdx +0 -269
  27. package/docs/en/guides/topic-detail/changesets/config.mdx +0 -147
  28. package/docs/en/guides/topic-detail/changesets/github.mdx +0 -175
  29. package/docs/en/guides/topic-detail/changesets/introduce.mdx +0 -56
  30. package/docs/en/guides/topic-detail/changesets/release-note.mdx +0 -274
  31. package/docs/en/guides/topic-detail/changesets/release-pre.mdx +0 -49
  32. package/docs/en/guides/topic-detail/changesets/release.mdx +0 -229
  33. package/docs/en/guides/topic-detail/model/test-model.mdx +0 -45
  34. package/docs/zh/apis/app/runtime/testing/_category_.json +0 -4
  35. package/docs/zh/apis/app/runtime/testing/act.mdx +0 -35
  36. package/docs/zh/apis/app/runtime/testing/cleanup.mdx +0 -40
  37. package/docs/zh/apis/app/runtime/testing/render.mdx +0 -71
  38. package/docs/zh/apis/app/runtime/testing/renderApp.mdx +0 -32
  39. package/docs/zh/configure/app/testing/_category_.json +0 -4
  40. package/docs/zh/configure/app/testing/transformer.mdx +0 -19
  41. package/docs/zh/configure/app/tools/jest.mdx +0 -40
  42. package/docs/zh/guides/advanced-features/testing.mdx +0 -47
  43. package/docs/zh/guides/topic-detail/changesets/_category_.json +0 -4
  44. package/docs/zh/guides/topic-detail/changesets/add.mdx +0 -126
  45. package/docs/zh/guides/topic-detail/changesets/changelog.mdx +0 -238
  46. package/docs/zh/guides/topic-detail/changesets/commit.mdx +0 -269
  47. package/docs/zh/guides/topic-detail/changesets/config.mdx +0 -147
  48. package/docs/zh/guides/topic-detail/changesets/github.mdx +0 -175
  49. package/docs/zh/guides/topic-detail/changesets/introduce.mdx +0 -56
  50. package/docs/zh/guides/topic-detail/changesets/release-note.mdx +0 -274
  51. package/docs/zh/guides/topic-detail/changesets/release-pre.mdx +0 -50
  52. package/docs/zh/guides/topic-detail/changesets/release.mdx +0 -231
  53. package/docs/zh/guides/topic-detail/model/test-model.mdx +0 -45
  54. package/docs/zh/guides/topic-detail/monorepo/_category_.json +0 -4
  55. package/docs/zh/guides/topic-detail/monorepo/create-sub-project.mdx +0 -53
  56. package/docs/zh/guides/topic-detail/monorepo/intro.mdx +0 -14
  57. package/docs/zh/guides/topic-detail/monorepo/publish.mdx +0 -69
  58. package/docs/zh/guides/topic-detail/monorepo/sub-project-interface.mdx +0 -143
@@ -1,125 +0,0 @@
1
- ---
2
- sidebar_position: 2
3
- ---
4
-
5
- # Add Changesets
6
-
7
- When we finish development, we need to add a changeset to declare the current changes for version releases.
8
-
9
- ## Information
10
-
11
- A changeset includes:
12
-
13
- - Which packages are affected by this change.
14
-
15
- - The type of version for this change, which complies with the [semver](https://semver.org/) specification.
16
-
17
- - Changelog information for this change.
18
-
19
- ## Steps
20
-
21
- :::info
22
- The following example commands are all using pnpm. If you need to use other package managers, please replace them as needed.
23
- :::
24
-
25
- ### Modern.js Module
26
-
27
- #### Run the change command in the root directory:
28
-
29
- ```bash
30
- pnpm run change
31
- ```
32
-
33
- #### Select the type of version for this change
34
-
35
- ![](https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/changeset-select-version.png)
36
-
37
- #### Fill in the changelog information
38
-
39
- ![](https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/changeset-input-changelog.png)
40
-
41
- After running, a corresponding changeset file will be created in the `.changeset` directory of the project, and the file content is as follows:
42
-
43
- ```markdown
44
- ---
45
- 'module-changeset': patch
46
- ---
47
-
48
- feat: test module solution changeset
49
- ```
50
-
51
- This file contains all the information of the changeset.
52
-
53
- ### Monorepo
54
-
55
- There are three NPM module packages in the monorepo, `module-1`, `module-2`, and `module-3`.
56
-
57
- #### Run the change command in the root directory
58
-
59
- ```bash
60
- pnpm run change
61
- ```
62
-
63
- #### Select the list of packages to upgrade for this change
64
-
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
-
67
- Use the space key to select the corresponding package or category, and then press Enter after the selection is completed:
68
-
69
- ![](https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/changeset-select-packages.png)
70
-
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.
74
-
75
- ![](https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/changeset-auto-select-patch.png)
76
-
77
- #### Fill in the changelog information
78
-
79
- ![](https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/changeset-input-changelog-monorepo.png)
80
-
81
- After running, a corresponding changeset file will be created in the `.changeset` directory of the project, and the file content is as follows:
82
-
83
- ```markdown
84
- ---
85
- 'module-2': minor
86
- 'module-3': patch
87
- ---
88
-
89
- feat: test-changeset
90
- ```
91
-
92
- This file contains all the information of the changeset, and different packages will be marked according to the selected version type.
93
-
94
- ## Parameters
95
-
96
- The `change` command supports the following parameters:
97
-
98
- - `--empty`: Adds an empty changeset.
99
-
100
- ```bash
101
- pnpm run change --empty
102
- ```
103
-
104
- After running, an empty changeset file will be created in the `.changeset` directory of the project, and the file content is as follows:
105
-
106
- ```markdown
107
- ---
108
- ---
109
- ```
110
-
111
- - `--open`: When using this parameter, the system default editor will be opened for filling in the changelog.
112
-
113
- ## Notes
114
-
115
- - Not all changes require changesets
116
-
117
- If the current change is to modify some infrastructure of the repository, such as CI, testing, etc., there is no need to add changesets, or an empty changeset can be added.
118
-
119
- - Multiple changesets can be submitted in one pull request
120
-
121
- When a pull request has multiple feature developments or bug fixes, multiple `pnpm run change` commands can be executed to add multiple changeset files. Each file selects the corresponding packages for the feature and adds change information.
122
-
123
- - When creating a changeset, all packages related to the feature need to be selected
124
-
125
- When creating a changeset in a Monorepo, all related packages to the feature need to be selected to avoid some packages not being published when releasing.
@@ -1,238 +0,0 @@
1
- ---
2
- sidebar_position: 6
3
- ---
4
-
5
- # Customizing Changelog
6
-
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
-
9
- ## Customizing Changelog Content
10
-
11
- Changelog mainly includes the following two types of information:
12
-
13
- - Changelog written in the changeset.
14
-
15
- - Version change information of related packages in this version upgrade.
16
-
17
- The custom logic mainly implements two functions, `getReleaseLine` and `getDependencyReleaseLine`, which are used to define the above two types of information, respectively.
18
-
19
- ### getReleaseLine
20
-
21
- #### Params
22
-
23
- - changeset
24
-
25
- ```ts
26
- export type VersionType = 'major' | 'minor' | 'patch' | 'none';
27
-
28
- export type Release = { name: string; type: VersionType };
29
-
30
- export type 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
- };
36
- ```
37
-
38
- - type
39
-
40
- The upgraded version type corresponding to the current package, which is of type `VersionType` mentioned above.
41
-
42
- #### Returns
43
-
44
- Changelog content.
45
-
46
- #### Default Implementation
47
-
48
- The default processing logic of `@changesets/cli/changelog` is to split the `summary` information according to the newline `\n`, add `-` as the list header before the first line, and organize other content as the supplement of the first line below the list.
49
-
50
- ```ts
51
- async function getReleaseLine(changeset, type) {
52
- const [firstLine, ...futureLines] = changeset.summary
53
- .split('\n')
54
- .map(l => l.trimRight());
55
-
56
- let returnVal = `- ${
57
- changeset.commit ? `${changeset.commit}: ` : ''
58
- }${firstLine}`;
59
-
60
- if (futureLines.length > 0) {
61
- returnVal += `\n${futureLines.map(l => ` ${l}`).join('\n')}`;
62
- }
63
-
64
- return returnVal;
65
- }
66
- ```
67
-
68
- ### getDependencyReleaseLine
69
-
70
- #### Params
71
-
72
- - changesets
73
-
74
- All associated changeset information, which is an array of `getReleaseLine` changeset types.
75
-
76
- - dependenciesUpdated
77
-
78
- ```ts
79
- type ModCompWithPackage = {
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
- };
88
-
89
- type DependenciesUpdated = ModCompWithPackage[];
90
- ```
91
-
92
- #### Returns
93
-
94
- Changelog content.
95
-
96
- #### Default Implementation
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 of the corresponding dependency package as a child list item of the list.
99
-
100
- ```ts
101
- async function getDependencyReleaseLine(changesets, dependenciesUpdated) {
102
- console.log('getDependencyReleaseLine', changesets, dependenciesUpdated);
103
- if (dependenciesUpdated.length === 0) return '';
104
-
105
- const changesetLinks = changesets.map(
106
- changeset =>
107
- `- Updated dependencies${
108
- changeset.commit ? ` [${changeset.commit}]` : ''
109
- }`,
110
- );
111
-
112
- const updatedDepenenciesList = dependenciesUpdated.map(
113
- dependency => ` - ${dependency.name}@${dependency.newVersion}`,
114
- );
115
-
116
- return [...changesetLinks, ...updatedDepenenciesList].join('\n');
117
- }
118
- ```
119
-
120
- It is displayed as follows:
121
-
122
- ```markdown
123
- - Updated dependencies [f0438ab]
124
- - Updated dependencies [f0438ab]
125
- - module-3@2.0.0
126
- - module-1@0.2.0
127
- ```
128
-
129
- ## Configuration
130
-
131
- The `changelog` field in the changesets configuration file is used to mark the way to get changelog.
132
-
133
- This configuration can be a string, directly declaring the module name or path of the changelog module.
134
-
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
-
137
- ### Configuring Relative Paths
138
-
139
- If the changelog configuration is a relative path, it is a relative path under the `.changesets` directory.
140
-
141
- For example, create the `.changeset/my-changelog-config.js` file and define the following content:
142
-
143
- ```ts title=".changeset/my-changelog-config.js"
144
- async function getReleaseLine(changeset, type) {}
145
-
146
- async function getDependencyReleaseLine(changesets, dependenciesUpdated) {}
147
-
148
- module.exports = {
149
- getReleaseLine,
150
- getDependencyReleaseLine,
151
- };
152
- ```
153
-
154
- Configure `changlog` as `./my-changelog-config.js`:
155
-
156
- ```json title=".changesets/config.json"
157
- {
158
- "changelog": "./my-changelog-config.js",
159
- ...
160
- }
161
- ```
162
-
163
- ### Using Modern.js Module
164
-
165
- Customizing changelog can also be managed using the Modern.js Module to provide a common solution.
166
-
167
- #### Use `npx @modern-js/create@latest` to create a Modern.js Module.
168
-
169
- ```md
170
- ? Please select the type of project you want to create: Npm Module
171
- ? Please fill in the project name: custom-changelog
172
- ? Please select the programming language: TS
173
- ? Please select the package manager: pnpm
174
- ```
175
-
176
- #### Implement Custom Content
177
-
178
- ```ts title="src/index.ts"
179
- export async function getReleaseLine() {}
180
-
181
- export async function getDependencyReleaseLine() {}
182
- ```
183
-
184
- #### Publish the module to NPM
185
-
186
- #### Install the module in the root directory of the target repository, such as `custom-changelog`.
187
-
188
- #### Configure the changelog configuration of changesets as the package name.
189
-
190
- ```json title=".changesets/config.json"
191
- {
192
- "changelog": "custom-changelog",
193
- ...
194
- }
195
- ```
196
-
197
- ### Using Monorepo Sub-Project
198
-
199
- If your current repository is Monorepo, you can directly manage it using NPM module sub-projects.
200
-
201
- #### Run `pnpm run new` to create a NPM module sub-project
202
-
203
- ```bash
204
- ? Please select the type of project you want to create: Npm Module
205
- ? Please fill in the sub-project name: custom-changelog
206
- ? Please fill in the sub-project directory name: custom-changelog
207
- ? Please select the programming language: TS
208
- ```
209
-
210
- #### Implement Custom Content
211
-
212
- ```ts title="src/index.ts"
213
- export async function getReleaseLine() {}
214
-
215
- export async function getDependencyReleaseLine() {}
216
- ```
217
-
218
- #### Add the sub-project module dependency, such as `custom-changelog`, to the Monorepo root directory
219
-
220
- ```json title="package.json"
221
- {
222
- "devDependencies": {
223
- "custom-changelog": "workspace:*",
224
- ...
225
- }
226
- }
227
- ```
228
-
229
- #### Configure the changelog configuration of Changesets as the package name
230
-
231
- ```json title=".changesets/config.json"
232
- {
233
- "changelog": "custom-changelog",
234
- ...
235
- }
236
- ```
237
-
238
- After the module is published to NPM, it can still be used like a module type for other repositories.
@@ -1,269 +0,0 @@
1
- ---
2
- sidebar_position: 7
3
- ---
4
-
5
- # Customizing Commit Messages
6
-
7
- Changesets supports configuring `commit` to automatically submit the current changes when running the `change` and `bump` commands.
8
-
9
- The default `commit` information is provided by `@changesets/cli/commit`, and the default information format is:
10
-
11
- ![change commit](https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/changeset-change-commit-info.png)
12
- ![bump commit](https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/changeset-bump-commit-info.png)
13
-
14
- When the default commit information cannot meet the requirements, custom commit information is supported.
15
-
16
- ## Customizing Commit Message Content
17
-
18
- Commit information is divided into two types:
19
-
20
- - Commit information automatically generated when running the `change` command.
21
- - Commit information automatically generated when running the `bump` command.
22
-
23
- The custom logic mainly implements two functions, `getAddMessage` and `getVersionMessage`, which are used to define the above two types of information, respectively.
24
-
25
- ### getAddMessage
26
-
27
- #### Params
28
-
29
- - changeset
30
-
31
- The current changeset information created.
32
-
33
- ```ts
34
- type Release = {
35
- name: string;
36
- type: VersionType;
37
- };
38
-
39
- type Changeset = {
40
- summary: string;
41
- releases: Array<Release>;
42
- };
43
- ```
44
-
45
- - options
46
-
47
- Configuration information when committing.
48
-
49
- > When the commit configuration is an array, the second parameter supports passing in default configuration information, which will be used to pass this parameter.
50
-
51
- #### Returns
52
-
53
- Commit message content.
54
-
55
- #### Default Implementation
56
-
57
- The default processing logic of `@changesets/cli/commit` is to start with `docs(changeset):`, and the commit information is the `summary` of the changeset, and [skip ci] information is added according to the `skipCI` parameter configuration passed in.
58
-
59
- ```ts
60
- type SkipCI = boolean | 'add' | 'version';
61
-
62
- const getAddMessage = async (
63
- changeset: Changeset,
64
- options: { skipCI?: SkipCI } | null,
65
- ) => {
66
- const skipCI = options?.skipCI === 'add' || options?.skipCI === true;
67
- return outdent`docs(changeset): ${changeset.summary}${
68
- skipCI ? `\n\n[skip ci]\n` : ''
69
- }`;
70
- };
71
- ```
72
-
73
- > [outdent](https://www.npmjs.com/package/outdent) is used to remove the leading whitespace content of the template string to make the commit information more compliant with the specification.
74
-
75
- ### getVersionMessage
76
-
77
- #### Params
78
-
79
- - releasePlan
80
-
81
- ```ts
82
- type VersionType = 'major' | 'minor' | 'patch' | 'none';
83
-
84
- type Release = {
85
- name: string;
86
- type: VersionType;
87
- };
88
-
89
- type Changeset = {
90
- id: string;
91
- summary: string;
92
- releases: Array<Release>;
93
- };
94
-
95
- type ComprehensiveRelease = {
96
- name: string;
97
- type: VersionType;
98
- oldVersion: string;
99
- newVersion: string;
100
- changesets: string[];
101
- };
102
-
103
- type PreState = {
104
- mode: 'pre' | 'exit'; // Current state of pre mode
105
- tag: string; // Type of pre
106
- initialVersions: {
107
- [pkgName: string]: string; // Package name and version information before version upgrade
108
- };
109
- changesets: string[]; // List of changeset ids for this upgrade
110
- };
111
-
112
- type ReleasePlan = {
113
- changesets: Changeset[]; // List of changesets for this upgrade
114
- releases: ComprehensiveRelease[]; // Information of the current upgrade, including package name, current version, upgraded version, and upgrade type
115
- preState: PreState | undefined; // If it is a pre-release, provide relevant state information
116
- };
117
- ```
118
-
119
- - options
120
-
121
- Configuration information when committing.
122
-
123
- > When the commit configuration is an array, the second parameter supports passing in default configuration information, which will be used to pass this parameter.
124
-
125
- #### Returns
126
-
127
- Commit message content.
128
-
129
- #### Default Implementation
130
-
131
- The default processing logic of `@changesets/cli/commit` is to first display the number of packages that need to be released, then display the names and new version of the released packages, and [skip ci] information is added according to the `skipCI` parameter configuration passed in.
132
-
133
- ```ts
134
- const getVersionMessage = async (
135
- releasePlan: ReleasePlan,
136
- options: { skipCI?: SkipCI } | null,
137
- ) => {
138
- const skipCI = options?.skipCI === 'version' || options?.skipCI === true;
139
- const publishableReleases = releasePlan.releases.filter(
140
- release => release.type !== 'none',
141
- );
142
- const numPackagesReleased = publishableReleases.length;
143
-
144
- const releasesLines = publishableReleases
145
- .map(release => ` ${release.name}@${release.newVersion}`)
146
- .join('\n');
147
-
148
- return outdent`
149
- RELEASING: Releasing ${numPackagesReleased} package(s)
150
-
151
- Releases:
152
- ${releasesLines}
153
- ${skipCI ? `\n[skip ci]\n` : ''}
154
- `;
155
- };
156
- ```
157
-
158
- ## Configuration
159
-
160
- The `commit` field in the changesets configuration file is used to mark whether to submit commit information when running the `change` and `bump` commands, and the way to obtain commit information.
161
-
162
- This configuration can be a `boolean`. When it is `true`, the default `@changesets/cli/commit` formatting commit information will be used.
163
-
164
- This configuration can be a string, directly declaring the module name or path of the commit information acquisition module.
165
-
166
- This configuration also supports configuring arrays. The first element in the array is the module name or path of the commit information acquisition module, and the second element is the parameter value passed to the corresponding function, which will be passed as the second parameter of the `getAddMessage` and `getVersionMessage` functions.
167
-
168
- ### Configuring Relative Paths
169
-
170
- If the commit configuration is a relative path, it is a relative path under the `.changesets` directory.
171
-
172
- For example, create the `.changeset/my-commit-config.js` file and define the following content:
173
-
174
- ```js title=".changeset/my-commit-config.js"
175
- async function getAddMessage(changeset, options) {}
176
-
177
- async function getVersionMessage(releasePlan, options) {}
178
-
179
- module.exports = {
180
- getAddMessage,
181
- getVersionMessage,
182
- };
183
- ```
184
-
185
- Configure `commit` as `./my-commit-config.js`:
186
-
187
- ```json title=".changesets/config.json"
188
- {
189
- "changelog": "./my-commit-config.js",
190
- ...
191
- }
192
- ```
193
-
194
- ### Using Modern.js Module
195
-
196
- Customizing commit can also be managed using the Modern.js Module to provide a common solution.
197
-
198
- #### Use `npx @modern-js/create@latest` to create a mModern.js Module
199
-
200
- ```md
201
- ? Please select the type of project you want to create: Npm Module
202
- ? Please fill in the project name: custom-commit
203
- ? Please select the programming language: TS
204
- ? Please select the package manager: pnpm
205
- ```
206
-
207
- #### Implement Custom Content
208
-
209
- ```ts title="src/index.ts"
210
- export async function getAddMessage() {}
211
-
212
- export async function getVersionMessage() {}
213
- ```
214
-
215
- #### Publish the module to NPM
216
-
217
- #### Install the corresponding module in the root directory of the target repository, such as `custom-commit`
218
-
219
- #### Configure the commit configuration of changesets as the package name
220
-
221
- ```json title="package.json"
222
- {
223
- "commit": "custom-commit",
224
- ...
225
- }
226
- ```
227
-
228
- ### Using Monorepo Sub-Project
229
-
230
- If your current repository is Monorepo, you can directly manage it using NPM module sub-projects.
231
-
232
- #### Run `pnpm run new` to create a module sub-project
233
-
234
- ```bash
235
- ? Please select the type of project you want to create: Npm Module
236
- ? Please fill in the sub-project name: custom-commit
237
- ? Please fill in the sub-project directory name: custom-commit
238
- ? Please select the programming language: TS
239
- ```
240
-
241
- #### Implement Custom Content
242
-
243
- ```ts title="src/index.ts"
244
- export async function getAddMessage() {}
245
-
246
- export async function getVersionMessage() {}
247
- ```
248
-
249
- #### Add the sub-project module dependency, such as `custom-commit`, to the Monorepo root directory
250
-
251
- ```json title="package.json"
252
- {
253
- "devDependencies": {
254
- "custom-commit": "workspace:*",
255
- ...
256
- }
257
- }
258
- ```
259
-
260
- #### Configure the commit configuration of Changesets as the package name
261
-
262
- ```json title=".changesets/config.json"
263
- {
264
- "commit": "custom-commit",
265
- ...
266
- }
267
- ```
268
-
269
- After the module is published to NPM, it can still be used like a module type for other repositories.