@modern-js/main-doc 0.0.0-next-1685502535286 → 0.0.0-next-1685530921784

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 (160) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/docs/en/components/language-config.mdx +9 -0
  3. package/docs/en/components/package-manager.mdx +11 -0
  4. package/docs/en/guides/advanced-features/rspack-start.mdx +4 -4
  5. package/docs/en/guides/topic-detail/generator/create/_category_.json +4 -0
  6. package/docs/en/guides/topic-detail/generator/create/config.mdx +75 -0
  7. package/docs/en/guides/topic-detail/generator/create/option.md +151 -0
  8. package/docs/en/guides/topic-detail/generator/create/use.mdx +66 -0
  9. package/docs/en/guides/topic-detail/generator/new/_category_.json +4 -0
  10. package/docs/en/guides/topic-detail/generator/new/config.md +155 -0
  11. package/docs/en/guides/topic-detail/generator/new/option.md +67 -0
  12. package/docs/en/guides/topic-detail/generator/new/use.md +95 -0
  13. package/docs/en/guides/topic-detail/generator/plugin/_category_.json +2 -2
  14. package/docs/en/guides/topic-detail/generator/plugin/api/_category_.json +1 -1
  15. package/docs/en/guides/topic-detail/generator/plugin/api/afterForged.md +49 -0
  16. package/docs/en/guides/topic-detail/generator/plugin/api/context.md +184 -0
  17. package/docs/en/guides/topic-detail/generator/plugin/api/input.md +124 -0
  18. package/docs/en/guides/topic-detail/generator/plugin/api/onForged.md +310 -0
  19. package/docs/en/guides/topic-detail/generator/plugin/category.md +88 -0
  20. package/docs/en/guides/topic-detail/generator/plugin/context.md +104 -0
  21. package/docs/en/guides/topic-detail/generator/plugin/structure.md +106 -0
  22. package/docs/en/guides/topic-detail/generator/plugin/use.md +33 -0
  23. package/docs/zh/components/language-config.mdx +9 -0
  24. package/docs/zh/components/package-manager.mdx +11 -0
  25. package/docs/zh/guides/advanced-features/rspack-start.mdx +4 -4
  26. package/docs/zh/guides/topic-detail/generator/create/_category_.json +4 -0
  27. package/docs/zh/guides/topic-detail/generator/create/config.mdx +76 -0
  28. package/docs/zh/guides/topic-detail/generator/create/option.md +151 -0
  29. package/docs/zh/guides/topic-detail/generator/create/use.mdx +66 -0
  30. package/docs/zh/guides/topic-detail/generator/new/_category_.json +4 -0
  31. package/docs/zh/guides/topic-detail/generator/new/config.md +153 -0
  32. package/docs/zh/guides/topic-detail/generator/new/option.md +67 -0
  33. package/docs/zh/guides/topic-detail/generator/new/use.md +94 -0
  34. package/docs/zh/guides/topic-detail/generator/plugin/_category_.json +2 -2
  35. package/docs/zh/guides/topic-detail/generator/plugin/api/_category_.json +1 -1
  36. package/docs/zh/guides/topic-detail/generator/plugin/api/afterForged.md +50 -0
  37. package/docs/zh/guides/topic-detail/generator/plugin/api/context.md +184 -0
  38. package/docs/zh/guides/topic-detail/generator/plugin/api/input.md +124 -0
  39. package/docs/zh/guides/topic-detail/generator/plugin/api/onForged.md +310 -0
  40. package/docs/zh/guides/topic-detail/generator/plugin/category.md +93 -0
  41. package/docs/zh/guides/topic-detail/generator/plugin/context.md +105 -0
  42. package/docs/zh/guides/topic-detail/generator/plugin/structure.md +106 -0
  43. package/docs/zh/guides/topic-detail/generator/plugin/use.md +33 -0
  44. package/package.json +5 -5
  45. package/docs/en/guides/topic-detail/generator/codesmith/_category_.json +0 -4
  46. package/docs/en/guides/topic-detail/generator/codesmith/api/_category_.json +0 -4
  47. package/docs/en/guides/topic-detail/generator/codesmith/api/app.mdx +0 -152
  48. package/docs/en/guides/topic-detail/generator/codesmith/api/ejs.mdx +0 -56
  49. package/docs/en/guides/topic-detail/generator/codesmith/api/fs.mdx +0 -54
  50. package/docs/en/guides/topic-detail/generator/codesmith/api/git.mdx +0 -50
  51. package/docs/en/guides/topic-detail/generator/codesmith/api/handlebars.mdx +0 -57
  52. package/docs/en/guides/topic-detail/generator/codesmith/api/json.mdx +0 -56
  53. package/docs/en/guides/topic-detail/generator/codesmith/api/npm.mdx +0 -48
  54. package/docs/en/guides/topic-detail/generator/codesmith/develop.mdx +0 -53
  55. package/docs/en/guides/topic-detail/generator/codesmith/introduce.mdx +0 -47
  56. package/docs/en/guides/topic-detail/generator/codesmith/run-in-js.mdx +0 -47
  57. package/docs/en/guides/topic-detail/generator/codesmith/structure.mdx +0 -89
  58. package/docs/en/guides/topic-detail/generator/config/_category_.json +0 -4
  59. package/docs/en/guides/topic-detail/generator/config/app.mdx +0 -82
  60. package/docs/en/guides/topic-detail/generator/config/common.mdx +0 -100
  61. package/docs/en/guides/topic-detail/generator/config/module.mdx +0 -42
  62. package/docs/en/guides/topic-detail/generator/config/monorepo.mdx +0 -28
  63. package/docs/en/guides/topic-detail/generator/plugin/abstract.mdx +0 -23
  64. package/docs/en/guides/topic-detail/generator/plugin/api/file/_category_.json +0 -4
  65. package/docs/en/guides/topic-detail/generator/plugin/api/file/addFile.mdx +0 -52
  66. package/docs/en/guides/topic-detail/generator/plugin/api/file/addHelper.mdx +0 -26
  67. package/docs/en/guides/topic-detail/generator/plugin/api/file/addManyFile.mdx +0 -58
  68. package/docs/en/guides/topic-detail/generator/plugin/api/file/addPartial.mdx +0 -26
  69. package/docs/en/guides/topic-detail/generator/plugin/api/file/introduce.mdx +0 -39
  70. package/docs/en/guides/topic-detail/generator/plugin/api/file/rmDir.mdx +0 -24
  71. package/docs/en/guides/topic-detail/generator/plugin/api/file/rmFile.mdx +0 -24
  72. package/docs/en/guides/topic-detail/generator/plugin/api/file/updateJSONFile.mdx +0 -54
  73. package/docs/en/guides/topic-detail/generator/plugin/api/file/updateModernConfig.mdx +0 -27
  74. package/docs/en/guides/topic-detail/generator/plugin/api/file/updateTextRawFile.mdx +0 -33
  75. package/docs/en/guides/topic-detail/generator/plugin/api/git/_category_.json +0 -4
  76. package/docs/en/guides/topic-detail/generator/plugin/api/git/gitAddAndCommit.mdx +0 -20
  77. package/docs/en/guides/topic-detail/generator/plugin/api/git/initGitRepo.mdx +0 -16
  78. package/docs/en/guides/topic-detail/generator/plugin/api/git/isInGitRepo.mdx +0 -16
  79. package/docs/en/guides/topic-detail/generator/plugin/api/hook/_category_.json +0 -4
  80. package/docs/en/guides/topic-detail/generator/plugin/api/hook/afterForged.mdx +0 -35
  81. package/docs/en/guides/topic-detail/generator/plugin/api/hook/onForged.mdx +0 -35
  82. package/docs/en/guides/topic-detail/generator/plugin/api/info/_category_.json +0 -4
  83. package/docs/en/guides/topic-detail/generator/plugin/api/info/isFileExit.mdx +0 -22
  84. package/docs/en/guides/topic-detail/generator/plugin/api/info/locale.mdx +0 -17
  85. package/docs/en/guides/topic-detail/generator/plugin/api/info/readDir.mdx +0 -22
  86. package/docs/en/guides/topic-detail/generator/plugin/api/input/_category_.json +0 -4
  87. package/docs/en/guides/topic-detail/generator/plugin/api/input/addInputAfter.mdx +0 -55
  88. package/docs/en/guides/topic-detail/generator/plugin/api/input/addInputBefore.mdx +0 -55
  89. package/docs/en/guides/topic-detail/generator/plugin/api/input/setInput.mdx +0 -43
  90. package/docs/en/guides/topic-detail/generator/plugin/api/input/setInputValue.mdx +0 -31
  91. package/docs/en/guides/topic-detail/generator/plugin/api/input/type.mdx +0 -65
  92. package/docs/en/guides/topic-detail/generator/plugin/api/introduce.mdx +0 -90
  93. package/docs/en/guides/topic-detail/generator/plugin/api/new/_category_.json +0 -4
  94. package/docs/en/guides/topic-detail/generator/plugin/api/new/createElement.mdx +0 -33
  95. package/docs/en/guides/topic-detail/generator/plugin/api/new/createSubProject.mdx +0 -35
  96. package/docs/en/guides/topic-detail/generator/plugin/api/new/enableFunc.mdx +0 -44
  97. package/docs/en/guides/topic-detail/generator/plugin/api/new/introduce.mdx +0 -15
  98. package/docs/en/guides/topic-detail/generator/plugin/api/npm/_category_.json +0 -4
  99. package/docs/en/guides/topic-detail/generator/plugin/api/npm/install.mdx +0 -18
  100. package/docs/en/guides/topic-detail/generator/plugin/develop.mdx +0 -125
  101. package/docs/en/guides/topic-detail/generator/plugin/use.mdx +0 -61
  102. package/docs/en/guides/topic-detail/generator/project.mdx +0 -118
  103. package/docs/zh/guides/topic-detail/generator/codesmith/_category_.json +0 -4
  104. package/docs/zh/guides/topic-detail/generator/codesmith/api/_category_.json +0 -4
  105. package/docs/zh/guides/topic-detail/generator/codesmith/api/app.mdx +0 -152
  106. package/docs/zh/guides/topic-detail/generator/codesmith/api/ejs.mdx +0 -56
  107. package/docs/zh/guides/topic-detail/generator/codesmith/api/fs.mdx +0 -54
  108. package/docs/zh/guides/topic-detail/generator/codesmith/api/git.mdx +0 -49
  109. package/docs/zh/guides/topic-detail/generator/codesmith/api/handlebars.mdx +0 -56
  110. package/docs/zh/guides/topic-detail/generator/codesmith/api/json.mdx +0 -56
  111. package/docs/zh/guides/topic-detail/generator/codesmith/api/npm.mdx +0 -47
  112. package/docs/zh/guides/topic-detail/generator/codesmith/develop.mdx +0 -53
  113. package/docs/zh/guides/topic-detail/generator/codesmith/introduce.mdx +0 -59
  114. package/docs/zh/guides/topic-detail/generator/codesmith/run-in-js.mdx +0 -47
  115. package/docs/zh/guides/topic-detail/generator/codesmith/structure.mdx +0 -89
  116. package/docs/zh/guides/topic-detail/generator/config/_category_.json +0 -4
  117. package/docs/zh/guides/topic-detail/generator/config/app.mdx +0 -82
  118. package/docs/zh/guides/topic-detail/generator/config/common.mdx +0 -100
  119. package/docs/zh/guides/topic-detail/generator/config/module.mdx +0 -42
  120. package/docs/zh/guides/topic-detail/generator/config/monorepo.mdx +0 -28
  121. package/docs/zh/guides/topic-detail/generator/plugin/abstract.mdx +0 -23
  122. package/docs/zh/guides/topic-detail/generator/plugin/api/file/_category_.json +0 -4
  123. package/docs/zh/guides/topic-detail/generator/plugin/api/file/addFile.mdx +0 -52
  124. package/docs/zh/guides/topic-detail/generator/plugin/api/file/addHelper.mdx +0 -26
  125. package/docs/zh/guides/topic-detail/generator/plugin/api/file/addManyFile.mdx +0 -55
  126. package/docs/zh/guides/topic-detail/generator/plugin/api/file/addPartial.mdx +0 -26
  127. package/docs/zh/guides/topic-detail/generator/plugin/api/file/introduce.mdx +0 -39
  128. package/docs/zh/guides/topic-detail/generator/plugin/api/file/rmDir.mdx +0 -24
  129. package/docs/zh/guides/topic-detail/generator/plugin/api/file/rmFile.mdx +0 -24
  130. package/docs/zh/guides/topic-detail/generator/plugin/api/file/updateJSONFile.mdx +0 -54
  131. package/docs/zh/guides/topic-detail/generator/plugin/api/file/updateModernConfig.mdx +0 -27
  132. package/docs/zh/guides/topic-detail/generator/plugin/api/file/updateTextRawFile.mdx +0 -33
  133. package/docs/zh/guides/topic-detail/generator/plugin/api/git/_category_.json +0 -4
  134. package/docs/zh/guides/topic-detail/generator/plugin/api/git/gitAddAndCommit.mdx +0 -20
  135. package/docs/zh/guides/topic-detail/generator/plugin/api/git/initGitRepo.mdx +0 -16
  136. package/docs/zh/guides/topic-detail/generator/plugin/api/git/isInGitRepo.mdx +0 -16
  137. package/docs/zh/guides/topic-detail/generator/plugin/api/hook/_category_.json +0 -4
  138. package/docs/zh/guides/topic-detail/generator/plugin/api/hook/afterForged.mdx +0 -35
  139. package/docs/zh/guides/topic-detail/generator/plugin/api/hook/onForged.mdx +0 -35
  140. package/docs/zh/guides/topic-detail/generator/plugin/api/info/_category_.json +0 -4
  141. package/docs/zh/guides/topic-detail/generator/plugin/api/info/isFileExit.mdx +0 -22
  142. package/docs/zh/guides/topic-detail/generator/plugin/api/info/locale.mdx +0 -17
  143. package/docs/zh/guides/topic-detail/generator/plugin/api/info/readDir.mdx +0 -22
  144. package/docs/zh/guides/topic-detail/generator/plugin/api/input/_category_.json +0 -4
  145. package/docs/zh/guides/topic-detail/generator/plugin/api/input/addInputAfter.mdx +0 -57
  146. package/docs/zh/guides/topic-detail/generator/plugin/api/input/addInputBefore.mdx +0 -56
  147. package/docs/zh/guides/topic-detail/generator/plugin/api/input/setInput.mdx +0 -43
  148. package/docs/zh/guides/topic-detail/generator/plugin/api/input/setInputValue.mdx +0 -29
  149. package/docs/zh/guides/topic-detail/generator/plugin/api/input/type.mdx +0 -65
  150. package/docs/zh/guides/topic-detail/generator/plugin/api/introduce.mdx +0 -92
  151. package/docs/zh/guides/topic-detail/generator/plugin/api/new/_category_.json +0 -4
  152. package/docs/zh/guides/topic-detail/generator/plugin/api/new/createElement.mdx +0 -33
  153. package/docs/zh/guides/topic-detail/generator/plugin/api/new/createSubProject.mdx +0 -35
  154. package/docs/zh/guides/topic-detail/generator/plugin/api/new/enableFunc.mdx +0 -44
  155. package/docs/zh/guides/topic-detail/generator/plugin/api/new/introduce.mdx +0 -15
  156. package/docs/zh/guides/topic-detail/generator/plugin/api/npm/_category_.json +0 -4
  157. package/docs/zh/guides/topic-detail/generator/plugin/api/npm/install.mdx +0 -16
  158. package/docs/zh/guides/topic-detail/generator/plugin/develop.mdx +0 -125
  159. package/docs/zh/guides/topic-detail/generator/plugin/use.mdx +0 -61
  160. package/docs/zh/guides/topic-detail/generator/project.mdx +0 -118
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @modern-js/main-doc
2
2
 
3
- ## 0.0.0-next-1685502535286
3
+ ## 0.0.0-next-1685530921784
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -16,7 +16,7 @@
16
16
 
17
17
  - Updated dependencies [850cde6673]
18
18
  - Updated dependencies [e7a5f9443b]
19
- - @modern-js/builder-doc@0.0.0-next-1685502535286
19
+ - @modern-js/builder-doc@0.0.0-next-1685530921784
20
20
 
21
21
  ## 2.21.1
22
22
 
@@ -0,0 +1,9 @@
1
+ ### language
2
+
3
+ Question: Please select the programming language.
4
+
5
+ Options:
6
+
7
+ - TS -- ts
8
+
9
+ - ES6+ -- js
@@ -0,0 +1,11 @@
1
+ ### packageManager
2
+
3
+ Question: Please select the package manager.
4
+
5
+ Options:
6
+
7
+ - pnpm -- pnpm
8
+
9
+ - Yarn -- yarn
10
+
11
+ - npm -- npm
@@ -30,7 +30,7 @@ When using Rspack as the bundler, the following Features are temporarily unavail
30
30
 
31
31
  :::
32
32
 
33
- ## Migrating from webpack to Rspack
33
+ ## Enable Rspack build
34
34
 
35
35
  You can enable Rspack build by running `pnpm run new`:
36
36
 
@@ -54,9 +54,9 @@ import appTools, { defineConfig } from '@modern-js/app-tools';
54
54
  });
55
55
  ```
56
56
 
57
- :::tip
58
- When migrating from webpack to Rspack, there may have some differences in build and configuration capabilities. For more details, please refer to [Configuration Differences](https://modernjs.dev/builder/en/guide/advanced/rspack-start.html#migrating-from-webpack-to-rspack).
59
- :::
57
+ ## Migrating configuration
58
+
59
+ After enabling Rspack building capability, further configuration migration is needed by referring to the [Configuration Differences](https://modernjs.dev/builder/en/guide/advanced/rspack-start.html#migrating-from-webpack-to-rspack).
60
60
 
61
61
  ## The relationship between Rspack and Modern.js versions
62
62
 
@@ -0,0 +1,4 @@
1
+ {
2
+ "label": "@modern-js/create",
3
+ "position": 1
4
+ }
@@ -0,0 +1,75 @@
1
+ ---
2
+ sidebar_position: 3
3
+ ---
4
+
5
+ # Configuration Parameters
6
+
7
+ `@modern-js/create` provides the [--config](/guides/topic-detail/generator/create/option.html#-c,---config-<config>) parameter, which is used to specify the answers to interactive questions in advance during the execution process.
8
+
9
+ Here, we will introduce the fields and field values that can be configured in the `config` under different scenario.
10
+
11
+ ## General Configuration
12
+
13
+ ### solution
14
+
15
+ Question: Please select the type of project you want to create.
16
+
17
+ Options:
18
+
19
+ - Web App -- mwa
20
+
21
+ - Npm Module -- module
22
+
23
+ - Doc Site -- doc
24
+
25
+ - Monorepo -- monorepo
26
+
27
+ ### scenes
28
+
29
+ Question: Please select the project scenario.
30
+
31
+ Options:
32
+
33
+ List of plugin keywords when using custom generator plugins.
34
+
35
+ ## Web App
36
+
37
+ import LanguageConfig from '@site-docs-en/components/language-config';
38
+
39
+ <LanguageConfig />
40
+
41
+ import PackageManager from '@site-docs-en/components/package-manager';
42
+
43
+ <PackageManager />
44
+
45
+ ### buildTools
46
+
47
+ Question: Please select the bundler.
48
+
49
+ Options:
50
+
51
+ - webpack -- webpack
52
+
53
+ - Rspack -- rspack
54
+
55
+ ## Npm Module
56
+
57
+ ### packageName
58
+
59
+ Question: Please fill in the project name.
60
+
61
+ :::info
62
+ The value of the `name` field in the `package.json` file of the Npm module, which is a string type.
63
+ :::
64
+
65
+ <LanguageConfig />
66
+
67
+ <PackageManager />
68
+
69
+ ## Modern Doc
70
+
71
+ <PackageManager />
72
+
73
+ ## Monorepo
74
+
75
+ <PackageManager />
@@ -0,0 +1,151 @@
1
+ ---
2
+ sidebar_position: 2
3
+ ---
4
+
5
+ # CLI Options
6
+
7
+ `@modern-js/create` provides many configuration parameters to configure its behavior during execution, which can be viewed using the `--help` parameter:
8
+
9
+ ```bash
10
+ npx @modern-js/create@latest --help
11
+
12
+ Usage: npx @modern-js/create@latest [projectDir]
13
+
14
+ create Modern.js solution project
15
+
16
+ Options:
17
+ --version show create tools version
18
+ --lang <lang> set create tools language(en or zh)
19
+ -c, --config <config> set default project config(json string) (default: "{}")
20
+ -d,--debug using debug mode to log something (default: false)
21
+ --mwa create mwa application using default config (default: false)
22
+ --module create module application using default config (default: false)
23
+ --monorepo create monorepo application using default config (default: false)
24
+ --generator <generator> run custom generator
25
+ -p, --plugin <plugin> use generator plugin to create new solution or customize Modern.js solution (default: [])
26
+ --dist-tag <distTag> use specified tag version for it\'s generator (default: "")
27
+ --packages <packages> set project specific dependency version information (default: "{}")
28
+ --registry <registry> set npm registry url to run npm command (default: "")
29
+ --no-need-install not run install command
30
+ -h, --help display help for command
31
+
32
+ Commands:
33
+ clean-cache clean locale generator cache
34
+ ```
35
+
36
+ The following will provide a detailed introduction to these parameters:
37
+
38
+ ## [projectDir]
39
+
40
+ The project directory name.
41
+
42
+ When executing `@modern-js/create`, a `projectDir` folder will be created in the current directory by default, and the project will be initialized in this folder. If this parameter is empty, the initialization project will be directly generated in the current directory.
43
+
44
+ :::info
45
+ If the contents of the directory where `projectDir` is located are not empty, a prompt will be given whether to continue creating. It is recommended to perform project initialization operations in an empty directory.
46
+ :::
47
+
48
+ ## --version
49
+
50
+ Get the version of the `@modern-js/create` tool.
51
+
52
+ ```bash
53
+ npx @modern-js/create@latest --version
54
+
55
+ [INFO] @modern-js/create v2.21.1
56
+ ```
57
+
58
+ ## --lang \<lang>
59
+
60
+ The execution language, supports `zh` and `en`.
61
+
62
+ By default, `@modern-js/create` will automatically identify the user's system language and choose to use Chinese or English. If the identification fails or does not meet usage habits, you can manually specify it using this parameter.
63
+
64
+ ## -c, --config \<config>
65
+
66
+ Specify the default project configuration.
67
+
68
+ By default, `@modern-js/create` will prompt for interactive questions such as language selection and package management tools during the execution process. When it is necessary to specify these configuration contents in advance, they can be passed in through this field.
69
+
70
+ This field is a JSON string. For example, when specifying a package management tool:
71
+
72
+ ```bash
73
+ npx @modern-js/create@latest --config '{"packageManager": "pnpm"}'
74
+ ```
75
+
76
+ Supported parameters for `config` can be found at [Configuration Parameters](/guides/topic-detail/generator/create/config.html)。
77
+
78
+ ## -d,--debug
79
+
80
+ Display debug logs.
81
+
82
+ When encountering problems during use, you can use this parameter to display debug logs, which is convenient for quickly locating the problem position and troubleshooting.
83
+
84
+ ## --mwa
85
+
86
+ Quickly create a Web App project.
87
+
88
+ ## --module
89
+
90
+ Quickly create a Npm Module project.
91
+
92
+ ## --monorepo
93
+
94
+ Quickly create a Monorepo project.
95
+
96
+ ## -p, --plugin \<plugin>
97
+
98
+ Specify a generator plugin.
99
+
100
+ `@modern-js/create` supports customizing the default project solution type of Modern.js or adding project solution type scenarios using generator plugin. For details, please refer to [Developing Generator Plugin](/guides/topic-detail/generator/plugin/structure.html).
101
+
102
+ ## --generator \<generator>
103
+
104
+ Specify a micro-generator.
105
+
106
+ <!-- TODO 详情可查看[开发微生成器]-->
107
+ `@modern-js/create` supports completely customizing the project generation process using micro-generator.
108
+
109
+ ## --dist-tag \<distTag>
110
+
111
+ Specify the version of the generator and Modern.js-related dependencies.
112
+
113
+ During the execution of `@modern-js/create`, a smaller micro-generator will be executed by default, and the `latest` version of the micro-generator will be used by default. This parameter can be used to specify the version number of the micro-generator to be executed and the version of the installed Modern.js-related dependencies.
114
+
115
+ For example, use the `next` version:
116
+
117
+ ```bash
118
+ npx @modern-js/create@next --dist-tag next
119
+ ```
120
+
121
+ ## --packages \<packages>
122
+
123
+ Specify specific package version dependencies when creating a project.
124
+
125
+ If you need to specify a specific package version when creating a project, you can use this parameter. This parameter will configure `pnpm.overrides` (if the package management tool is pnpm) or `resolutions` to lock the package version number in the `package.json` file in the project root directory.
126
+
127
+ The parameter value is a JSON string.
128
+
129
+ For example, specify the react version:
130
+
131
+ ```bash
132
+ npx @modern-js/create@latest --packages '{"react":"^17"}'
133
+ ```
134
+
135
+ ## --registry \<registry>
136
+
137
+ Specify the sub-generator to execute and the npm registry to fetch project dependencies version.
138
+
139
+ ## --no-need-install
140
+
141
+ Ignore automatic installation of dependencies.
142
+
143
+ By default, `@modern-js/create` will automatically install dependencies after creating a project. Using this parameter can ignore the installation of dependencies.
144
+
145
+ ## clean-cache
146
+
147
+ The `@modern-js/create` command generates sub-generators cache in the tmp directory of the execution machine by default to speed up the generator execution. This command can be used to delete the cache when it needs to be refreshed or when there are problems with the cache.
148
+
149
+ ```bash
150
+ npx @modern-js/create@latest clean-cache
151
+ ```
@@ -0,0 +1,66 @@
1
+ ---
2
+ sidebar_position: 1
3
+ ---
4
+
5
+ # Usage
6
+
7
+ Modern.js provides `@modern-js/create` tool for creating project templates provided by Modern.js, including [Web App](https://modernjs.dev/), [Npm Module](https://modernjs.dev/module-tools), [Modern Doc](https://modernjs.dev/doc-tools), [Monorepo](/guides/topic-detail/monorepo/intro.html).
8
+
9
+ The following will introduce how to use `@modern-js/create`.
10
+
11
+ ## Environment Preparation
12
+
13
+ import Prerequisites from "@site-docs-en/components/prerequisites"
14
+
15
+ <Prerequisites />
16
+
17
+ ## Create a Project with `@modern-js/create`
18
+
19
+ You do not need to install `@modern-js/create` globally, just use npx to run it:
20
+
21
+ ```bash
22
+ npx @modern-js/create@latest [projectDir]
23
+ ```
24
+
25
+ :::info
26
+ `[projectDir]` is the project directory name. If it is not filled in, the project will be created in the current directory.
27
+ :::
28
+
29
+ During the execution, complete the interaction according to the prompt to create a project that meets your requirements.
30
+
31
+ ### Create an Web APP Project
32
+
33
+ ```bash
34
+ npx @modern-js/create@latest web-app
35
+ ? Please select the type of project you want to create: Web App
36
+ ? Please select the programming language: TS
37
+ ? Please select the package manager: pnpm
38
+ ? Please select the bundler: webpack
39
+ ```
40
+
41
+ ### Create an Npm Module Project
42
+
43
+ ```bash
44
+ npx @modern-js/create@latest npm-module
45
+ ? Please select the type of project you want to create: Npm Module
46
+ ? Please fill in the project name: npm-module
47
+ ? Please select the programming language: TS
48
+ ? Please select the package manager: pnpm
49
+ ```
50
+
51
+ ### Create a Modern Doc Project
52
+
53
+ ```bash
54
+ npx @modern-js/create@latest doc-website
55
+ ? Please select the type of project you want to create: Doc Site
56
+ ? Please select the package manager: pnpm
57
+ ```
58
+
59
+ ### Create Monorepo Project
60
+
61
+ ```bash
62
+ npx @modern-js/create@latest monorepo
63
+ ? Please select the type of project you want to create: Doc Site
64
+ ? Please select the package manager: pnpm
65
+ ```
66
+
@@ -0,0 +1,4 @@
1
+ {
2
+ "label": "new Command",
3
+ "position": 2
4
+ }
@@ -0,0 +1,155 @@
1
+ ---
2
+ sidebar_position: 3
3
+ ---
4
+
5
+ # Configuration Parameters
6
+
7
+ The `new` command provides the [--config](/guides/topic-detail/generator/new/option.html#-c,---config-<config>) parameter, which is used to specify the answers to interactive questions in advance during the execution process.
8
+
9
+ Here, we will introduce the fields and field values that can be configured in the `config` under different scenario.
10
+
11
+ ## General Configuration
12
+
13
+ ### actionType
14
+
15
+ Question: Please select the operation you wants.
16
+
17
+ Options:
18
+
19
+ - Create project element -- element
20
+
21
+ - Enable features -- function
22
+
23
+ - Automatic refactors -- refactor
24
+
25
+ ## Web App
26
+
27
+ ### element
28
+
29
+ Question: Please select the type of element to create.
30
+
31
+ Options:
32
+
33
+ - New "entry" -- entry
34
+
35
+ - New "Custom Web Server" source code directory -- server
36
+
37
+ ### name
38
+
39
+ Question: Please fill in the entry name.
40
+
41
+ :::info
42
+ This configuration is required when creating a new application entry, and the configuration value is a string.
43
+ :::
44
+
45
+ ### function
46
+
47
+ Question: Please select the feature name.
48
+
49
+ Options:
50
+
51
+ - Enable Rspack Build -- rspack
52
+
53
+ - Enable Tailwind CSS -- tailwindcss
54
+
55
+ - Enable BFF -- bff
56
+
57
+ - Enable SSG -- ssg
58
+
59
+ - Enable SWC Compile -- swc
60
+
61
+ - Enable Micro Frontend -- micro_frontend
62
+
63
+ - Enable Unit Test / Integration Test -- test
64
+
65
+ - Enable UA-based Polyfill Feature -- polyfill
66
+
67
+ - Enable Global Proxy -- proxy
68
+
69
+ - Enable Visual Testing (Storybook) -- mwa_storybook
70
+
71
+ ### bffType
72
+
73
+ Question: Please select the BFF type
74
+
75
+ Options:
76
+
77
+ - Function -- func
78
+
79
+ - Framework -- framework
80
+
81
+ :::info
82
+ This configuration is required when enabling the BFF function.
83
+ :::
84
+
85
+ ### framework
86
+
87
+ Question: Please select the framework.
88
+
89
+ Options:
90
+
91
+ - Express -- express
92
+
93
+ - Koa -- koa
94
+
95
+ :::info
96
+ This configuration is required when enabling the BFF function.
97
+ :::
98
+
99
+ ### refactor
100
+
101
+ Question: Please select the type of refactoring.
102
+
103
+ Options:
104
+
105
+ - Use React Router v5 -- react_router_5
106
+
107
+ ## Npm Module
108
+
109
+ ### function
110
+
111
+ Question: Please select the feature name.
112
+
113
+ Options:
114
+
115
+ - Enable Unit Test / Integration Test -- test
116
+
117
+ - Enable Tailwind CSS -- tailwindcss
118
+
119
+ - Enable Storybook -- storybook
120
+
121
+ - Enable Runtime API -- runtime_api
122
+
123
+ ## Monorepo
124
+
125
+ ### sub_solution
126
+
127
+ Question: Please select the type of project you want to create.
128
+
129
+ Options:
130
+
131
+ - Web App -- mwa
132
+
133
+ - Web App (Test)-- mwa_test
134
+
135
+ - Npm Module -- module
136
+
137
+ - Npm Module (Inner) -- inner_module
138
+
139
+ ### packageName
140
+
141
+ Question: Please fill in the project name
142
+
143
+ :::info
144
+ The value of the `name` field in the `package.json` file of the sub-project, which is a string type.
145
+
146
+ :::
147
+
148
+ ### packagePath
149
+
150
+ Question: Please fill in the sub-project directory name
151
+
152
+ :::info
153
+ The name of the subdirectory in the `apps` or `packages` directory on which the sub-project is based, which is a string type.
154
+
155
+ :::
@@ -0,0 +1,67 @@
1
+ ---
2
+ sidebar_position: 2
3
+ ---
4
+
5
+ # CLI Parameters
6
+
7
+ The `new` command provides many configuration parameters to configure its behavior during execution, which can be viewed using the `--help` parameter:
8
+
9
+ ```bash
10
+ npm run new --help
11
+
12
+ Usage: modern new [options]
13
+
14
+ enable optional features or add a new entry
15
+
16
+ Options:
17
+ --lang <lang> set new command language(en or zh)
18
+ -c, --config <config> set default generator config(json string)
19
+ -d, --debug using debug mode to log something (default: false)
20
+ --dist-tag <tag> use specified tag version for it's generator
21
+ --registry <registry> set npm registry url to run npm command
22
+ -h, --help display help for command
23
+ ```
24
+
25
+ The following will provide a detailed introduction to these parameters:
26
+
27
+ ## --lang \<lang>
28
+
29
+ The language used for execution, supports `zh` and `en`.
30
+
31
+ By default, the `new` command will automatically recognize the user's system language and choose to use Chinese or English. If recognition fails or does not meet usage habits, this parameter can be used to manually specify it.
32
+
33
+ ## -c, --config \<config>
34
+
35
+ Specify the default configuration for the project.
36
+
37
+ By default, the `new` command will prompt interactive questions during the execution process for selecting operation types, enabling features, etc. When it is necessary to specify these configuration contents in advance, they can be passed in through this field.
38
+
39
+ This field is a JSON string. For example, to specify the BFF framework:
40
+
41
+ ```bash
42
+ npm run new --config '{"framework": "express"}'
43
+ ```
44
+
45
+ The parameters supported by `config` can be viewed in [Configuration Parameters](/guides/topic-detail/generator/new/config.html)。
46
+
47
+ ## -d,--debug
48
+
49
+ Displays debug logs.
50
+
51
+ When encountering problems during use, this parameter can be used to display debug logs, which is convenient for quickly locating the problem location and troubleshooting the problem.
52
+
53
+ ## --registry \<registry>
54
+
55
+ Specify the sub-generator to execute and the npm registry to fetch project dependencies version.
56
+
57
+ ## --dist-tag \<distTag>
58
+
59
+ Specify the generator version.
60
+
61
+ During the execution process of the `new` command, smaller micro-generator will be executed by default, and the latest micro-generator version will be used by default. This parameter can be used to specify the version number of the micro-generator to be executed.
62
+
63
+ For example, using the `next` version:
64
+
65
+ ```bash
66
+ npm run new --dist-tag next
67
+ ```
@@ -0,0 +1,95 @@
1
+ ---
2
+ sidebar_position: 1
3
+ ---
4
+
5
+ # Usage
6
+
7
+ In Web App, Npm Module and Monorepo projects, we provide the `new` command to create project elements, enable features and create sub-project.
8
+
9
+ ## Web App
10
+
11
+ Web App projects use the `new` command provided by `@modern-js/app-tools`.
12
+
13
+
14
+ The `new` command provides three types of operations:
15
+
16
+ - Create project elements
17
+
18
+ - Enable optional features
19
+
20
+ - Automatic refactoring
21
+
22
+ Each type of operation provides a corresponding list of supported options, which can be selected based on the project situation.
23
+
24
+ For example:
25
+
26
+ Create a new application entry:
27
+
28
+ ```bash
29
+ npm run new
30
+ ? Please select the operation you want: Create Element
31
+ ? Please select the type of element to create: New "entry"
32
+ ? Please fill in the entry name: entry
33
+ ```
34
+
35
+ After running, a new folder with the corresponding name of the entry will be created in the `src` directory of the project, along with the default entry file. The previous entry files under the `src` directory will be sorted into the folder corresponding to the `name` field in `package.json`.
36
+
37
+ Enable BFF function:
38
+
39
+ ```bash
40
+ npm run new
41
+ ? Please select the operation you want: Enable Features
42
+ ? Please select the feature name: Enable BFF
43
+ ? Please select the BFF type: Function
44
+ ? Please select the framework: Express
45
+ ```
46
+
47
+ After running, BFF-related dependencies will be installed in the project, and an `api` directory will be created for BFF module development, along with prompt information for registering BFF plugins.
48
+
49
+ :::info
50
+ We did not automatically register the plugin for the user here because the `modern.config.[tj]s` may change during the project lifecycle, and there may be problems with mutual references between modules, so allowing the user to manually register can ensure the correctness of modifying the configuration.
51
+
52
+ In subsequent customized development, if there are similar needs, you can also provide users with operational guidance through prompts, allowing users to manually operate on files.
53
+ :::
54
+
55
+ :::warning
56
+ When running the `new` command, it may be necessary to enable a feature that is not in the list. Check whether the corresponding plugin for the feature has been installed in the `package.json` file of the project. If you still need to use the `new` command to enable it, you need to manually remove the plugin dependency first.
57
+ :::
58
+
59
+ ## Npm Module
60
+
61
+ Npm Module projects use the `new` command provided by `@modern-js/module-tools`.
62
+
63
+ The `new` command provides the ability to enable optional features.
64
+
65
+ For example:
66
+
67
+ Enable Storybook capability:
68
+
69
+ ```bash
70
+ npm run new
71
+ ? Please select the operation you want: Enable Features
72
+ ? Please select the feature name: Enable Storybook
73
+ ```
74
+
75
+ After running, Storybook plugin dependencies will be installed in the project, and the `storybook` command will be added. A `stories` directory will be created for Storybook module development, along with prompt information for registering Storybook plugins.
76
+
77
+ ## Monorepo
78
+
79
+ Monorepo projects use the `new` command provided by `@modern-js/monorepo-tools`.
80
+
81
+ The `new` command provides the ability to create sub-project.
82
+
83
+ For example:
84
+
85
+ Create Web App Sub-project:
86
+
87
+ ```bash
88
+ ? Please select the type of project you want to create: Web App
89
+ ? Please fill in the sub-project name: web_app
90
+ ? Please fill in the sub-project directory name: web_app
91
+ ? Please select the programming language: TS
92
+ ? Please select the bundler: webpack
93
+ ```
94
+
95
+ After running, a sub-project named `web_app` will be created in the `apps` directory of the project. In the sub-project directory, you can still run the `new` command to create project elements and enable features.
@@ -1,4 +1,4 @@
1
1
  {
2
- "label": "Development Generator Plugin",
3
- "position": 4
2
+ "label": "Generator Plugin",
3
+ "position": 2
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "label": "API",
3
- "position": 4
3
+ "position": 5
4
4
  }