@modern-js/plugin-docsite 0.0.0-bundle-deps-202110123508
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/CHANGELOG.md +342 -0
- package/LICENSE +21 -0
- package/README.md +30 -0
- package/dist/js/modern/build-task.js +29 -0
- package/dist/js/modern/features/build.js +17 -0
- package/dist/js/modern/features/constant.js +7 -0
- package/dist/js/modern/features/dev.js +24 -0
- package/dist/js/modern/features/index.js +47 -0
- package/dist/js/modern/features/utils/chokidar.js +37 -0
- package/dist/js/modern/features/utils/generate-files.js +197 -0
- package/dist/js/modern/features/utils/valid.js +17 -0
- package/dist/js/modern/features/utils/webpack.js +63 -0
- package/dist/js/modern/index.js +49 -0
- package/dist/js/node/build-task.js +33 -0
- package/dist/js/node/features/build.js +31 -0
- package/dist/js/node/features/constant.js +21 -0
- package/dist/js/node/features/dev.js +39 -0
- package/dist/js/node/features/index.js +68 -0
- package/dist/js/node/features/utils/chokidar.js +55 -0
- package/dist/js/node/features/utils/generate-files.js +223 -0
- package/dist/js/node/features/utils/valid.js +36 -0
- package/dist/js/node/features/utils/webpack.js +80 -0
- package/dist/js/node/index.js +61 -0
- package/dist/js/static/DocsNav.jsx.tpl +42 -0
- package/dist/js/static/DocsRoutes.jsx.tpl +19 -0
- package/dist/js/static/DocsToc.jsx.tpl +20 -0
- package/dist/js/static/docs-entry.jsx.tpl +41 -0
- package/dist/js/static/docs-page.jsx.tpl +107 -0
- package/dist/js/static/docs.css +1008 -0
- package/dist/js/static/index.html.ejs +15 -0
- package/dist/js/static/stories-entry.ts.tpl +6 -0
- package/dist/js/static/storybook-config.js.tpl +32 -0
- package/dist/js/static/tsconfig.json +25 -0
- package/dist/types/build-task.d.ts +1 -0
- package/dist/types/features/build.d.ts +5 -0
- package/dist/types/features/constant.d.ts +3 -0
- package/dist/types/features/dev.d.ts +2 -0
- package/dist/types/features/index.d.ts +13 -0
- package/dist/types/features/utils/chokidar.d.ts +1 -0
- package/dist/types/features/utils/generate-files.d.ts +4 -0
- package/dist/types/features/utils/valid.d.ts +9 -0
- package/dist/types/features/utils/webpack.d.ts +3 -0
- package/dist/types/index.d.ts +15 -0
- package/modern.config.js +2 -0
- package/package.json +98 -0
- package/src/build-task.ts +31 -0
- package/src/features/build.ts +31 -0
- package/src/features/constant.ts +8 -0
- package/src/features/dev.ts +37 -0
- package/src/features/index.ts +68 -0
- package/src/features/utils/chokidar.ts +44 -0
- package/src/features/utils/generate-files.ts +238 -0
- package/src/features/utils/valid.ts +23 -0
- package/src/features/utils/webpack.ts +107 -0
- package/src/index.ts +42 -0
- package/src/type.d.ts +4 -0
- package/static/DocsNav.jsx.tpl +42 -0
- package/static/DocsRoutes.jsx.tpl +19 -0
- package/static/DocsToc.jsx.tpl +20 -0
- package/static/docs-entry.jsx.tpl +41 -0
- package/static/docs-page.jsx.tpl +107 -0
- package/static/docs.css +1008 -0
- package/static/index.html.ejs +15 -0
- package/static/stories-entry.ts.tpl +6 -0
- package/static/storybook-config.js.tpl +32 -0
- package/static/tsconfig.json +25 -0
- package/tsconfig.json +13 -0
package/CHANGELOG.md
ADDED
@@ -0,0 +1,342 @@
|
|
1
|
+
# @modern-js/plugin-docsite
|
2
|
+
|
3
|
+
## 0.0.0-bundle-deps-202110123508
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- test node_modules size
|
8
|
+
- Updated dependencies [undefined]
|
9
|
+
- @modern-js/core@0.0.0-bundle-deps-202110123508
|
10
|
+
- @modern-js/webpack@0.0.0-bundle-deps-202110123508
|
11
|
+
- @modern-js/deps@0.0.0-bundle-deps-202110123508
|
12
|
+
- @modern-js/utils@0.0.0-bundle-deps-202110123508
|
13
|
+
|
14
|
+
## 1.1.0
|
15
|
+
|
16
|
+
### Minor Changes
|
17
|
+
|
18
|
+
- 96119db2: Relese v1.1.0### Patch Changes
|
19
|
+
|
20
|
+
- 6b802b2a: use path method from @modern-js/utils
|
21
|
+
- Updated dependencies [96119db2]
|
22
|
+
- @modern-js/core@1.1.0
|
23
|
+
- @modern-js/webpack@1.1.0
|
24
|
+
- @modern-js/utils@1.1.0
|
25
|
+
|
26
|
+
## 1.0.0
|
27
|
+
|
28
|
+
### Patch Changes
|
29
|
+
|
30
|
+
- 224f7fe: fix server route match
|
31
|
+
- 30ac27c: feat: add generator package description
|
32
|
+
- 0fd196e: feat: fix bugs
|
33
|
+
- 204c626: feat: initial
|
34
|
+
- 63be0a5: fix: #118 #104
|
35
|
+
- Updated dependencies [224f7fe]
|
36
|
+
- Updated dependencies [30ac27c]
|
37
|
+
- Updated dependencies [0fd196e]
|
38
|
+
- Updated dependencies [204c626]
|
39
|
+
- Updated dependencies [63be0a5]
|
40
|
+
- @modern-js/core@1.0.0
|
41
|
+
- @modern-js/webpack@1.0.0
|
42
|
+
- @modern-js/utils@1.0.0
|
43
|
+
|
44
|
+
## 1.0.0-rc.23
|
45
|
+
|
46
|
+
### Patch Changes
|
47
|
+
|
48
|
+
- 224f7fe: fix server route match
|
49
|
+
- 30ac27c: feat: add generator package description
|
50
|
+
- 0fd196e: feat: fix bugs
|
51
|
+
- 204c626: feat: initial
|
52
|
+
- 63be0a5: fix: #118 #104
|
53
|
+
- Updated dependencies [224f7fe]
|
54
|
+
- Updated dependencies [30ac27c]
|
55
|
+
- Updated dependencies [0fd196e]
|
56
|
+
- Updated dependencies [204c626]
|
57
|
+
- Updated dependencies [63be0a5]
|
58
|
+
- @modern-js/core@1.0.0-rc.23
|
59
|
+
- @modern-js/webpack@1.0.0-rc.23
|
60
|
+
- @modern-js/utils@1.0.0-rc.23
|
61
|
+
|
62
|
+
## 1.0.0-rc.22
|
63
|
+
|
64
|
+
### Patch Changes
|
65
|
+
|
66
|
+
- 224f7fe: fix server route match
|
67
|
+
- 30ac27c: feat: add generator package description
|
68
|
+
- 0fd196e: feat: fix bugs
|
69
|
+
- 204c626: feat: initial
|
70
|
+
- 63be0a5: fix: #118 #104
|
71
|
+
- Updated dependencies [224f7fe]
|
72
|
+
- Updated dependencies [30ac27c]
|
73
|
+
- Updated dependencies [0fd196e]
|
74
|
+
- Updated dependencies [204c626]
|
75
|
+
- Updated dependencies [63be0a5]
|
76
|
+
- @modern-js/core@1.0.0-rc.22
|
77
|
+
- @modern-js/webpack@1.0.0-rc.22
|
78
|
+
- @modern-js/utils@1.0.0-rc.22
|
79
|
+
|
80
|
+
## 1.0.0-rc.21
|
81
|
+
|
82
|
+
### Patch Changes
|
83
|
+
|
84
|
+
- 224f7fe: fix server route match
|
85
|
+
- 30ac27c: feat: add generator package description
|
86
|
+
- 0fd196e: feat: fix bugs
|
87
|
+
- 204c626: feat: initial
|
88
|
+
- 63be0a5: fix: #118 #104
|
89
|
+
- Updated dependencies [224f7fe]
|
90
|
+
- Updated dependencies [30ac27c]
|
91
|
+
- Updated dependencies [0fd196e]
|
92
|
+
- Updated dependencies [204c626]
|
93
|
+
- Updated dependencies [63be0a5]
|
94
|
+
- @modern-js/core@1.0.0-rc.21
|
95
|
+
- @modern-js/webpack@1.0.0-rc.21
|
96
|
+
- @modern-js/utils@1.0.0-rc.21
|
97
|
+
|
98
|
+
## 1.0.0-rc.20
|
99
|
+
|
100
|
+
### Patch Changes
|
101
|
+
|
102
|
+
- 224f7fe: fix server route match
|
103
|
+
- 30ac27c: feat: add generator package description
|
104
|
+
- feat: fix bugs
|
105
|
+
- 204c626: feat: initial
|
106
|
+
- 63be0a5: fix: #118 #104
|
107
|
+
- Updated dependencies [224f7fe]
|
108
|
+
- Updated dependencies [30ac27c]
|
109
|
+
- Updated dependencies [undefined]
|
110
|
+
- Updated dependencies [204c626]
|
111
|
+
- Updated dependencies [63be0a5]
|
112
|
+
- @modern-js/core@1.0.0-rc.20
|
113
|
+
- @modern-js/webpack@1.0.0-rc.20
|
114
|
+
- @modern-js/utils@1.0.0-rc.20
|
115
|
+
|
116
|
+
## 1.0.0-rc.19
|
117
|
+
|
118
|
+
### Patch Changes
|
119
|
+
|
120
|
+
- 224f7fe: fix server route match
|
121
|
+
- 30ac27c: feat: add generator package description
|
122
|
+
- 204c626: feat: initial
|
123
|
+
- 63be0a5: fix: #118 #104
|
124
|
+
- Updated dependencies [224f7fe]
|
125
|
+
- Updated dependencies [30ac27c]
|
126
|
+
- Updated dependencies [204c626]
|
127
|
+
- Updated dependencies [63be0a5]
|
128
|
+
- @modern-js/core@1.0.0-rc.19
|
129
|
+
- @modern-js/webpack@1.0.0-rc.19
|
130
|
+
- @modern-js/utils@1.0.0-rc.19
|
131
|
+
|
132
|
+
## 1.0.0-rc.18
|
133
|
+
|
134
|
+
### Patch Changes
|
135
|
+
|
136
|
+
- 224f7fe: fix server route match
|
137
|
+
- 30ac27c: feat: add generator package description
|
138
|
+
- 204c626: feat: initial
|
139
|
+
- 63be0a5: fix: #118 #104
|
140
|
+
- Updated dependencies [224f7fe]
|
141
|
+
- Updated dependencies [30ac27c]
|
142
|
+
- Updated dependencies [204c626]
|
143
|
+
- Updated dependencies [63be0a5]
|
144
|
+
- @modern-js/core@1.0.0-rc.18
|
145
|
+
- @modern-js/webpack@1.0.0-rc.18
|
146
|
+
- @modern-js/utils@1.0.0-rc.18
|
147
|
+
|
148
|
+
## 1.0.0-rc.17
|
149
|
+
|
150
|
+
### Patch Changes
|
151
|
+
|
152
|
+
- 224f7fe: fix server route match
|
153
|
+
- 30ac27c: feat: add generator package description
|
154
|
+
- 204c626: feat: initial
|
155
|
+
- fix: #118 #104
|
156
|
+
- Updated dependencies [224f7fe]
|
157
|
+
- Updated dependencies [30ac27c]
|
158
|
+
- Updated dependencies [204c626]
|
159
|
+
- Updated dependencies [undefined]
|
160
|
+
- @modern-js/core@1.0.0-rc.17
|
161
|
+
- @modern-js/webpack@1.0.0-rc.17
|
162
|
+
- @modern-js/utils@1.0.0-rc.17
|
163
|
+
|
164
|
+
## 1.0.0-rc.16
|
165
|
+
|
166
|
+
### Patch Changes
|
167
|
+
|
168
|
+
- 224f7fe: fix server route match
|
169
|
+
- 30ac27c: feat: add generator package description
|
170
|
+
- 204c626: feat: initial
|
171
|
+
- Updated dependencies [224f7fe]
|
172
|
+
- Updated dependencies [30ac27c]
|
173
|
+
- Updated dependencies [204c626]
|
174
|
+
- @modern-js/core@1.0.0-rc.16
|
175
|
+
- @modern-js/webpack@1.0.0-rc.16
|
176
|
+
- @modern-js/utils@1.0.0-rc.16
|
177
|
+
|
178
|
+
## 1.0.0-rc.15
|
179
|
+
|
180
|
+
### Patch Changes
|
181
|
+
|
182
|
+
- 224f7fe: fix server route match
|
183
|
+
- 30ac27c: feat: add generator package description
|
184
|
+
- 204c626: feat: initial
|
185
|
+
- Updated dependencies [224f7fe]
|
186
|
+
- Updated dependencies [30ac27c]
|
187
|
+
- Updated dependencies [204c626]
|
188
|
+
- @modern-js/core@1.0.0-rc.15
|
189
|
+
- @modern-js/webpack@1.0.0-rc.15
|
190
|
+
- @modern-js/utils@1.0.0-rc.15
|
191
|
+
|
192
|
+
## 1.0.0-rc.14
|
193
|
+
|
194
|
+
### Patch Changes
|
195
|
+
|
196
|
+
- 224f7fe: fix server route match
|
197
|
+
- 204c626: feat: initial
|
198
|
+
- Updated dependencies [224f7fe]
|
199
|
+
- Updated dependencies [204c626]
|
200
|
+
- @modern-js/core@1.0.0-rc.14
|
201
|
+
- @modern-js/webpack@1.0.0-rc.14
|
202
|
+
- @modern-js/utils@1.0.0-rc.14
|
203
|
+
|
204
|
+
## 1.0.0-rc.13
|
205
|
+
|
206
|
+
### Patch Changes
|
207
|
+
|
208
|
+
- 224f7fe: fix server route match
|
209
|
+
- 204c626: feat: initial
|
210
|
+
- Updated dependencies [224f7fe]
|
211
|
+
- Updated dependencies [204c626]
|
212
|
+
- @modern-js/core@1.0.0-rc.13
|
213
|
+
- @modern-js/webpack@1.0.0-rc.13
|
214
|
+
- @modern-js/utils@1.0.0-rc.13
|
215
|
+
|
216
|
+
## 1.0.0-rc.12
|
217
|
+
|
218
|
+
### Patch Changes
|
219
|
+
|
220
|
+
- 224f7fe: fix server route match
|
221
|
+
- 204c626: feat: initial
|
222
|
+
- Updated dependencies [224f7fe]
|
223
|
+
- Updated dependencies [204c626]
|
224
|
+
- @modern-js/core@1.0.0-rc.12
|
225
|
+
- @modern-js/webpack@1.0.0-rc.12
|
226
|
+
- @modern-js/plugin@1.0.0-rc.12
|
227
|
+
- @modern-js/utils@1.0.0-rc.12
|
228
|
+
|
229
|
+
## 1.0.0-rc.11
|
230
|
+
|
231
|
+
### Patch Changes
|
232
|
+
|
233
|
+
- 224f7fe: fix server route match
|
234
|
+
- 204c626: feat: initial
|
235
|
+
- Updated dependencies [224f7fe]
|
236
|
+
- Updated dependencies [204c626]
|
237
|
+
- @modern-js/core@1.0.0-rc.11
|
238
|
+
- @modern-js/webpack@1.0.0-rc.11
|
239
|
+
- @modern-js/plugin@1.0.0-rc.11
|
240
|
+
- @modern-js/utils@1.0.0-rc.11
|
241
|
+
|
242
|
+
## 1.0.0-rc.10
|
243
|
+
|
244
|
+
### Patch Changes
|
245
|
+
|
246
|
+
- 224f7fe: fix server route match
|
247
|
+
- 204c626: feat: initial
|
248
|
+
- Updated dependencies [224f7fe]
|
249
|
+
- Updated dependencies [204c626]
|
250
|
+
- @modern-js/core@1.0.0-rc.10
|
251
|
+
- @modern-js/webpack@1.0.0-rc.10
|
252
|
+
- @modern-js/plugin@1.0.0-rc.10
|
253
|
+
- @modern-js/utils@1.0.0-rc.10
|
254
|
+
|
255
|
+
## 1.0.0-rc.9
|
256
|
+
|
257
|
+
### Patch Changes
|
258
|
+
|
259
|
+
- 224f7fe: fix server route match
|
260
|
+
- 204c626: feat: initial
|
261
|
+
- Updated dependencies [224f7fe]
|
262
|
+
- Updated dependencies [204c626]
|
263
|
+
- @modern-js/core@1.0.0-rc.9
|
264
|
+
- @modern-js/webpack@1.0.0-rc.9
|
265
|
+
- @modern-js/plugin@1.0.0-rc.9
|
266
|
+
- @modern-js/utils@1.0.0-rc.9
|
267
|
+
|
268
|
+
## 1.0.0-rc.8
|
269
|
+
|
270
|
+
### Patch Changes
|
271
|
+
|
272
|
+
- 224f7fe: fix server route match
|
273
|
+
- 204c626: feat: initial
|
274
|
+
- Updated dependencies [224f7fe]
|
275
|
+
- Updated dependencies [204c626]
|
276
|
+
- @modern-js/core@1.0.0-rc.8
|
277
|
+
- @modern-js/webpack@1.0.0-rc.8
|
278
|
+
- @modern-js/plugin@1.0.0-rc.8
|
279
|
+
- @modern-js/utils@1.0.0-rc.8
|
280
|
+
|
281
|
+
## 1.0.0-rc.7
|
282
|
+
|
283
|
+
### Patch Changes
|
284
|
+
|
285
|
+
- 224f7fe: fix server route match
|
286
|
+
- 204c626: feat: initial
|
287
|
+
- Updated dependencies [224f7fe]
|
288
|
+
- Updated dependencies [204c626]
|
289
|
+
- @modern-js/core@1.0.0-rc.7
|
290
|
+
- @modern-js/webpack@1.0.0-rc.7
|
291
|
+
- @modern-js/plugin@1.0.0-rc.7
|
292
|
+
- @modern-js/utils@1.0.0-rc.7
|
293
|
+
|
294
|
+
## 1.0.0-rc.6
|
295
|
+
|
296
|
+
### Patch Changes
|
297
|
+
|
298
|
+
- 224f7fe: fix server route match
|
299
|
+
- 204c626: feat: initial
|
300
|
+
- Updated dependencies [224f7fe]
|
301
|
+
- Updated dependencies [204c626]
|
302
|
+
- @modern-js/core@1.0.0-rc.6
|
303
|
+
- @modern-js/webpack@1.0.0-rc.6
|
304
|
+
- @modern-js/plugin@1.0.0-rc.6
|
305
|
+
- @modern-js/utils@1.0.0-rc.6
|
306
|
+
|
307
|
+
## 1.0.0-rc.5
|
308
|
+
|
309
|
+
### Patch Changes
|
310
|
+
|
311
|
+
- 224f7fe: fix server route match
|
312
|
+
- 204c626: feat: initial
|
313
|
+
- Updated dependencies [224f7fe]
|
314
|
+
- Updated dependencies [204c626]
|
315
|
+
- @modern-js/core@1.0.0-rc.5
|
316
|
+
- @modern-js/webpack@1.0.0-rc.5
|
317
|
+
- @modern-js/plugin@1.0.0-rc.5
|
318
|
+
- @modern-js/utils@1.0.0-rc.5
|
319
|
+
|
320
|
+
## 1.0.0-rc.4
|
321
|
+
|
322
|
+
### Patch Changes
|
323
|
+
|
324
|
+
- fix server route match
|
325
|
+
- 204c626: feat: initial
|
326
|
+
- Updated dependencies [undefined]
|
327
|
+
- Updated dependencies [204c626]
|
328
|
+
- @modern-js/core@1.0.0-rc.4
|
329
|
+
- @modern-js/webpack@1.0.0-rc.4
|
330
|
+
- @modern-js/plugin@1.0.0-rc.4
|
331
|
+
- @modern-js/utils@1.0.0-rc.4
|
332
|
+
|
333
|
+
## 1.0.0-rc.3
|
334
|
+
|
335
|
+
### Patch Changes
|
336
|
+
|
337
|
+
- feat: initial
|
338
|
+
- Updated dependencies [undefined]
|
339
|
+
- @modern-js/core@1.0.0-rc.3
|
340
|
+
- @modern-js/webpack@1.0.0-rc.3
|
341
|
+
- @modern-js/plugin@1.0.0-rc.3
|
342
|
+
- @modern-js/utils@1.0.0-rc.3
|
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
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.
|
package/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
<p align="center">
|
3
|
+
<a href="https://modernjs.dev" target="blank"><img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png" width="300" alt="Modern.js Logo" /></a>
|
4
|
+
</p>
|
5
|
+
<p align="center">
|
6
|
+
现代 Web 工程体系
|
7
|
+
<br/>
|
8
|
+
<a href="https://modernjs.dev" target="blank">
|
9
|
+
modernjs.dev
|
10
|
+
</a>
|
11
|
+
</p>
|
12
|
+
<p align="center">
|
13
|
+
The meta-framework suite designed from scratch for frontend-focused modern web development
|
14
|
+
</p>
|
15
|
+
|
16
|
+
# Introduction
|
17
|
+
|
18
|
+
> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.
|
19
|
+
|
20
|
+
- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)
|
21
|
+
|
22
|
+
## Getting Started
|
23
|
+
|
24
|
+
- [Quick Start](https://modernjs.dev/docs/start)
|
25
|
+
- [Guides](https://modernjs.dev/docs/guides)
|
26
|
+
- [API References](https://modernjs.dev/docs/apis)
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
|
30
|
+
- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { Import } from '@modern-js/utils';
|
2
|
+
const core = Import.lazy('@modern-js/core', require);
|
3
|
+
const features = Import.lazy('./features', require);
|
4
|
+
|
5
|
+
const taskMain = async ({
|
6
|
+
appContext
|
7
|
+
}) => {
|
8
|
+
const {
|
9
|
+
appDirectory
|
10
|
+
} = appContext;
|
11
|
+
await features.buildDocs({
|
12
|
+
appDirectory
|
13
|
+
});
|
14
|
+
};
|
15
|
+
|
16
|
+
(async () => {
|
17
|
+
const {
|
18
|
+
appContext
|
19
|
+
} = await core.cli.init();
|
20
|
+
await core.manager.run(async () => {
|
21
|
+
try {
|
22
|
+
await taskMain({
|
23
|
+
appContext
|
24
|
+
});
|
25
|
+
} catch (e) {
|
26
|
+
console.error(e.message);
|
27
|
+
}
|
28
|
+
});
|
29
|
+
})();
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { logger, Import, chalk } from '@modern-js/utils';
|
2
|
+
const wp = Import.lazy('./utils/webpack', require);
|
3
|
+
const gen = Import.lazy('./utils/generate-files', require); // eslint-disable-next-line max-params
|
4
|
+
|
5
|
+
export async function build(appDirectory, tmpDir, files, webpackConfig, isDev) {
|
6
|
+
const meta = await gen.generateFiles(appDirectory, tmpDir, files, isDev);
|
7
|
+
|
8
|
+
try {
|
9
|
+
await wp.runWebpack(webpackConfig);
|
10
|
+
logger.log(chalk.green('build docs successful'));
|
11
|
+
return meta;
|
12
|
+
} catch (err) {
|
13
|
+
logger.error('failed to build docs');
|
14
|
+
logger.error(err);
|
15
|
+
return null;
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import path from 'path';
|
2
|
+
import { logger } from '@modern-js/utils';
|
3
|
+
import webpack from '@modern-js/deps/compiled/webpack';
|
4
|
+
import WebpackDevServer from 'webpack-dev-server';
|
5
|
+
import { chokidarFile } from "./utils/chokidar";
|
6
|
+
import { generateFiles } from "./utils/generate-files"; // eslint-disable-next-line max-params
|
7
|
+
|
8
|
+
export async function dev(appDirectory, tmpDir, files, webpackConfig, isDev, port) {
|
9
|
+
await generateFiles(appDirectory, tmpDir, files, isDev);
|
10
|
+
const compiler = webpack(webpackConfig);
|
11
|
+
const server = new WebpackDevServer({
|
12
|
+
host: '0.0.0.0',
|
13
|
+
port,
|
14
|
+
historyApiFallback: true,
|
15
|
+
static: {
|
16
|
+
directory: path.resolve(appDirectory, 'assets'),
|
17
|
+
publicPath: '/assets'
|
18
|
+
}
|
19
|
+
}, compiler);
|
20
|
+
server.startCallback(() => {
|
21
|
+
logger.info(`Starting server on http://localhost:${port}`);
|
22
|
+
});
|
23
|
+
chokidarFile(appDirectory, tmpDir, isDev);
|
24
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import path from 'path';
|
2
|
+
import { fs, Import, logger } from '@modern-js/utils';
|
3
|
+
import { valid } from "./utils/valid";
|
4
|
+
const buildFeat = Import.lazy('./build', require);
|
5
|
+
const devFeat = Import.lazy('./dev', require);
|
6
|
+
const wp = Import.lazy('./utils/webpack', require);
|
7
|
+
const glob = Import.lazy('glob', require);
|
8
|
+
const DEFAULT_PORT = 5000;
|
9
|
+
export async function buildDocs({
|
10
|
+
appDirectory,
|
11
|
+
isDev = false,
|
12
|
+
port = DEFAULT_PORT
|
13
|
+
}) {
|
14
|
+
if (!valid({
|
15
|
+
appDirectory,
|
16
|
+
docsDir: 'docs'
|
17
|
+
})) {
|
18
|
+
return;
|
19
|
+
}
|
20
|
+
|
21
|
+
const docsDir = path.resolve(appDirectory, 'docs');
|
22
|
+
|
23
|
+
if (!fs.pathExistsSync(docsDir)) {
|
24
|
+
return;
|
25
|
+
}
|
26
|
+
|
27
|
+
const files = glob.sync('**/*.{md,mdx}', {
|
28
|
+
cwd: docsDir,
|
29
|
+
ignore: '**/_*'
|
30
|
+
});
|
31
|
+
|
32
|
+
if (files.length === 0) {
|
33
|
+
logger.warn('not find md(x) files');
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
|
37
|
+
const tmpDir = path.join(appDirectory, './node_modules/.modern-js/docs');
|
38
|
+
fs.ensureDirSync(tmpDir);
|
39
|
+
const finalWebpackConfig = wp.generatorWebpackConfig(appDirectory, tmpDir, isDev);
|
40
|
+
|
41
|
+
if (!isDev) {
|
42
|
+
logger.info('build docs');
|
43
|
+
await buildFeat.build(appDirectory, tmpDir, files, finalWebpackConfig, false);
|
44
|
+
} else {
|
45
|
+
await devFeat.dev(appDirectory, tmpDir, files, finalWebpackConfig, true, port);
|
46
|
+
}
|
47
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import path from 'path';
|
2
|
+
import { logger } from '@modern-js/utils';
|
3
|
+
import chokidar from 'chokidar';
|
4
|
+
import glob from 'glob';
|
5
|
+
import { generateFiles } from "./generate-files";
|
6
|
+
export function chokidarFile(appDirectory, tmpDir, isDev) {
|
7
|
+
let dirty = false;
|
8
|
+
let building = false;
|
9
|
+
chokidar.watch('docs/**/*.{md,mdx}', {
|
10
|
+
cwd: appDirectory,
|
11
|
+
ignoreInitial: true
|
12
|
+
}).on('all', async () => {
|
13
|
+
if (building) {
|
14
|
+
dirty = true;
|
15
|
+
} else {
|
16
|
+
building = true;
|
17
|
+
dirty = false;
|
18
|
+
logger.info('changed, collect and rebuild docs');
|
19
|
+
const files = glob.sync('**/*.{md,mdx}', {
|
20
|
+
cwd: path.resolve(appDirectory, 'docs'),
|
21
|
+
ignore: '**/_*'
|
22
|
+
});
|
23
|
+
|
24
|
+
if (files.length) {
|
25
|
+
await generateFiles(appDirectory, tmpDir, files, isDev);
|
26
|
+
logger.info('built');
|
27
|
+
} // eslint-disable-next-line require-atomic-updates
|
28
|
+
|
29
|
+
|
30
|
+
building = false;
|
31
|
+
|
32
|
+
if (dirty) {
|
33
|
+
await generateFiles(appDirectory, tmpDir, files, isDev);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
});
|
37
|
+
}
|