@modern-js/main-doc 2.21.1 → 2.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (253) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/docs/en/apis/app/commands.mdx +5 -5
  3. package/docs/en/apis/app/hooks/api/api.mdx +80 -0
  4. package/docs/en/apis/app/hooks/api/app.mdx +12 -0
  5. package/docs/en/apis/app/hooks/api/lambda.mdx +57 -0
  6. package/docs/en/apis/app/hooks/api/test.mdx +1 -1
  7. package/docs/en/apis/app/hooks/config/html.mdx +2 -2
  8. package/docs/en/apis/app/hooks/config/icon.mdx +19 -19
  9. package/docs/en/apis/app/hooks/config/mock.mdx +1 -1
  10. package/docs/en/apis/app/hooks/config/public.mdx +10 -10
  11. package/docs/en/apis/app/hooks/config/storybook.mdx +3 -3
  12. package/docs/en/apis/app/hooks/config/upload.mdx +13 -13
  13. package/docs/en/apis/app/hooks/modern-config.mdx +4 -4
  14. package/docs/en/apis/app/hooks/server/index_.mdx +2 -9
  15. package/docs/en/apis/app/hooks/server/test.mdx +5 -2
  16. package/docs/en/apis/app/hooks/shared.mdx +1 -1
  17. package/docs/en/apis/app/hooks/src/app.mdx +17 -27
  18. package/docs/en/apis/app/hooks/src/index_.mdx +6 -6
  19. package/docs/en/apis/app/hooks/src/pages.mdx +41 -37
  20. package/docs/en/apis/app/hooks/src/routes.mdx +16 -36
  21. package/docs/en/apis/app/hooks/src/server.mdx +1 -1
  22. package/docs/en/apis/app/hooks/src/stories.mdx +6 -3
  23. package/docs/en/apis/app/hooks/src/test.mdx +4 -3
  24. package/docs/en/apis/app/runtime/core/use-runtime-context.mdx +5 -1
  25. package/docs/en/apis/app/runtime/web-server/hook.mdx +2 -2
  26. package/docs/en/apis/app/runtime/web-server/middleware.mdx +2 -2
  27. package/docs/en/components/init-app.mdx +3 -3
  28. package/docs/en/components/init-rspack-app.mdx +4 -4
  29. package/docs/en/components/language-config.mdx +9 -0
  30. package/docs/en/components/package-manager.mdx +11 -0
  31. package/docs/en/components/ua-polyfill.mdx +2 -2
  32. package/docs/en/configure/app/source/config-dir.mdx +1 -1
  33. package/docs/en/configure/app/source/design-system.mdx +67 -67
  34. package/docs/en/configure/app/source/disable-default-entries.mdx +6 -5
  35. package/docs/en/configure/app/source/disable-entry-dirs.mdx +5 -5
  36. package/docs/en/configure/app/source/enable-async-entry.mdx +9 -9
  37. package/docs/en/configure/app/source/entries-dir.mdx +3 -3
  38. package/docs/en/configure/app/source/entries.mdx +21 -19
  39. package/docs/en/configure/app/tools/swc.mdx +2 -2
  40. package/docs/en/guides/advanced-features/bff/frameworks.mdx +2 -2
  41. package/docs/en/guides/advanced-features/bff/function.mdx +4 -4
  42. package/docs/en/guides/advanced-features/bff/type.mdx +5 -5
  43. package/docs/en/guides/advanced-features/rspack-start.mdx +6 -6
  44. package/docs/en/guides/advanced-features/ssg.mdx +2 -2
  45. package/docs/en/guides/advanced-features/testing.mdx +2 -2
  46. package/docs/en/guides/advanced-features/web-server.mdx +2 -2
  47. package/docs/en/guides/basic-features/css.mdx +2 -2
  48. package/docs/en/guides/basic-features/mock.mdx +1 -1
  49. package/docs/en/guides/basic-features/routes.mdx +11 -7
  50. package/docs/en/guides/concept/entries.mdx +3 -3
  51. package/docs/en/guides/topic-detail/generator/create/_category_.json +4 -0
  52. package/docs/en/guides/topic-detail/generator/create/config.mdx +75 -0
  53. package/docs/en/guides/topic-detail/generator/create/option.md +151 -0
  54. package/docs/en/guides/topic-detail/generator/create/use.mdx +66 -0
  55. package/docs/en/guides/topic-detail/generator/new/_category_.json +4 -0
  56. package/docs/en/guides/topic-detail/generator/new/config.md +155 -0
  57. package/docs/en/guides/topic-detail/generator/new/option.md +67 -0
  58. package/docs/en/guides/topic-detail/generator/new/use.md +95 -0
  59. package/docs/en/guides/topic-detail/generator/plugin/_category_.json +2 -2
  60. package/docs/en/guides/topic-detail/generator/plugin/api/_category_.json +1 -1
  61. package/docs/en/guides/topic-detail/generator/plugin/api/afterForged.md +49 -0
  62. package/docs/en/guides/topic-detail/generator/plugin/api/context.md +184 -0
  63. package/docs/en/guides/topic-detail/generator/plugin/api/input.md +124 -0
  64. package/docs/en/guides/topic-detail/generator/plugin/api/onForged.md +310 -0
  65. package/docs/en/guides/topic-detail/generator/plugin/category.md +88 -0
  66. package/docs/en/guides/topic-detail/generator/plugin/context.md +104 -0
  67. package/docs/en/guides/topic-detail/generator/plugin/structure.md +106 -0
  68. package/docs/en/guides/topic-detail/generator/plugin/use.md +33 -0
  69. package/docs/en/guides/topic-detail/micro-frontend/c02-development.mdx +8 -8
  70. package/docs/en/tutorials/first-app/c03-css.mdx +2 -2
  71. package/docs/en/tutorials/first-app/c08-entries.mdx +3 -3
  72. package/docs/zh/apis/app/commands.mdx +3 -3
  73. package/docs/zh/apis/app/hooks/api/{functions/api.mdx → api.mdx} +4 -4
  74. package/docs/zh/apis/app/hooks/api/app.mdx +12 -0
  75. package/docs/zh/apis/app/hooks/api/{framework/lambda.mdx → lambda.mdx} +5 -5
  76. package/docs/zh/apis/app/hooks/api/test.mdx +3 -3
  77. package/docs/zh/apis/app/hooks/config/icon.mdx +15 -15
  78. package/docs/zh/apis/app/hooks/config/mock.mdx +1 -1
  79. package/docs/zh/apis/app/hooks/config/public.mdx +3 -3
  80. package/docs/zh/apis/app/hooks/config/upload.mdx +1 -1
  81. package/docs/zh/apis/app/hooks/modern-config.mdx +3 -3
  82. package/docs/zh/apis/app/hooks/server/index_.mdx +1 -6
  83. package/docs/zh/apis/app/hooks/shared.mdx +1 -1
  84. package/docs/zh/apis/app/hooks/src/app.mdx +15 -25
  85. package/docs/zh/apis/app/hooks/src/index_.mdx +6 -6
  86. package/docs/zh/apis/app/hooks/src/pages.mdx +7 -3
  87. package/docs/zh/apis/app/hooks/src/routes.mdx +4 -4
  88. package/docs/zh/apis/app/hooks/src/stories.mdx +1 -1
  89. package/docs/zh/apis/app/runtime/core/use-runtime-context.mdx +5 -1
  90. package/docs/zh/components/language-config.mdx +9 -0
  91. package/docs/zh/components/package-manager.mdx +11 -0
  92. package/docs/zh/components/ua-polyfill.mdx +1 -1
  93. package/docs/zh/configure/app/source/design-system.mdx +3 -4
  94. package/docs/zh/configure/app/source/enable-async-entry.mdx +2 -5
  95. package/docs/zh/configure/app/source/entries.mdx +2 -2
  96. package/docs/zh/configure/app/tools/swc.mdx +2 -2
  97. package/docs/zh/guides/advanced-features/rspack-start.mdx +6 -6
  98. package/docs/zh/guides/advanced-features/ssg.mdx +1 -1
  99. package/docs/zh/guides/advanced-features/testing.mdx +2 -2
  100. package/docs/zh/guides/advanced-features/web-server.mdx +1 -1
  101. package/docs/zh/guides/basic-features/css.mdx +1 -1
  102. package/docs/zh/guides/basic-features/mock.mdx +1 -1
  103. package/docs/zh/guides/basic-features/routes.mdx +7 -4
  104. package/docs/zh/guides/concept/entries.mdx +3 -3
  105. package/docs/zh/guides/topic-detail/generator/create/_category_.json +4 -0
  106. package/docs/zh/guides/topic-detail/generator/create/config.mdx +76 -0
  107. package/docs/zh/guides/topic-detail/generator/create/option.md +151 -0
  108. package/docs/zh/guides/topic-detail/generator/create/use.mdx +66 -0
  109. package/docs/zh/guides/topic-detail/generator/new/_category_.json +4 -0
  110. package/docs/zh/guides/topic-detail/generator/new/config.md +153 -0
  111. package/docs/zh/guides/topic-detail/generator/new/option.md +67 -0
  112. package/docs/zh/guides/topic-detail/generator/new/use.md +94 -0
  113. package/docs/zh/guides/topic-detail/generator/plugin/_category_.json +2 -2
  114. package/docs/zh/guides/topic-detail/generator/plugin/api/_category_.json +1 -1
  115. package/docs/zh/guides/topic-detail/generator/plugin/api/afterForged.md +50 -0
  116. package/docs/zh/guides/topic-detail/generator/plugin/api/context.md +184 -0
  117. package/docs/zh/guides/topic-detail/generator/plugin/api/input.md +124 -0
  118. package/docs/zh/guides/topic-detail/generator/plugin/api/onForged.md +310 -0
  119. package/docs/zh/guides/topic-detail/generator/plugin/category.md +93 -0
  120. package/docs/zh/guides/topic-detail/generator/plugin/context.md +105 -0
  121. package/docs/zh/guides/topic-detail/generator/plugin/structure.md +106 -0
  122. package/docs/zh/guides/topic-detail/generator/plugin/use.md +33 -0
  123. package/docs/zh/guides/topic-detail/micro-frontend/c02-development.mdx +4 -4
  124. package/docs/zh/guides/topic-detail/model/test-model.mdx +1 -1
  125. package/docs/zh/tutorials/first-app/c03-css.mdx +1 -1
  126. package/docs/zh/tutorials/first-app/c08-entries.mdx +1 -1
  127. package/package.json +5 -5
  128. package/docs/en/apis/app/hooks/api/framework/_category_.json +0 -4
  129. package/docs/en/apis/app/hooks/api/framework/lambda.mdx +0 -57
  130. package/docs/en/apis/app/hooks/api/functions/_category_.json +0 -4
  131. package/docs/en/apis/app/hooks/api/functions/api.mdx +0 -81
  132. package/docs/en/apis/app/hooks/api/functions/app.mdx +0 -12
  133. package/docs/en/apis/app/hooks/api/functions/common.mdx +0 -9
  134. package/docs/en/guides/topic-detail/generator/codesmith/_category_.json +0 -4
  135. package/docs/en/guides/topic-detail/generator/codesmith/api/_category_.json +0 -4
  136. package/docs/en/guides/topic-detail/generator/codesmith/api/app.mdx +0 -152
  137. package/docs/en/guides/topic-detail/generator/codesmith/api/ejs.mdx +0 -56
  138. package/docs/en/guides/topic-detail/generator/codesmith/api/fs.mdx +0 -54
  139. package/docs/en/guides/topic-detail/generator/codesmith/api/git.mdx +0 -50
  140. package/docs/en/guides/topic-detail/generator/codesmith/api/handlebars.mdx +0 -57
  141. package/docs/en/guides/topic-detail/generator/codesmith/api/json.mdx +0 -56
  142. package/docs/en/guides/topic-detail/generator/codesmith/api/npm.mdx +0 -48
  143. package/docs/en/guides/topic-detail/generator/codesmith/develop.mdx +0 -53
  144. package/docs/en/guides/topic-detail/generator/codesmith/introduce.mdx +0 -47
  145. package/docs/en/guides/topic-detail/generator/codesmith/run-in-js.mdx +0 -47
  146. package/docs/en/guides/topic-detail/generator/codesmith/structure.mdx +0 -89
  147. package/docs/en/guides/topic-detail/generator/config/_category_.json +0 -4
  148. package/docs/en/guides/topic-detail/generator/config/app.mdx +0 -82
  149. package/docs/en/guides/topic-detail/generator/config/common.mdx +0 -100
  150. package/docs/en/guides/topic-detail/generator/config/module.mdx +0 -42
  151. package/docs/en/guides/topic-detail/generator/config/monorepo.mdx +0 -28
  152. package/docs/en/guides/topic-detail/generator/plugin/abstract.mdx +0 -23
  153. package/docs/en/guides/topic-detail/generator/plugin/api/file/_category_.json +0 -4
  154. package/docs/en/guides/topic-detail/generator/plugin/api/file/addFile.mdx +0 -52
  155. package/docs/en/guides/topic-detail/generator/plugin/api/file/addHelper.mdx +0 -26
  156. package/docs/en/guides/topic-detail/generator/plugin/api/file/addManyFile.mdx +0 -58
  157. package/docs/en/guides/topic-detail/generator/plugin/api/file/addPartial.mdx +0 -26
  158. package/docs/en/guides/topic-detail/generator/plugin/api/file/introduce.mdx +0 -39
  159. package/docs/en/guides/topic-detail/generator/plugin/api/file/rmDir.mdx +0 -24
  160. package/docs/en/guides/topic-detail/generator/plugin/api/file/rmFile.mdx +0 -24
  161. package/docs/en/guides/topic-detail/generator/plugin/api/file/updateJSONFile.mdx +0 -54
  162. package/docs/en/guides/topic-detail/generator/plugin/api/file/updateModernConfig.mdx +0 -27
  163. package/docs/en/guides/topic-detail/generator/plugin/api/file/updateTextRawFile.mdx +0 -33
  164. package/docs/en/guides/topic-detail/generator/plugin/api/git/_category_.json +0 -4
  165. package/docs/en/guides/topic-detail/generator/plugin/api/git/gitAddAndCommit.mdx +0 -20
  166. package/docs/en/guides/topic-detail/generator/plugin/api/git/initGitRepo.mdx +0 -16
  167. package/docs/en/guides/topic-detail/generator/plugin/api/git/isInGitRepo.mdx +0 -16
  168. package/docs/en/guides/topic-detail/generator/plugin/api/hook/_category_.json +0 -4
  169. package/docs/en/guides/topic-detail/generator/plugin/api/hook/afterForged.mdx +0 -35
  170. package/docs/en/guides/topic-detail/generator/plugin/api/hook/onForged.mdx +0 -35
  171. package/docs/en/guides/topic-detail/generator/plugin/api/info/_category_.json +0 -4
  172. package/docs/en/guides/topic-detail/generator/plugin/api/info/isFileExit.mdx +0 -22
  173. package/docs/en/guides/topic-detail/generator/plugin/api/info/locale.mdx +0 -17
  174. package/docs/en/guides/topic-detail/generator/plugin/api/info/readDir.mdx +0 -22
  175. package/docs/en/guides/topic-detail/generator/plugin/api/input/_category_.json +0 -4
  176. package/docs/en/guides/topic-detail/generator/plugin/api/input/addInputAfter.mdx +0 -55
  177. package/docs/en/guides/topic-detail/generator/plugin/api/input/addInputBefore.mdx +0 -55
  178. package/docs/en/guides/topic-detail/generator/plugin/api/input/setInput.mdx +0 -43
  179. package/docs/en/guides/topic-detail/generator/plugin/api/input/setInputValue.mdx +0 -31
  180. package/docs/en/guides/topic-detail/generator/plugin/api/input/type.mdx +0 -65
  181. package/docs/en/guides/topic-detail/generator/plugin/api/introduce.mdx +0 -90
  182. package/docs/en/guides/topic-detail/generator/plugin/api/new/_category_.json +0 -4
  183. package/docs/en/guides/topic-detail/generator/plugin/api/new/createElement.mdx +0 -33
  184. package/docs/en/guides/topic-detail/generator/plugin/api/new/createSubProject.mdx +0 -35
  185. package/docs/en/guides/topic-detail/generator/plugin/api/new/enableFunc.mdx +0 -44
  186. package/docs/en/guides/topic-detail/generator/plugin/api/new/introduce.mdx +0 -15
  187. package/docs/en/guides/topic-detail/generator/plugin/api/npm/_category_.json +0 -4
  188. package/docs/en/guides/topic-detail/generator/plugin/api/npm/install.mdx +0 -18
  189. package/docs/en/guides/topic-detail/generator/plugin/develop.mdx +0 -125
  190. package/docs/en/guides/topic-detail/generator/plugin/use.mdx +0 -61
  191. package/docs/en/guides/topic-detail/generator/project.mdx +0 -118
  192. package/docs/zh/apis/app/hooks/api/framework/_category_.json +0 -4
  193. package/docs/zh/apis/app/hooks/api/functions/_category_.json +0 -4
  194. package/docs/zh/apis/app/hooks/api/functions/app.mdx +0 -12
  195. package/docs/zh/apis/app/hooks/api/functions/common.mdx +0 -9
  196. package/docs/zh/guides/topic-detail/generator/codesmith/_category_.json +0 -4
  197. package/docs/zh/guides/topic-detail/generator/codesmith/api/_category_.json +0 -4
  198. package/docs/zh/guides/topic-detail/generator/codesmith/api/app.mdx +0 -152
  199. package/docs/zh/guides/topic-detail/generator/codesmith/api/ejs.mdx +0 -56
  200. package/docs/zh/guides/topic-detail/generator/codesmith/api/fs.mdx +0 -54
  201. package/docs/zh/guides/topic-detail/generator/codesmith/api/git.mdx +0 -49
  202. package/docs/zh/guides/topic-detail/generator/codesmith/api/handlebars.mdx +0 -56
  203. package/docs/zh/guides/topic-detail/generator/codesmith/api/json.mdx +0 -56
  204. package/docs/zh/guides/topic-detail/generator/codesmith/api/npm.mdx +0 -47
  205. package/docs/zh/guides/topic-detail/generator/codesmith/develop.mdx +0 -53
  206. package/docs/zh/guides/topic-detail/generator/codesmith/introduce.mdx +0 -59
  207. package/docs/zh/guides/topic-detail/generator/codesmith/run-in-js.mdx +0 -47
  208. package/docs/zh/guides/topic-detail/generator/codesmith/structure.mdx +0 -89
  209. package/docs/zh/guides/topic-detail/generator/config/_category_.json +0 -4
  210. package/docs/zh/guides/topic-detail/generator/config/app.mdx +0 -82
  211. package/docs/zh/guides/topic-detail/generator/config/common.mdx +0 -100
  212. package/docs/zh/guides/topic-detail/generator/config/module.mdx +0 -42
  213. package/docs/zh/guides/topic-detail/generator/config/monorepo.mdx +0 -28
  214. package/docs/zh/guides/topic-detail/generator/plugin/abstract.mdx +0 -23
  215. package/docs/zh/guides/topic-detail/generator/plugin/api/file/_category_.json +0 -4
  216. package/docs/zh/guides/topic-detail/generator/plugin/api/file/addFile.mdx +0 -52
  217. package/docs/zh/guides/topic-detail/generator/plugin/api/file/addHelper.mdx +0 -26
  218. package/docs/zh/guides/topic-detail/generator/plugin/api/file/addManyFile.mdx +0 -55
  219. package/docs/zh/guides/topic-detail/generator/plugin/api/file/addPartial.mdx +0 -26
  220. package/docs/zh/guides/topic-detail/generator/plugin/api/file/introduce.mdx +0 -39
  221. package/docs/zh/guides/topic-detail/generator/plugin/api/file/rmDir.mdx +0 -24
  222. package/docs/zh/guides/topic-detail/generator/plugin/api/file/rmFile.mdx +0 -24
  223. package/docs/zh/guides/topic-detail/generator/plugin/api/file/updateJSONFile.mdx +0 -54
  224. package/docs/zh/guides/topic-detail/generator/plugin/api/file/updateModernConfig.mdx +0 -27
  225. package/docs/zh/guides/topic-detail/generator/plugin/api/file/updateTextRawFile.mdx +0 -33
  226. package/docs/zh/guides/topic-detail/generator/plugin/api/git/_category_.json +0 -4
  227. package/docs/zh/guides/topic-detail/generator/plugin/api/git/gitAddAndCommit.mdx +0 -20
  228. package/docs/zh/guides/topic-detail/generator/plugin/api/git/initGitRepo.mdx +0 -16
  229. package/docs/zh/guides/topic-detail/generator/plugin/api/git/isInGitRepo.mdx +0 -16
  230. package/docs/zh/guides/topic-detail/generator/plugin/api/hook/_category_.json +0 -4
  231. package/docs/zh/guides/topic-detail/generator/plugin/api/hook/afterForged.mdx +0 -35
  232. package/docs/zh/guides/topic-detail/generator/plugin/api/hook/onForged.mdx +0 -35
  233. package/docs/zh/guides/topic-detail/generator/plugin/api/info/_category_.json +0 -4
  234. package/docs/zh/guides/topic-detail/generator/plugin/api/info/isFileExit.mdx +0 -22
  235. package/docs/zh/guides/topic-detail/generator/plugin/api/info/locale.mdx +0 -17
  236. package/docs/zh/guides/topic-detail/generator/plugin/api/info/readDir.mdx +0 -22
  237. package/docs/zh/guides/topic-detail/generator/plugin/api/input/_category_.json +0 -4
  238. package/docs/zh/guides/topic-detail/generator/plugin/api/input/addInputAfter.mdx +0 -57
  239. package/docs/zh/guides/topic-detail/generator/plugin/api/input/addInputBefore.mdx +0 -56
  240. package/docs/zh/guides/topic-detail/generator/plugin/api/input/setInput.mdx +0 -43
  241. package/docs/zh/guides/topic-detail/generator/plugin/api/input/setInputValue.mdx +0 -29
  242. package/docs/zh/guides/topic-detail/generator/plugin/api/input/type.mdx +0 -65
  243. package/docs/zh/guides/topic-detail/generator/plugin/api/introduce.mdx +0 -92
  244. package/docs/zh/guides/topic-detail/generator/plugin/api/new/_category_.json +0 -4
  245. package/docs/zh/guides/topic-detail/generator/plugin/api/new/createElement.mdx +0 -33
  246. package/docs/zh/guides/topic-detail/generator/plugin/api/new/createSubProject.mdx +0 -35
  247. package/docs/zh/guides/topic-detail/generator/plugin/api/new/enableFunc.mdx +0 -44
  248. package/docs/zh/guides/topic-detail/generator/plugin/api/new/introduce.mdx +0 -15
  249. package/docs/zh/guides/topic-detail/generator/plugin/api/npm/_category_.json +0 -4
  250. package/docs/zh/guides/topic-detail/generator/plugin/api/npm/install.mdx +0 -16
  251. package/docs/zh/guides/topic-detail/generator/plugin/develop.mdx +0 -125
  252. package/docs/zh/guides/topic-detail/generator/plugin/use.mdx +0 -61
  253. package/docs/zh/guides/topic-detail/generator/project.mdx +0 -118
@@ -1,27 +0,0 @@
1
- ---
2
- sidebar_position: 8
3
- ---
4
-
5
- # updateModernConfig
6
-
7
- Update the `modernConfig` field in `package.json`.
8
-
9
- This method is available on the `onForged` time to live API parameter.
10
-
11
- Its type is defined as:
12
-
13
- ```ts
14
- export type ForgedAPI = {
15
- updateModernConfig: (updateInfo: Record<string, any>) => Promise<void>;
16
- ...
17
- };
18
- ```
19
-
20
- ## updateInfo
21
-
22
- Field update information.
23
-
24
- :::info
25
- This function is the package of updateJSONFile, which will automatically update the `modernConfig` field of `package.json`. Just fill in the update information relative to `modernConfig` in the updateInfo.
26
-
27
- :::
@@ -1,33 +0,0 @@
1
- ---
2
- sidebar_position: 7
3
- ---
4
-
5
- # updateTextRawFile
6
-
7
- Update the text list file content.
8
-
9
- This method works with the text list file type.
10
-
11
- This method is available on the `onForged` time to live API parameter.
12
-
13
- Its type is defined as:
14
-
15
- ```ts
16
- export type ForgedAPI = {
17
- updateTextRawFile: (
18
- fileName: string,
19
- update: (content: string[]) => string[],
20
- ) => Promise<void>;
21
- ...
22
- };
23
- ```
24
-
25
- ## fileName
26
-
27
- The filename or file path of the text list file.
28
-
29
- ## update
30
-
31
- Update function.
32
-
33
- The function parameter is the current file content. The content will be divided by `\n` and passed into function in the form of array. The return value of function is also array. The internal will be automatically merged with `\n` and written to the source file.
@@ -1,4 +0,0 @@
1
- {
2
- "label": "GIT API",
3
- "position": 8
4
- }
@@ -1,20 +0,0 @@
1
- ---
2
- sidebar_position: 3
3
- ---
4
-
5
- # gitAddAndCommit
6
-
7
- Commit the current repository changes.
8
-
9
- Its type is defined as:
10
-
11
- ```ts
12
- export type AfterForgedAPI = {
13
- gitAddAndCommit: (commitMessage: string) => Promise<void>;
14
- ...
15
- };
16
- ```
17
-
18
- ## commitMessage
19
-
20
- Commit information.
@@ -1,16 +0,0 @@
1
- ---
2
- sidebar_position: 2
3
- ---
4
-
5
- # initGitRepo
6
-
7
- nitialization The current directory is the Git repository.
8
-
9
- Its type is defined as:
10
-
11
- ```ts
12
- export type AfterForgedAPI = {
13
- initGitRepo: () => Promise<void>;
14
- ...
15
- };
16
- ```
@@ -1,16 +0,0 @@
1
- ---
2
- sidebar_position: 1
3
- ---
4
-
5
- # isInGitRepo
6
-
7
- Determines whether the current project is a Git repository.
8
-
9
- Its type is defined as:
10
-
11
- ```ts
12
- export type AfterForgedAPI = {
13
- isInGitRepo: () => Promise<boolean>;
14
- ...
15
- };
16
- ```
@@ -1,4 +0,0 @@
1
- {
2
- "label": "Hook Function API",
3
- "position": 5
4
- }
@@ -1,35 +0,0 @@
1
- ---
2
- sidebar_position: 2
3
- ---
4
-
5
- # AfterForged
6
-
7
- `afterForged` function is the generator plugin time to live function, which is usually used to define operations such as installation dependency and Git. Professional operations will be performed after the onForged function is executed.
8
-
9
- The method is available directly on the context.
10
-
11
- Its type is defined as:
12
-
13
- ```ts
14
- export type PluginAfterForgedFunc = (
15
- api: AfterForgedAPI,
16
- inputData: Record<string, unknown>,
17
- ) => Promise<void>;
18
-
19
- export interface IPluginContext {
20
- afterForged: (func: PluginAfterForgedFunc) => void;
21
- ...
22
- }
23
- ```
24
-
25
- ## func
26
-
27
- The onForged parameter is a callback function, and the function parameters are `api` and `inputData`.
28
-
29
- ### api
30
-
31
- A list of supported functions in `afterForged` time to live, specifically viewabl [Git API](/guides/topic-detail/generator/plugin/api/git/isInGitRepo) 和 [NPM API](/guides/topic-detail/generator/plugin/api/npm/install).
32
-
33
- ### inputData
34
-
35
- Current user input, the user can be used to obtain the current input information and configuration information.
@@ -1,35 +0,0 @@
1
- ---
2
- sidebar_position: 1
3
- ---
4
-
5
- # OnForged
6
-
7
- `onForged` function is the generator plugin time to live function, which is usually used to define file type operations that will be performed after the completion of the base project solution file operation.
8
-
9
- The method is available directly on the context.
10
-
11
- Its type is defined as:
12
-
13
- ```ts
14
- export type PluginForgedFunc = (
15
- api: ForgedAPI,
16
- inputData: Record<string, unknown>,
17
- ) => void | Promise<void>;
18
-
19
- export interface IPluginContext {
20
- onForged: (func: PluginForgedFunc) => void;
21
- ...
22
- }
23
- ```
24
-
25
- ## func
26
-
27
- The onForged parameter is a callback function, and the function parameters are `api` and `inputData`.
28
-
29
- ### api
30
-
31
- A list of supported functions in `onForged` time to live, specifically viewable [File API](/guides/topic-detail/generator/plugin/api/file/introduce) and [Enable function API](/guides/topic-detail/generator/plugin/api/new/introduce).
32
-
33
- ### inputData
34
-
35
- Current user input, the user can be used to obtain the current input information and configuration information.
@@ -1,4 +0,0 @@
1
- {
2
- "label": "Get Information API",
3
- "position": 4
4
- }
@@ -1,22 +0,0 @@
1
- ---
2
- sidebar_position: 2
3
- ---
4
-
5
- # isFileExist
6
-
7
- Determine if the file exists.
8
-
9
- The method is available directly on the context.
10
-
11
- Its type is defined as:
12
-
13
- ```ts
14
- export interface IPluginContext {
15
- isFileExist: (fileName: string) => Promise<boolean>;
16
- ...
17
- }
18
- ```
19
-
20
- ## fileName
21
-
22
- The file name or file path that needs to be judged is based on the relative path of the created project.
@@ -1,17 +0,0 @@
1
- ---
2
- sidebar_position: 1
3
- ---
4
-
5
- # locale
6
-
7
- Current language.
8
-
9
- The method is available directly on the context.
10
-
11
- There are two values for this field:
12
-
13
- - zh: Chinese
14
-
15
- - en: English
16
-
17
- The generator plugin can adjust the value of the relevant display field according to this field.
@@ -1,22 +0,0 @@
1
- ---
2
- sidebar_position: 3
3
- ---
4
-
5
- # readDir
6
-
7
- Read the folder and get the file list.
8
-
9
- The method is available directly on the context.
10
-
11
- Its type is defined as:
12
-
13
- ```ts
14
- export interface IPluginContext {
15
- readDir: (dir: string) => Promise<string[]>;
16
- ...
17
- }
18
- ```
19
-
20
- ## dir
21
-
22
- Its type is defined as: folder name or path, based on the relative path of the created project.
@@ -1,4 +0,0 @@
1
- {
2
- "label": "Customized Input API",
3
- "position": 3
4
- }
@@ -1,55 +0,0 @@
1
- ---
2
- sidebar_position: 3
3
- ---
4
-
5
- # addInputAfter
6
-
7
- Add input question after default input.
8
-
9
- The method is available directly on the context.
10
-
11
- Its type is defined as:
12
-
13
- ```ts
14
- export interface IPluginContext {
15
- addInputAfter: (key: string, input: Schema) => void;
16
- ...
17
- }
18
- ```
19
-
20
- ## key
21
-
22
- Modern.js the problem keyword of the configuration of the engineering solution, the specific configuration viewable [Generator Configuration](/guides/topic-detail/generator/config/common).
23
-
24
- ## input
25
-
26
- Questions that need to be added, specific type definition viewable [Customize input related type definition](/guides/topic-detail/generator/plugin/api/input/type).
27
-
28
- ## Example
29
-
30
- Add input after package manager:
31
-
32
- ```ts
33
- context.addInputAfter('packageManager', {
34
- type: 'object',
35
- properties: {
36
- language: {
37
- type: 'string',
38
- title: 'Develop Language',
39
- enum: [
40
- { label: 'TS', value: 'ts' },
41
- { label: 'ES6+', value: 'js' },
42
- ],
43
- },
44
- },
45
- });
46
- ```
47
-
48
- :::info Notes
49
- 1. The key of the added question cannot be duplicated with the key of the question of the item type itself provided by the Modern.js.
50
-
51
- 2. The priority of adding the problem `addInputAfter` is higher than `addInputBefore`. When adding After problem to one `key` and Before problem to the next key at the same time, After problem will be before Before.
52
-
53
- 3. When multiple questions need to be added before or after the same `key`, the method can be called multiple times, and the order of questions will be permutated in the order in which they are called.
54
-
55
- :::
@@ -1,55 +0,0 @@
1
- ---
2
- sidebar_position: 2
3
- ---
4
-
5
- # addInputBefore
6
-
7
- Add input question before default input.
8
-
9
- The method is available directly on the context.
10
-
11
- Its type is defined as:
12
-
13
- ```ts
14
- export interface IPluginContext {
15
- addInputBefore: (key: string, input: Schema) => void;
16
- ...
17
- }
18
- ```
19
-
20
- ## key
21
-
22
- Modern.js the problem keyword of the configuration of the engineering solution, the specific configuration viewable [Generator Configuration](/guides/topic-detail/generator/config/common).
23
-
24
- ## input
25
-
26
- Questions that need to be added, specific type definition viewable [Customize input related type definition](/guides/topic-detail/generator/plugin/api/input/type).
27
-
28
- ## Example
29
-
30
- Add input before package manager:
31
-
32
- ```ts
33
- context.addInputBefore('packageManager', {
34
- type: 'object',
35
- properties: {
36
- language: {
37
- type: 'string',
38
- title: 'Develop Langauge',
39
- enum: [
40
- { label: 'TS', value: 'ts' },
41
- { label: 'ES6+', value: 'js' },
42
- ],
43
- },
44
- },
45
- });
46
- ```
47
-
48
- :::info Notes
49
- 1. The key of the added question cannot be duplicated with the key of the question of the item type itself provided by the Modern.js.
50
-
51
- 2. The priority of adding the problem `addInputAfter` is higher than `addInputBefore`. When adding After problem to one `key` and Before problem to the next key at the same time, After problem will be before Before.
52
-
53
- 3. When multiple questions need to be added before or after the same `key`, the method can be called multiple times, and the order of questions will be permutated in the order in which they are called.
54
-
55
- :::
@@ -1,43 +0,0 @@
1
- ---
2
- sidebar_position: 4
3
- ---
4
-
5
- # setInput
6
-
7
- Set the problem attribute.
8
-
9
- The method is available directly on the context.
10
-
11
- Its type is defined as:
12
-
13
- ```ts
14
- export interface IPluginContext {
15
- setInput: (key: string, field: string, value: unknown) => void;
16
- ...
17
- }
18
- ```
19
-
20
- ## key
21
-
22
- The problem keyword can be the problem keyword of the Modern.js project solution, or the keyword of the new problem in the generator plugin.
23
-
24
- ## filed
25
-
26
- he problem field to be set, you can modify other fields except the key of the current Input, Input specific type definition viewable [Customize input related type definition](/guides/topic-detail/generator/plugin/api/input/type).
27
-
28
- ## value
29
-
30
- The value of the problem field to be setted. value supports function, the function parameter is the current field value, and the return value needs to be the complete new field value.
31
-
32
- :::info
33
- For the input options provided by the Modern.js project type, only delete is temporarily supported, and increase is not supported. The increase will cause problems in the logical judgment in the code.
34
-
35
- :::
36
-
37
- ## Example
38
-
39
- Modify the display name of `packageName`:
40
-
41
- ```ts
42
- context.setInput('packageName', 'title', 'Show title');
43
- ```
@@ -1,31 +0,0 @@
1
- ---
2
- sidebar_position: 7
3
- ---
4
-
5
- # setInputValue
6
-
7
- Sets the input default value.
8
-
9
- The method is available directly on the context.
10
-
11
- Its type is defined as:
12
-
13
- ```ts
14
- export interface IPluginContext {
15
- setInputValue: (value: Record<string, unknown>) => void;
16
- ...
17
- }
18
- ```
19
-
20
- ## Example
21
-
22
- ```ts
23
- context.setInputValue({
24
- moduleRunWay: 'no',
25
- });
26
- ```
27
-
28
- :::warning
29
- This method only supports setting the configuration parameter value corresponding to the project solution integrated by the generator plugin, and does not support setting the project solution type (solution) and project scene (scenes). These two configurations can be set by the `--config` parameter at execution default value.
30
-
31
- :::
@@ -1,65 +0,0 @@
1
- ---
2
- sidebar_position: 1
3
- ---
4
-
5
- # Customize input related type definition
6
-
7
- ## Input
8
-
9
- Modern.js Input input type uses the open source [Formily](https://formilyjs.org/) Schema, with support for some of its Schema fields.
10
-
11
- ### type
12
-
13
- schema types. Currently, the input supported by the generator plugin is of type `string`, `number` and `object`. Where `object` is used for implementation schema nested, it needs to be used in conjunction with `properties`.
14
-
15
- ### name
16
-
17
- schema keyword.
18
-
19
- ### title
20
-
21
- schema display name.
22
-
23
- ### default
24
-
25
- schema default value.
26
-
27
- ### enum
28
-
29
- If the schema is selection type, this field is used to define the option content.
30
-
31
- Each option supports two fields:
32
-
33
- - value: option value.
34
-
35
- - label: display name.
36
-
37
- ### x-validator
38
-
39
- schema verification rules. Formily's verification method is supported here, for details, please refer to [Formily Validate](https://formilyjs.org/zh-CN/guide/advanced/validate).
40
-
41
- ### x-reactions
42
-
43
- schema field linkage. Formily's linkage method is supported here, for details, please refer to [Formily Linkages](https://formilyjs.org/zh-CN/guide/advanced/linkages).
44
-
45
- ### properties
46
-
47
- When schema type is `object`, define its subforms.
48
-
49
- ## Example
50
-
51
- ```ts
52
- const schema = {
53
- type: 'object',
54
- properties: {
55
- language: {
56
- type: 'string',
57
- title: 'Develop Langauge',
58
- enum: [
59
- { label: 'TS', value: 'ts' },
60
- { label: 'ES6+', value: 'js' },
61
- ],
62
- },
63
- },
64
- };
65
- ```
@@ -1,90 +0,0 @@
1
- ---
2
- sidebar_position: 1
3
- ---
4
-
5
- # Introduction
6
-
7
- Modern.js supports the customization of the provided engineering solutions by means of generator plugins or the customization of specific scenarios for engineering solutions.
8
-
9
- ## Generator plugin composition
10
-
11
- The generator plugin is a module that can be developed directly using Modern.js module engineering solutions. Of course, Modern.js also provides the corresponding generator plugin (`@modern-js/generator-plugin-plugin`) to directly create a new generator plugin project.
12
-
13
- A generator plugin project directory is as follows:
14
-
15
- ```bash
16
- .
17
- ├── README.md
18
- ├── package.json
19
- ├── src
20
- │ ├── index.ts
21
- │ └── modern-app-env.d.ts
22
- ├── templates
23
- └── tsconfig.json
24
- ```
25
-
26
- The `src/index.ts` is the source code directory, which is used to develop the generator plugin logic. The plugin exports a function by default, and the function parameter is `context`. Some methods are provided on the `context` to directly operate the current project. These methods will be introduced in detail later in this chapter.
27
-
28
- The `templates` directory is the template directory used to store template files that need to be used in the generator plugin.
29
-
30
- ## Classification
31
-
32
- There are two types of generator plugins:
33
-
34
- 1. Extended engineering: directly customize the three major engineering provided by default.
35
-
36
- 2. Create engineering scenes: Create corresponding engineering scenes based on the default three major engineering schemes.
37
-
38
- ### Type definition
39
-
40
- The classification of the generator plugin is provided by the meta information in the `package.json`.
41
-
42
- #### Extended engineering
43
-
44
- ```json
45
- {
46
- "meta": {
47
- "extend": "mwa" // The three engineering is mwa, module, monorepo
48
- }
49
- }
50
- ```
51
-
52
- #### Create engineering scenes
53
-
54
- ```json
55
- {
56
- "meta": {
57
- "key": "new_solution",
58
- "name": "New Solution",
59
- "type": "mwa" // In addition to the three major engineering solutions, the type here also supports the customize (custom) type
60
- }
61
- }
62
- ```
63
-
64
- `key` is the scene scheme name and the value is a character string.
65
- `name` is the display name of the scene scheme, used for the display of the option when used, and the value is a character string.
66
- `type` is the project solution type. In addition to supporting three project solutions like `extend`, it also supports the customize (custom) type.
67
-
68
- ### Custom type
69
-
70
- The customize type provides the implementation capability of the full custom project solution. When using this type to create a new project solution scenario, only a small amount of code for best practices at the development level is provided, such as `.gitignore`, `.editorConfig` and other files, specifically for the following directory structure:
71
-
72
- ```
73
- .
74
- ├── .editorconfig
75
- ├── .gitignore
76
- ├── .idea
77
- │ ├── codeStyles
78
- │ │ ├── Project.xml
79
- │ │ └── codeStyleConfig.xml
80
- │ ├── inspectionProfiles
81
- │ │ └── Project_Default.xml
82
- │ └── jsLinters
83
- │ └── eslint.xml
84
- ├── .nvmrc
85
- └── .vscode
86
- ├── extensions.json
87
- └── settings.json
88
- ```
89
-
90
- Customized types ensure flexible configuration according to their needs for engineering solutions.
@@ -1,4 +0,0 @@
1
- {
2
- "label": "Enable function API",
3
- "position": 6
4
- }
@@ -1,33 +0,0 @@
1
- ---
2
- sidebar_position: 2
3
- ---
4
-
5
- # createElement
6
-
7
- Create engineering elements that only support application engineering solutions.
8
-
9
- This method is available on the `onForged` API parameter.
10
-
11
- Its type is defined as:
12
-
13
- ```ts
14
- export enum ActionElement {
15
- Entry = 'entry',
16
- Server = 'server',
17
- }
18
- export type ForgedAPI = {
19
- createElement: (
20
- element: ActionElement,
21
- params: Record<string, unknown>,
22
- ) => Promise<void>;
23
- ...
24
- };
25
- ```
26
-
27
- ## element
28
-
29
- Project element type, supports entry and server.
30
-
31
- ## params
32
-
33
- For other parameters of creating elements, please refer to[App New Command](/guides/topic-detail/generator/config/app).