@modern-js/module-tools-docs 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +144 -0
- package/docs/en/api/plugin-api/plugin-hooks.md +2 -10
- package/docs/en/guide/advance/in-depth-about-dev-command.md +56 -12
- package/docs/en/guide/basic/before-getting-started.md +4 -14
- package/docs/en/guide/basic/command-preview.md +1 -1
- package/docs/en/guide/basic/modify-output-product.md +6 -2
- package/docs/en/guide/basic/use-micro-generator.md +62 -1
- package/docs/en/guide/basic/using-storybook.mdx +31 -9
- package/docs/en/guide/intro/getting-started.md +17 -8
- package/docs/en/index.md +14 -8
- package/docs/en/plugins/guide/getting-started.mdx +1 -1
- package/docs/zh/api/plugin-api/plugin-hooks.md +2 -10
- package/docs/zh/guide/advance/in-depth-about-dev-command.md +52 -13
- package/docs/zh/guide/basic/before-getting-started.md +4 -14
- package/docs/zh/guide/basic/command-preview.md +2 -2
- package/docs/zh/guide/basic/modify-output-product.md +5 -3
- package/docs/zh/guide/basic/publish-your-project.md +4 -4
- package/docs/zh/guide/basic/test-your-project.mdx +18 -5
- package/docs/zh/guide/basic/use-micro-generator.md +61 -1
- package/docs/zh/guide/basic/using-storybook.mdx +39 -13
- package/docs/zh/guide/intro/getting-started.md +17 -11
- package/docs/zh/index.md +16 -10
- package/docs/zh/plugins/guide/getting-started.mdx +1 -1
- package/modern.config.ts +4 -6
- package/package.json +4 -4
- package/doc_build/api/config/build-config.html +0 -332
- package/doc_build/api/config/build-preset.html +0 -43
- package/doc_build/api/config/design-system.html +0 -103
- package/doc_build/api/config/plugins.html +0 -7
- package/doc_build/api/config/testing.html +0 -21
- package/doc_build/api/index.html +0 -1
- package/doc_build/api/plugin-api/plugin-hooks.html +0 -113
- package/doc_build/en/api/config/build-config.html +0 -316
- package/doc_build/en/api/config/build-preset.html +0 -43
- package/doc_build/en/api/config/design-system.html +0 -117
- package/doc_build/en/api/config/plugins.html +0 -7
- package/doc_build/en/api/config/testing.html +0 -21
- package/doc_build/en/api/index.html +0 -1
- package/doc_build/en/api/plugin-api/plugin-hooks.html +0 -113
- package/doc_build/en/guide/advance/asset.html +0 -25
- package/doc_build/en/guide/advance/build-umd.html +0 -32
- package/doc_build/en/guide/advance/copy.html +0 -42
- package/doc_build/en/guide/advance/external-dependency.html +0 -31
- package/doc_build/en/guide/advance/in-depth-about-build.html +0 -112
- package/doc_build/en/guide/advance/in-depth-about-dev-command.html +0 -12
- package/doc_build/en/guide/advance/theme-config.html +0 -29
- package/doc_build/en/guide/basic/before-getting-started.html +0 -89
- package/doc_build/en/guide/basic/command-preview.html +0 -63
- package/doc_build/en/guide/basic/modify-output-product.html +0 -98
- package/doc_build/en/guide/basic/publish-your-project.html +0 -50
- package/doc_build/en/guide/basic/test-your-project.html +0 -31
- package/doc_build/en/guide/basic/use-micro-generator.html +0 -29
- package/doc_build/en/guide/basic/using-storybook.html +0 -66
- package/doc_build/en/guide/best-practices/components.html +0 -111
- package/doc_build/en/guide/intro/getting-started.html +0 -36
- package/doc_build/en/guide/intro/welcome.html +0 -13
- package/doc_build/en/guide/intro/why-module-engineering-solution.html +0 -9
- package/doc_build/en/index.html +0 -1
- package/doc_build/en/plugins/guide/getting-started.html +0 -15
- package/doc_build/en/plugins/guide/plugin-object.html +0 -14
- package/doc_build/en/plugins/guide/setup-function.html +0 -30
- package/doc_build/en/plugins/official-list/overview.html +0 -3
- package/doc_build/guide/advance/asset.html +0 -25
- package/doc_build/guide/advance/build-umd.html +0 -32
- package/doc_build/guide/advance/copy.html +0 -42
- package/doc_build/guide/advance/external-dependency.html +0 -31
- package/doc_build/guide/advance/in-depth-about-build.html +0 -112
- package/doc_build/guide/advance/in-depth-about-dev-command.html +0 -14
- package/doc_build/guide/advance/theme-config.html +0 -28
- package/doc_build/guide/basic/before-getting-started.html +0 -89
- package/doc_build/guide/basic/command-preview.html +0 -63
- package/doc_build/guide/basic/modify-output-product.html +0 -97
- package/doc_build/guide/basic/publish-your-project.html +0 -52
- package/doc_build/guide/basic/test-your-project.html +0 -32
- package/doc_build/guide/basic/use-micro-generator.html +0 -27
- package/doc_build/guide/basic/using-storybook.html +0 -67
- package/doc_build/guide/best-practices/components.html +0 -111
- package/doc_build/guide/intro/getting-started.html +0 -39
- package/doc_build/guide/intro/welcome.html +0 -13
- package/doc_build/guide/intro/why-module-engineering-solution.html +0 -9
- package/doc_build/index.html +0 -1
- package/doc_build/plugins/guide/getting-started.html +0 -15
- package/doc_build/plugins/guide/plugin-object.html +0 -14
- package/doc_build/plugins/guide/setup-function.html +0 -30
- package/doc_build/plugins/official-list/overview.html +0 -3
- package/doc_build/static/css/main.edaad072.css +0 -1
- package/doc_build/static/js/1607.70af642a.js +0 -2
- package/doc_build/static/js/1607.70af642a.js.LICENSE.txt +0 -23
- package/doc_build/static/js/async/3799.e31e8293.js +0 -1
- package/doc_build/static/js/async/8652.6fbf1cb7.js +0 -1
- package/doc_build/static/js/async/en_api_config_build-config.367a5701.js +0 -1
- package/doc_build/static/js/async/en_api_config_build-preset.0d78b268.js +0 -1
- package/doc_build/static/js/async/en_api_config_design-system.b28d6723.js +0 -1
- package/doc_build/static/js/async/en_api_config_plugins.fc95fb77.js +0 -1
- package/doc_build/static/js/async/en_api_config_testing.8bc7f316.js +0 -1
- package/doc_build/static/js/async/en_api_index.669f0a56.js +0 -1
- package/doc_build/static/js/async/en_api_plugin-api_plugin-hooks.60d0260c.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_asset.5ff1d623.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_build-umd.c254ed46.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_copy.45c0a51d.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_external-dependency.a52d3247.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-build.51bf3569.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_in-depth-about-dev-command.aec0b4e1.js +0 -1
- package/doc_build/static/js/async/en_guide_advance_theme-config.db0ad9fc.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_before-getting-started.a22fc49a.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_command-preview.1707ed29.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_modify-output-product.ad453d13.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_publish-your-project.08c5112f.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_test-your-project.f5f6b204.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_use-micro-generator.56325139.js +0 -1
- package/doc_build/static/js/async/en_guide_basic_using-storybook.9d721554.js +0 -1
- package/doc_build/static/js/async/en_guide_best-practices_components.45155af9.js +0 -1
- package/doc_build/static/js/async/en_guide_intro_getting-started.f8682be3.js +0 -1
- package/doc_build/static/js/async/en_guide_intro_welcome.9cc45924.js +0 -1
- package/doc_build/static/js/async/en_guide_intro_why-module-engineering-solution.7f2dae5c.js +0 -1
- package/doc_build/static/js/async/en_index.7bd869c4.js +0 -1
- package/doc_build/static/js/async/en_plugins_guide_getting-started.b850249c.js +0 -1
- package/doc_build/static/js/async/en_plugins_guide_plugin-object.bf6c6221.js +0 -1
- package/doc_build/static/js/async/en_plugins_guide_setup-function.80a2bd97.js +0 -1
- package/doc_build/static/js/async/en_plugins_official-list_overview.84e5cea0.js +0 -1
- package/doc_build/static/js/async/zh_api_config_build-config.048fd5ec.js +0 -1
- package/doc_build/static/js/async/zh_api_config_build-preset.7c13584d.js +0 -1
- package/doc_build/static/js/async/zh_api_config_design-system.1eecd474.js +0 -1
- package/doc_build/static/js/async/zh_api_config_plugins.c22dc4be.js +0 -1
- package/doc_build/static/js/async/zh_api_config_testing.a9888eed.js +0 -1
- package/doc_build/static/js/async/zh_api_index.22957707.js +0 -1
- package/doc_build/static/js/async/zh_api_plugin-api_plugin-hooks.a4d81bf6.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_asset.5b936003.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_build-umd.b6d541ff.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_copy.21a1aea4.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_external-dependency.c7cf5d4b.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_in-depth-about-build.64e795f3.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_in-depth-about-dev-command.168ce7dd.js +0 -1
- package/doc_build/static/js/async/zh_guide_advance_theme-config.b9570109.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_before-getting-started.6b06b54a.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_command-preview.1199124a.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_modify-output-product.8ccbc8d1.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_publish-your-project.bf11b1c4.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_test-your-project.ae52c47a.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_use-micro-generator.a091d57d.js +0 -1
- package/doc_build/static/js/async/zh_guide_basic_using-storybook.27829e44.js +0 -1
- package/doc_build/static/js/async/zh_guide_best-practices_components.7454d916.js +0 -1
- package/doc_build/static/js/async/zh_guide_intro_getting-started.a4c00d9a.js +0 -1
- package/doc_build/static/js/async/zh_guide_intro_welcome.71c3fe16.js +0 -1
- package/doc_build/static/js/async/zh_guide_intro_why-module-engineering-solution.6f8b5ff6.js +0 -1
- package/doc_build/static/js/async/zh_index.c19f9dcf.js +0 -1
- package/doc_build/static/js/async/zh_plugins_guide_getting-started.099dfaea.js +0 -1
- package/doc_build/static/js/async/zh_plugins_guide_plugin-object.963289d5.js +0 -1
- package/doc_build/static/js/async/zh_plugins_guide_setup-function.67d07b91.js +0 -1
- package/doc_build/static/js/async/zh_plugins_official-list_overview.a7635714.js +0 -1
- package/doc_build/static/js/lib-lodash.c5845536.js +0 -1
- package/doc_build/static/js/lib-polyfill.b3038509.js +0 -1
- package/doc_build/static/js/lib-react.d41ace5e.js +0 -2
- package/doc_build/static/js/lib-react.d41ace5e.js.LICENSE.txt +0 -29
- package/doc_build/static/js/main.2d3257a4.js +0 -1
- package/doc_build/static/search_index.json +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Modern.js
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
The code implementation modified from external library are:
|
|
25
|
+
|
|
26
|
+
- vite
|
|
27
|
+
|
|
28
|
+
MIT License
|
|
29
|
+
|
|
30
|
+
Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
|
|
31
|
+
|
|
32
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
33
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
34
|
+
in the Software without restriction, including without limitation the rights
|
|
35
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
36
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
37
|
+
furnished to do so, subject to the following conditions:
|
|
38
|
+
|
|
39
|
+
The above copyright notice and this permission notice shall be included in all
|
|
40
|
+
copies or substantial portions of the Software.
|
|
41
|
+
|
|
42
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
43
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
44
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
45
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
46
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
47
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
48
|
+
SOFTWARE.
|
|
49
|
+
|
|
50
|
+
- wmr
|
|
51
|
+
|
|
52
|
+
MIT License
|
|
53
|
+
|
|
54
|
+
Copyright (c) 2020 The Preact Authors
|
|
55
|
+
|
|
56
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
57
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
58
|
+
in the Software without restriction, including without limitation the rights
|
|
59
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
60
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
61
|
+
furnished to do so, subject to the following conditions:
|
|
62
|
+
|
|
63
|
+
The above copyright notice and this permission notice shall be included in all
|
|
64
|
+
copies or substantial portions of the Software.
|
|
65
|
+
|
|
66
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
67
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
68
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
69
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
70
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
71
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
72
|
+
SOFTWARE.
|
|
73
|
+
|
|
74
|
+
- bundle-require
|
|
75
|
+
|
|
76
|
+
The MIT License (MIT)
|
|
77
|
+
|
|
78
|
+
Copyright © 2021 EGOIST (https://github.com/sponsors/egoist)
|
|
79
|
+
|
|
80
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
81
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
82
|
+
in the Software without restriction, including without limitation the rights
|
|
83
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
84
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
85
|
+
furnished to do so, subject to the following conditions:
|
|
86
|
+
|
|
87
|
+
The above copyright notice and this permission notice shall be included in all
|
|
88
|
+
copies or substantial portions of the Software.
|
|
89
|
+
|
|
90
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
91
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
92
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
93
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
94
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
95
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
96
|
+
SOFTWARE
|
|
97
|
+
|
|
98
|
+
- react-dev-utils
|
|
99
|
+
|
|
100
|
+
MIT License
|
|
101
|
+
|
|
102
|
+
Copyright (c) 2013-present, Facebook, Inc.
|
|
103
|
+
|
|
104
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
105
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
106
|
+
in the Software without restriction, including without limitation the rights
|
|
107
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
108
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
109
|
+
furnished to do so, subject to the following conditions:
|
|
110
|
+
|
|
111
|
+
The above copyright notice and this permission notice shall be included in all
|
|
112
|
+
copies or substantial portions of the Software.
|
|
113
|
+
|
|
114
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
115
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
116
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
117
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
118
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
119
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
120
|
+
SOFTWARE.
|
|
121
|
+
|
|
122
|
+
- jest-cli
|
|
123
|
+
|
|
124
|
+
MIT License
|
|
125
|
+
|
|
126
|
+
Copyright (c) Facebook, Inc. and its affiliates.
|
|
127
|
+
|
|
128
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
129
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
130
|
+
in the Software without restriction, including without limitation the rights
|
|
131
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
132
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
133
|
+
furnished to do so, subject to the following conditions:
|
|
134
|
+
|
|
135
|
+
The above copyright notice and this permission notice shall be included in all
|
|
136
|
+
copies or substantial portions of the Software.
|
|
137
|
+
|
|
138
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
139
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
140
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
141
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
142
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
143
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
144
|
+
SOFTWARE.
|
|
@@ -328,8 +328,6 @@ export interface DevToolData {
|
|
|
328
328
|
name: string;
|
|
329
329
|
value: string;
|
|
330
330
|
};
|
|
331
|
-
// Whether to disable the source build before the dev command is executed
|
|
332
|
-
disableRunBuild?: boolean;
|
|
333
331
|
action: (
|
|
334
332
|
options: { port?: string },
|
|
335
333
|
context: { isTsProject?: boolean },
|
|
@@ -337,11 +335,11 @@ export interface DevToolData {
|
|
|
337
335
|
}
|
|
338
336
|
```
|
|
339
337
|
|
|
340
|
-
:::tip{title='About disableRunBuild configuration'}
|
|
338
|
+
<!-- :::tip{title='About disableRunBuild configuration'}
|
|
341
339
|
When dev a project, it may be possible to set `disableRunBuild: true` to disable build tasks for source execution (in listening mode) if you only need to dev code functionality.
|
|
342
340
|
|
|
343
341
|
The currently supported Storybook dev supports using source code products as dev objects, so `disableRunBuild: false` in the Storybook plugin.
|
|
344
|
-
:::
|
|
342
|
+
::: -->
|
|
345
343
|
|
|
346
344
|
### `beforeDev`
|
|
347
345
|
|
|
@@ -371,8 +369,6 @@ export interface DevToolData {
|
|
|
371
369
|
name: string;
|
|
372
370
|
value: string;
|
|
373
371
|
};
|
|
374
|
-
// Whether to disable the source build before the dev command is executed
|
|
375
|
-
disableRunBuild?: boolean;
|
|
376
372
|
action: (
|
|
377
373
|
options: { port?: string },
|
|
378
374
|
context: { isTsProject?: boolean },
|
|
@@ -434,8 +430,6 @@ export interface DevToolData {
|
|
|
434
430
|
name: string;
|
|
435
431
|
value: string;
|
|
436
432
|
};
|
|
437
|
-
// Whether to disable the source build before the dev command is executed
|
|
438
|
-
disableRunBuild?: boolean;
|
|
439
433
|
action: (
|
|
440
434
|
options: { port?: string },
|
|
441
435
|
context: { isTsProject?: boolean },
|
|
@@ -471,8 +465,6 @@ export interface DevToolData {
|
|
|
471
465
|
name: string;
|
|
472
466
|
value: string;
|
|
473
467
|
};
|
|
474
|
-
// Whether to disable the source build before the dev command is executed
|
|
475
|
-
disableRunBuild?: boolean;
|
|
476
468
|
action: (
|
|
477
469
|
options: { port?: string },
|
|
478
470
|
context: { isTsProject?: boolean },
|
|
@@ -2,25 +2,69 @@
|
|
|
2
2
|
sidebar_position: 2
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
#
|
|
5
|
+
# In-depth understanding of the dev command
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The `dev` command provided by the module project is mainly used for debugging the code.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
如果你还不清楚 `buildConfig` 是什么,建议花一些时间通过下面的链接了解一下:
|
|
9
|
+
## The overall flow of the command run
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
1. When the `dev` command is executed, Module Tools starts looking for debugging tools or tasks that can be executed. A debugging tool or task is a Module Tools debugging tool plugin like Storybook.
|
|
12
|
+
2. When a debugging tool is found, it is executed immediately.
|
|
13
|
+
3. When multiple debugging tools are found, the debugging tools list menu is displayed. A debug tool can be started by selecting the name option corresponding to it.
|
|
14
|
+
4. When no debug tool is found, the user is informed that no debug tool is available.
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
In addition to the `dev` command, you can also start a debugging tool or task directly by using the `dev [debug tool name]` option.
|
|
15
17
|
|
|
16
|
-
而在本章里我们将要深入理解某些构建配置的使用以及了解执行 `modern build` 命令的时候发生了什么。
|
|
17
18
|
|
|
18
|
-
##
|
|
19
|
+
## Extending the dev command
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
If you need to extend the dev command, or rather provide your own Module Tools debugging tool plug-in, then you will need to know the following first.
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
* [Development of plugins](plugins/guide/getting-started)
|
|
24
|
+
* [Debugging Tools Plugin API](/api/plugin-api/plugin-hooks#调试钩子)
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
In general, the code to implement a debugging tool that does nothing and the associated configuration is as follows.
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
``` ts do-nothing.ts
|
|
29
|
+
export default (): CliPlugin<ModuleTools> => ({
|
|
30
|
+
name: 'do-nothing',
|
|
31
|
+
setup() {
|
|
32
|
+
return {
|
|
33
|
+
registerDev() {
|
|
34
|
+
return {
|
|
35
|
+
// Debugging tool name
|
|
36
|
+
name: 'do-nothing',
|
|
37
|
+
// Menu display content
|
|
38
|
+
menuItem: {
|
|
39
|
+
name: 'DoNothing',
|
|
40
|
+
value: 'do-nothing',
|
|
41
|
+
},
|
|
42
|
+
// The defined dev subcommand
|
|
43
|
+
subCommands: ['donothing', 'dn'],
|
|
44
|
+
async action() {
|
|
45
|
+
// dev logic
|
|
46
|
+
console.info('Run build --watch, and do nothing.');
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If this debugging tool plugin is required, it needs to be added to the configuration file.
|
|
56
|
+
|
|
57
|
+
``` ts
|
|
58
|
+
import doNothingPlugin from './plugins/do-nothing';
|
|
59
|
+
|
|
60
|
+
export default defineConfig({
|
|
61
|
+
plugins: [
|
|
62
|
+
//..
|
|
63
|
+
doNothingPlugin()
|
|
64
|
+
],
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
At this point we can execute it when we execute the `dev` or `dev do-nothing` command. After execution, it will first execute the source build task in listening mode and print the log messages immediately afterwards.
|
|
69
|
+
|
|
70
|
+
For currently officially supported debugging tools and third-party supported debugging tools, you can view them in [plugins list](plugins/official-list/overview).
|
|
@@ -176,8 +176,10 @@ export default defineConfig({
|
|
|
176
176
|
});
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
**We recommend using the `defineConfig` function**, but it is not mandatory to use it. So you can also return an object directly in the config file: the
|
|
180
|
+
|
|
181
|
+
``` ts
|
|
182
|
+
// modern.config.ts
|
|
181
183
|
import moduleTools from '@modern-js/module-tools';
|
|
182
184
|
|
|
183
185
|
export default {
|
|
@@ -185,15 +187,3 @@ export default {
|
|
|
185
187
|
buildPreset: 'npm-library',
|
|
186
188
|
};
|
|
187
189
|
```
|
|
188
|
-
|
|
189
|
-
**We recommend using the `defineConfig` function**, but it is not mandatory to use it. So you can also return an object directly in the config file: the
|
|
190
|
-
|
|
191
|
-
```typescript
|
|
192
|
-
// modern.config.ts
|
|
193
|
-
export default {};
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
```js
|
|
197
|
-
// modern.config.js
|
|
198
|
-
export default {};
|
|
199
|
-
```
|
|
@@ -33,7 +33,7 @@ When you want to start a project build, you can execute the `modern build` comma
|
|
|
33
33
|
In addition to the above, module projects also support `platform` build mode, which can be used to perform build tasks for other tools. For example, it is currently officially supported to start a Storybook build task to generate Storybook products by executing the `modern build --platform` or `modern build --platform storybook` commands after installing the `@modern-js/plugin-storybook` plugin.
|
|
34
34
|
|
|
35
35
|
:::tip{title=Note}
|
|
36
|
-
When executing a Storybook build,
|
|
36
|
+
When executing a Storybook build, if you need to read the build product of the project. Then **don't forget to execute the `modern build` command to ensure the existence of the project's build product before executing the `modern build --platform` command to start the Storybook build**.
|
|
37
37
|
:::
|
|
38
38
|
|
|
39
39
|
## `modern new`
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
sidebar_position: 3
|
|
3
3
|
---
|
|
4
|
+
# modify-output-product
|
|
4
5
|
|
|
5
6
|
## Modify the output product
|
|
6
7
|
|
|
@@ -58,9 +59,10 @@ For example, if the output product is based on the preset string `"npm-library"`
|
|
|
58
59
|
For example, to achieve the same effect as the preset string ``npm-library-es5"` using the form of a preset function, you can do the following.
|
|
59
60
|
|
|
60
61
|
```typescript
|
|
61
|
-
import { defineConfig } from '@modern-js/module-tools';
|
|
62
|
+
import moduleTools, { defineConfig } from '@modern-js/module-tools';
|
|
62
63
|
|
|
63
64
|
export default defineConfig({
|
|
65
|
+
plugins: [moduleTools()],
|
|
64
66
|
buildPreset({ preset }) {
|
|
65
67
|
return preset.NPM_LIBRARY.map(config => {
|
|
66
68
|
return { ... .config, target: 'es5' }
|
|
@@ -69,9 +71,11 @@ export default defineConfig({
|
|
|
69
71
|
});
|
|
70
72
|
```
|
|
71
73
|
|
|
72
|
-
In the above code implementation, `preset.NPM_LIBRARY` corresponds to the preset string `"npm-library"`, which represents the `"npm-library"`
|
|
74
|
+
In the above code implementation, `preset.NPM_LIBRARY` corresponds to the preset string `"npm-library"`, which represents the equivalent of `"npm-library"` for multiple sets of build-related configurations. We traverse the `NPM_LIBRARY` array, which contains multiple `buildConfig` objects, using the `map` method. We made a shallow copy of the original `buildConfig` object and modified the value of the `target` after the shallow copy, specifying it as `es5`.
|
|
75
|
+
|
|
73
76
|
|
|
74
77
|
> NPM_LIBRARY`, you can check it with [BuildPreset API](/api/config/build-preset). The`preset`object contains not only`NPM_LIBRARY`, but also other similar constants.
|
|
78
|
+
> We can not only use `preset.NPM_LIBRARY` to get the build configuration corresponding to `"npm-library"`, but also `preset['npm-library']` in this way.
|
|
75
79
|
|
|
76
80
|
So what is the `buildConfig` object here? What is the basis for the build product feature mentioned before?
|
|
77
81
|
|
|
@@ -16,12 +16,43 @@ The microgenerator can be started via [`modern new`](/guide/basic/command-previe
|
|
|
16
16
|
|
|
17
17
|
## Test
|
|
18
18
|
|
|
19
|
-
When we want to test some modules, we can enable the test
|
|
19
|
+
When we want to test some modules, we can enable the test feature. When this feature is enabled, **a `tests` directory and related files will be created in the project directory, and a new `"@modern-js/plugin-testing"` dependency will be added to package.json**.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
:::tip
|
|
23
|
+
After successfully enabling it, you will be prompted to manually add a code similar to the one below to the configuration.
|
|
24
|
+
``` ts
|
|
25
|
+
import moduleTools, { defineConfig } from '@modern-js/module-tools';
|
|
26
|
+
import testPlugin from '@modern-js/plugin-testing';
|
|
27
|
+
|
|
28
|
+
export default defineConfig({
|
|
29
|
+
plugins: [
|
|
30
|
+
moduleTools(),
|
|
31
|
+
testPlugin(),
|
|
32
|
+
],
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
:::
|
|
20
36
|
|
|
21
37
|
## Storybook
|
|
22
38
|
|
|
23
39
|
The **Storybook feature** can be enabled when we want to debug a component or a common module. When this feature is enabled, **the `stories` directory and related files are created in the project directory, and a new `"@modern-js/plugin-storybook"` dependency is added to package.json**.
|
|
24
40
|
|
|
41
|
+
:::tip
|
|
42
|
+
After successfully enabling it, you will be prompted to manually add a code similar to the one below to the configuration.
|
|
43
|
+
``` ts
|
|
44
|
+
import moduleTools, { defineConfig } from '@modern-js/module-tools';
|
|
45
|
+
import storybookPlugin from '@modern-js/plugin-storybook';
|
|
46
|
+
|
|
47
|
+
export default defineConfig({
|
|
48
|
+
plugins: [
|
|
49
|
+
moduleTools(),
|
|
50
|
+
storybookPlugin(),
|
|
51
|
+
],
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
:::
|
|
55
|
+
|
|
25
56
|
For more information on how to start Storybook and how to use it, check out the following link.
|
|
26
57
|
|
|
27
58
|
- [`modern dev`](/en/guide/basic/command-preview#modern-dev)
|
|
@@ -37,6 +68,21 @@ For more information on how to use Tailwind CSS in your module projects, check o
|
|
|
37
68
|
|
|
38
69
|
- Using Tailwind CSS
|
|
39
70
|
|
|
71
|
+
:::tip
|
|
72
|
+
After successfully enabling it, you will be prompted to manually add a code similar to the one below to the configuration.
|
|
73
|
+
``` ts
|
|
74
|
+
import moduleTools, { defineConfig } from '@modern-js/module-tools';
|
|
75
|
+
import tailwindPlugin from '@modern-js/plugin-tailwindcss';
|
|
76
|
+
|
|
77
|
+
export default defineConfig({
|
|
78
|
+
plugins: [
|
|
79
|
+
moduleTools(),
|
|
80
|
+
tailwindPlugin(),
|
|
81
|
+
],
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
:::
|
|
85
|
+
|
|
40
86
|
## Modern.js Runtime API
|
|
41
87
|
|
|
42
88
|
<!-- 链接待补充 -->
|
|
@@ -44,3 +90,18 @@ For more information on how to use Tailwind CSS in your module projects, check o
|
|
|
44
90
|
**Modern.js provides Runtime API capabilities that can only be used in the Modern.js application project environment**. If you need to develop a component for use in a Modern.js application environment, then you can turn on this feature and the microgenerator will add the `"@modern-js/runtime"` dependency.
|
|
45
91
|
|
|
46
92
|
Also, the Storybook debugging tool will determine if the project needs to use the Runtime API by checking the project's dependencies and providing the same Runtime API runtime environment as the Modern.js application project.
|
|
93
|
+
|
|
94
|
+
:::tip
|
|
95
|
+
After successfully enabling it, you will be prompted to manually add a code similar to the one below to the configuration.
|
|
96
|
+
``` ts
|
|
97
|
+
import moduleTools, { defineConfig } from '@modern-js/module-tools';
|
|
98
|
+
import runtime from '@modern-js/runtime/cli';
|
|
99
|
+
|
|
100
|
+
export default defineConfig({
|
|
101
|
+
plugins: [
|
|
102
|
+
moduleTools(),
|
|
103
|
+
runtime(),
|
|
104
|
+
],
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
:::
|
|
@@ -23,12 +23,12 @@ The modular engineering solution is integrated with Storybook, so you can pretty
|
|
|
23
23
|
|
|
24
24
|
## Debugging code
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
The project code needs to be introduced during the debugging process and can currently be introduced in two ways:
|
|
27
27
|
|
|
28
|
-
-
|
|
29
|
-
-
|
|
28
|
+
- Use of project products
|
|
29
|
+
- Using the project source code
|
|
30
30
|
|
|
31
|
-
We recommend the first
|
|
31
|
+
We recommend using the first "**referenced project product**" approach. Because it is closer to the real usage scenario, not only can we debug the component functionality, but also verify the correctness of the build product. However, we can also refer to the source code when testing the project functionality and refer to the project package name when verifying the project product.
|
|
32
32
|
|
|
33
33
|
Next, we will talk about how to use each of these two methods.
|
|
34
34
|
|
|
@@ -88,7 +88,7 @@ The `key` of `paths` is the same as the project name.
|
|
|
88
88
|
|
|
89
89
|
---
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
Referenced directly in Story code by the project name.
|
|
92
92
|
|
|
93
93
|
```tsx stories/index.stories.tsx focus=1:1
|
|
94
94
|
import { content } from 'foo';
|
|
@@ -102,6 +102,26 @@ export default {
|
|
|
102
102
|
};
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
Finally, when executing the command, first start the source build in listening mode and then start Storybook debugging.
|
|
108
|
+
|
|
109
|
+
<CH.Code>
|
|
110
|
+
|
|
111
|
+
``` bash terminal-1
|
|
112
|
+
## Source Code Build
|
|
113
|
+
modern build --watch
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
``` bash terminal-2
|
|
119
|
+
## Storybook Debug
|
|
120
|
+
modern dev storybook
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
</CH.Code>
|
|
124
|
+
|
|
105
125
|
</CH.Spotlight>
|
|
106
126
|
|
|
107
127
|
If, during development, you encounter a situation where the type definition is not available in real time, at that point.
|
|
@@ -125,8 +145,8 @@ For npm and Yarn projects, the values of `types` of `package.json` can only be c
|
|
|
125
145
|
|
|
126
146
|
So why is it possible to reference the product directly?
|
|
127
147
|
|
|
128
|
-
1.
|
|
129
|
-
2.
|
|
148
|
+
1. execute `modern build --watch` command before executing `modern dev storybook` command to ensure the existence of project build products.
|
|
149
|
+
2. Add processing logic inside Storybook to ensure that the project's product paths can be parsed **according to `package.json`, based on the `compilerOptions.paths` configuration in the `tsconfig.json` file or (in JS projects) directly with the project name as an alias**.
|
|
130
150
|
|
|
131
151
|
### Referencing component source code
|
|
132
152
|
|
|
@@ -144,10 +164,12 @@ export default {
|
|
|
144
164
|
};
|
|
145
165
|
```
|
|
146
166
|
|
|
147
|
-
|
|
148
|
-
|
|
167
|
+
:::tip{title='why is the source code approach not recommended'}
|
|
149
168
|
Not only is it impossible to verify that the component product is correct using the component source code, **but also some of the configurations supported by the module project for building the product cannot be fully translated into Storybook internal configuration**. If some of the configurations cannot be converted to each other, there will be unintended results during Storybook debugging.
|
|
150
169
|
|
|
170
|
+
Module Tools is based on Esbuild, while Storybook is based on Webpack, and Esbuild's configuration is not fully compatible with Webpack.
|
|
171
|
+
:::
|
|
172
|
+
|
|
151
173
|
## Configure Storybook
|
|
152
174
|
|
|
153
175
|
Storybook is officially configured for projects through a folder called `.storybook`, which contains various configuration files. **In a module project scenario, Storybook configuration files can be added to the `config/storybook` directory of the project.**
|
|
@@ -2,26 +2,36 @@
|
|
|
2
2
|
sidebar_position: 3
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
# Quick
|
|
5
|
+
# Quick Start
|
|
6
6
|
|
|
7
7
|
## 3 minute demo
|
|
8
8
|
|
|
9
|
-
Want to experience Module Tools in action? The only prerequisite you need is [Node.js LTS](https://github.com/nodejs/Release) and make sure your Node version is **>= 14.
|
|
9
|
+
Want to experience Module Tools in action? The only prerequisite you need is [Node.js LTS](https://github.com/nodejs/Release) and make sure your Node version is **>= 14.18.0**.We recommend using the LTS version of Node.js 16.
|
|
10
10
|
|
|
11
11
|
From your shell, install the following dependencies in your project.
|
|
12
12
|
|
|
13
13
|
- `@modern-js/module-tools`
|
|
14
|
-
-
|
|
14
|
+
- `"typescript"` (omitted if not a TypeScript project)
|
|
15
15
|
|
|
16
16
|
> If it's a TypeScript project, add the `"typescript"` dependency.
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
npm install -D @modern-js/module-tools
|
|
19
|
+
npm install -D @modern-js/module-tools typescript
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
> For projects that use pnpm or the Yarn package manager, just replace npm. **pnpm is recommended**.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Next, create the `modern.config.(t|j)s` file in the root of the project.
|
|
25
|
+
|
|
26
|
+
``` ts
|
|
27
|
+
import moduleTools, { defineConfig } from '@modern-js/module-tools';
|
|
28
|
+
|
|
29
|
+
export default defineConfig({
|
|
30
|
+
plugins: [moduleTools()],
|
|
31
|
+
})
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Finally, add the command `"build": "modern build"` to the project's `package.json` file.
|
|
25
35
|
|
|
26
36
|
```json
|
|
27
37
|
{
|
|
@@ -33,11 +43,11 @@ Then add the command `"build": "modern build"` to your project's `package.json`
|
|
|
33
43
|
|
|
34
44
|
If your project has a `src/index.(js|jsx)` file or both `src/index.(ts|tsx)` and `tsconfig.json` files, then congratulations you can run the `npm run build` command directly to build your project with Module Tools.
|
|
35
45
|
|
|
36
|
-
**If you want to see
|
|
46
|
+
**If you want to see the complete project using the modular engineering scheme, you can execute the following command**.
|
|
37
47
|
|
|
38
48
|
```bash
|
|
39
49
|
git clone https://github.com/modern-js-dev/module-tools-examples
|
|
40
|
-
cd module-tools-example
|
|
50
|
+
cd module-tools-example/base
|
|
41
51
|
|
|
42
52
|
## Execute the build.
|
|
43
53
|
pnpm build
|
|
@@ -50,7 +60,6 @@ pnpm dev storybook
|
|
|
50
60
|
|
|
51
61
|
## Test
|
|
52
62
|
pnpm test
|
|
53
|
-
pnpm test
|
|
54
63
|
```
|
|
55
64
|
|
|
56
65
|
**If you want to create a complete module project, you can execute the following command:**
|
package/docs/en/index.md
CHANGED
|
@@ -7,24 +7,30 @@ hero:
|
|
|
7
7
|
tagline: simple, powerful, high-performance modern npm package development solution
|
|
8
8
|
actions:
|
|
9
9
|
- theme: brand
|
|
10
|
-
text:
|
|
11
|
-
link: /guide/intro/welcome
|
|
10
|
+
text: Welcome
|
|
11
|
+
link: /en/guide/intro/welcome
|
|
12
|
+
- theme: alt
|
|
13
|
+
text: Quick Start
|
|
14
|
+
link: /en/guide/intro/getting-started
|
|
12
15
|
|
|
13
16
|
features:
|
|
14
17
|
- title: 'Esbuild: The High Performance JS Bundler'
|
|
15
18
|
details: Built on Esbuild, the build is extremely fast and gives you the ultimate development experience.
|
|
16
19
|
icon: 🚀
|
|
17
|
-
- title: '
|
|
18
|
-
details: Integrated with Storybook, you can use it to debug UI.
|
|
19
|
-
icon: 📦
|
|
20
|
-
- title: 'transform + bundle'
|
|
20
|
+
- title: 'Two build modes'
|
|
21
21
|
details: Both bundle and bundleless build modes are supported.
|
|
22
22
|
icon: ✨
|
|
23
|
-
- title: '
|
|
24
|
-
details: Develop your npm packages without
|
|
23
|
+
- title: 'Out of the box'
|
|
24
|
+
details: Develop your npm packages without too much configuration, with built-in presets covering a wide range of scenarios.
|
|
25
25
|
icon: 🛠️
|
|
26
26
|
- title: 'Extensible: Provides a powerful plugin mechanism'
|
|
27
27
|
details: With its plugin extension mechanism, you can easily extend the capabilities of Module Tools.
|
|
28
28
|
icon: 🎨
|
|
29
|
+
- title: 'Storybook: The community popular UI development tool'
|
|
30
|
+
details: Integrated with Storybook, you can use it to debug UI.
|
|
31
|
+
icon: 📦
|
|
32
|
+
- title: 'Jest: Delightful Testing Framework'
|
|
33
|
+
details: Jest integration makes it easier to test code。
|
|
34
|
+
icon: 📐
|
|
29
35
|
---
|
|
30
36
|
# index
|