@modern-js/main-doc 0.0.0-next-20230113074650 → 0.0.0-next-20230113142853
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +4 -4
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/_category_.json +1 -1
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/build.md +0 -6
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/dev.md +27 -2
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/lint.md +0 -4
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/new.md +0 -4
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/serve.md +0 -4
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/test.md +0 -4
- package/en/docusaurus-plugin-content-docs/current/apis/app/commands/upgrade.md +0 -4
- package/en/docusaurus-plugin-content-docs/current/guides/troubleshooting/_category_.json +5 -0
- package/en/docusaurus-plugin-content-docs/current/{components/command-tip.md → guides/troubleshooting/cli.md} +8 -2
- package/package.json +3 -3
- package/zh/apis/app/commands/_category_.json +1 -1
- package/zh/apis/app/commands/build.md +0 -6
- package/zh/apis/app/commands/dev.md +28 -3
- package/zh/apis/app/commands/lint.md +0 -4
- package/zh/apis/app/commands/new.md +0 -4
- package/zh/apis/app/commands/serve.md +0 -4
- package/zh/apis/app/commands/test.md +0 -4
- package/zh/apis/app/commands/upgrade.md +0 -4
- package/zh/apis/monorepo/commands/bump.md +0 -4
- package/zh/apis/monorepo/commands/change.md +0 -4
- package/zh/apis/monorepo/commands/clear.md +0 -4
- package/zh/apis/monorepo/commands/deploy.md +0 -4
- package/zh/apis/monorepo/commands/gen-release-note.md +0 -4
- package/zh/apis/monorepo/commands/lint.md +0 -4
- package/zh/apis/monorepo/commands/new.md +0 -4
- package/zh/apis/monorepo/commands/pre.md +0 -4
- package/zh/apis/monorepo/commands/release.md +0 -4
- package/zh/apis/monorepo/commands/upgrade.md +0 -4
- package/zh/{components/command-tip.md → guides/troubleshooting/cli.md} +8 -3
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# @modern-js/main-doc
|
2
2
|
|
3
|
-
## 0.0.0-next-
|
3
|
+
## 0.0.0-next-20230113142853
|
4
4
|
|
5
5
|
### Patch Changes
|
6
6
|
|
7
|
-
-
|
7
|
+
- 8a51f073d: docs: modify data loader usage in the guide
|
8
8
|
docs: 修改指南中 data loader 的用法
|
9
|
-
- Updated dependencies [
|
10
|
-
- @modern-js/builder-doc@0.0.0-next-
|
9
|
+
- Updated dependencies [9da67a2c1]
|
10
|
+
- @modern-js/builder-doc@0.0.0-next-20230113142853
|
@@ -36,9 +36,3 @@ Open the above HTML file in the browser, you can see the tile diagram of the pac
|
|
36
36
|
<img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/aphqeh7uhohpquloj/modern-js/mwa-build-analyze-8784f762c1ab0cb20935829d5f912c4c.png" />
|
37
37
|
|
38
38
|
> this features based on [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer).
|
39
|
-
|
40
|
-
## Command Arguments
|
41
|
-
|
42
|
-
import CommandTip from '@site-docs-en/components/command-tip.md'
|
43
|
-
|
44
|
-
<CommandTip />
|
@@ -31,6 +31,31 @@ info App running at:
|
|
31
31
|
> Network: http://192.168.0.1:8080/
|
32
32
|
```
|
33
33
|
|
34
|
-
|
34
|
+
## Compile Partial Pages
|
35
35
|
|
36
|
-
|
36
|
+
In multi-page (MPA) projects, the `--entry` option can be added to specify one or more pages to compile. In this way, only part of the code in the project will be compiled, and the dev startup speed will be faster.
|
37
|
+
|
38
|
+
For example, execute `modern dev --entry`, the entry selector will be displayed in the command line interface:
|
39
|
+
|
40
|
+
```bash
|
41
|
+
$ modern dev --entry
|
42
|
+
|
43
|
+
? Please select the entry that needs to be built
|
44
|
+
❯ ◯ foo
|
45
|
+
◯ bar
|
46
|
+
◯ baz
|
47
|
+
```
|
48
|
+
|
49
|
+
For example, if you select the `foo` entry, only the code related to the `foo` entry will be compiled, and the code of other pages will not be compiled.
|
50
|
+
|
51
|
+
### Specify the page by parameter
|
52
|
+
|
53
|
+
You can also specify the page name through parameters after `--entry`, and the names of multiple pages can be separated by commas.
|
54
|
+
|
55
|
+
```bash
|
56
|
+
# Compile foo page
|
57
|
+
modern dev --entry foo
|
58
|
+
|
59
|
+
# Compile foo and bar pages
|
60
|
+
modern dev --entry foo,bar
|
61
|
+
```
|
@@ -16,7 +16,3 @@ Options:
|
|
16
16
|
Run ESLint to check the syntax of the code. Normally, only the part of the code modified by this commit needs to be checked by `lint-staged` during the `git commit` phase.
|
17
17
|
|
18
18
|
- `--no-fix` close auto fix by lint.
|
19
|
-
|
20
|
-
import CommandTip from '@site-docs-en/components/command-tip.md'
|
21
|
-
|
22
|
-
<CommandTip />
|
@@ -19,10 +19,6 @@ The `modern new` command is used to enable features to an existing project.
|
|
19
19
|
|
20
20
|
For example, add application entry, enable some optional features such as Tailwind CSS, micro frontend, etc.
|
21
21
|
|
22
|
-
import CommandTip from '@site-docs-en/components/command-tip.md'
|
23
|
-
|
24
|
-
<CommandTip />
|
25
|
-
|
26
22
|
### Add Entry
|
27
23
|
|
28
24
|
In the project, execute the `new` command to add entries as follows:
|
@@ -15,7 +15,3 @@ Options:
|
|
15
15
|
```
|
16
16
|
|
17
17
|
Execute the command `npx modern upgrade` in the project, by default, dependencies in the `package.json` are updated to the latest version.
|
18
|
-
|
19
|
-
:::info
|
20
|
-
the command is available in `@modern-js/app-tools` version >= 1.17.0, previous versions can be upgraded with `npx @modern-js/upgrade`.
|
21
|
-
:::
|
@@ -1,4 +1,11 @@
|
|
1
|
-
|
1
|
+
---
|
2
|
+
sidebar_position: 2
|
3
|
+
---
|
4
|
+
|
5
|
+
# CLI FAQ
|
6
|
+
|
7
|
+
### Can't pass command line arguments correctly when using pnpm?
|
8
|
+
|
2
9
|
The pnpm v6 and pnpm v7 versions do not use the same posture when executing commands. The following should be noted:
|
3
10
|
|
4
11
|
pnpm v7:
|
@@ -54,4 +61,3 @@ Summary:
|
|
54
61
|
** When using pnpm v7, if you pass arguments to pnpm, you need to put the arguments before the command **
|
55
62
|
|
56
63
|
** When using pnpm v6, if the parameter passed to pnpm, you do not need to add `--`; if the parameter passed is for script use, you need to add `--` character string **.
|
57
|
-
:::
|
package/package.json
CHANGED
@@ -11,20 +11,20 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "0.0.0-next-
|
14
|
+
"version": "0.0.0-next-20230113142853",
|
15
15
|
"publishConfig": {
|
16
16
|
"registry": "https://registry.npmjs.org/",
|
17
17
|
"access": "public"
|
18
18
|
},
|
19
19
|
"peerDependencies": {
|
20
|
-
"@modern-js/builder-doc": "
|
20
|
+
"@modern-js/builder-doc": "0.0.0-next-20230113142853"
|
21
21
|
},
|
22
22
|
"devDependencies": {
|
23
23
|
"ts-node": "^10",
|
24
24
|
"fs-extra": "^10",
|
25
25
|
"@types/node": "^16",
|
26
26
|
"@types/fs-extra": "^9",
|
27
|
-
"@modern-js/builder-doc": "0.0.0-next-
|
27
|
+
"@modern-js/builder-doc": "0.0.0-next-20230113142853"
|
28
28
|
},
|
29
29
|
"scripts": {
|
30
30
|
"build": "npx ts-node ./scripts/sync.ts"
|
@@ -36,9 +36,3 @@ File sizes after production build:
|
|
36
36
|
<img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/aphqeh7uhohpquloj/modern-js/mwa-build-analyze-8784f762c1ab0cb20935829d5f912c4c.png" />
|
37
37
|
|
38
38
|
> 该功能基于 [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) 实现。
|
39
|
-
|
40
|
-
## 命令行参数
|
41
|
-
|
42
|
-
import CommandTip from '@site-docs/components/command-tip.md'
|
43
|
-
|
44
|
-
<CommandTip />
|
@@ -10,7 +10,7 @@ Usage: modern dev / modern start [options]
|
|
10
10
|
本地开发命令
|
11
11
|
|
12
12
|
Options:
|
13
|
-
-e --entry <entry>
|
13
|
+
-e --entry <entry> 指定入口,只编译特定的页面
|
14
14
|
-c --config <config> 指定配置文件路径,可以为相对路径或绝对路径
|
15
15
|
-h, --help 显示命令帮助
|
16
16
|
--analyze 分析构建产物体积,查看各个模块打包后的大小
|
@@ -31,6 +31,31 @@ info App running at:
|
|
31
31
|
> Network: http://192.168.0.1:8080/
|
32
32
|
```
|
33
33
|
|
34
|
-
|
34
|
+
## 编译部分页面
|
35
35
|
|
36
|
-
|
36
|
+
在多页面(MPA)项目中,可以添加 `--entry` 参数来指定编译其中的一个或多个页面。这样可以只编译项目中的部分代码,从而提升 dev 启动速度。
|
37
|
+
|
38
|
+
比如执行 `modern dev --entry`,在命令行界面中会展示入口选择框:
|
39
|
+
|
40
|
+
```bash
|
41
|
+
$ modern dev --entry
|
42
|
+
|
43
|
+
? 请选择需要构建的入口
|
44
|
+
❯ ◯ foo
|
45
|
+
◯ bar
|
46
|
+
◯ baz
|
47
|
+
```
|
48
|
+
|
49
|
+
比如选择 `foo` 入口,那么只有 `foo` 入口相关的代码会进行编译,其他页面的代码将不会参与构建。
|
50
|
+
|
51
|
+
### 通过参数指定页面
|
52
|
+
|
53
|
+
你也可以在 `--entry` 后面通过参数来指定页面名称,多个页面的名称使用逗号分隔。
|
54
|
+
|
55
|
+
```bash
|
56
|
+
# 编译 foo 页面
|
57
|
+
modern dev --entry foo
|
58
|
+
|
59
|
+
# 编译 foo 和 bar 页面
|
60
|
+
modern dev --entry foo,bar
|
61
|
+
```
|
@@ -12,10 +12,6 @@ Options:
|
|
12
12
|
-h, --help display help for command
|
13
13
|
```
|
14
14
|
|
15
|
-
import CommandTip from '@site-docs/components/command-tip.md'
|
16
|
-
|
17
|
-
<CommandTip />
|
18
|
-
|
19
15
|
对指定的项目进行部署,会通过指定项目分析其依赖的 Monorepo 下的子项目。
|
20
16
|
|
21
17
|
在执行命令之后,会首先生成 `output` 目录,在目录当中包含了指定部署的项目以及其依赖的子项目,形成一个最小集合的 Monorepo。
|
@@ -12,10 +12,6 @@ Options:
|
|
12
12
|
-h, --help display help for command
|
13
13
|
```
|
14
14
|
|
15
|
-
import CommandTip from '@site-docs/components/command-tip.md'
|
16
|
-
|
17
|
-
<CommandTip />
|
18
|
-
|
19
15
|
运行 `ESLint` 检查 monorepo 中代码语法情况, 通长情况下,我们只需要在 `git commit` 阶段通过 `lint-staged` 检查本次提交修改的部分代码。
|
20
16
|
|
21
17
|
- `--no-fix` 参数设置后可以关闭自动修复 lint 错误代码的能力。
|
@@ -11,10 +11,6 @@ Options:
|
|
11
11
|
-h, --help display help for command
|
12
12
|
```
|
13
13
|
|
14
|
-
import CommandTip from '@site-docs/components/command-tip.md'
|
15
|
-
|
16
|
-
<CommandTip />
|
17
|
-
|
18
14
|
可以使用 `modern pre` 命令在正式发布前[预发布](https://github.com/atlassian/changesets/blob/main/docs/prereleases.md)一个版本。
|
19
15
|
|
20
16
|
首先 `modern pre enter <tag>` 进入预发布模式:
|
@@ -1,4 +1,11 @@
|
|
1
|
-
|
1
|
+
---
|
2
|
+
sidebar_position: 2
|
3
|
+
---
|
4
|
+
|
5
|
+
# 命令行问题
|
6
|
+
|
7
|
+
### 使用 pnpm 时无法正确传递命令行参数?
|
8
|
+
|
2
9
|
pnpm v6 和 pnpm v7 版本在执行命令时使用姿势不完全一致,需要注意以下事项:
|
3
10
|
|
4
11
|
pnpm v7:
|
@@ -54,5 +61,3 @@ pnpm v6:
|
|
54
61
|
**在使用 pnpm v7 时,如果传递参数给 pnpm,需要将参数放置到命令前**
|
55
62
|
|
56
63
|
**在使用 pnpm v6 时,如果传递的参数给 pnpm,不需要加 `--`;如果传递的参数是给脚本使用,需要增加 `--` 字符串**。
|
57
|
-
|
58
|
-
:::
|