@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.
Files changed (32) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +4 -4
  3. package/en/docusaurus-plugin-content-docs/current/apis/app/commands/_category_.json +1 -1
  4. package/en/docusaurus-plugin-content-docs/current/apis/app/commands/build.md +0 -6
  5. package/en/docusaurus-plugin-content-docs/current/apis/app/commands/dev.md +27 -2
  6. package/en/docusaurus-plugin-content-docs/current/apis/app/commands/lint.md +0 -4
  7. package/en/docusaurus-plugin-content-docs/current/apis/app/commands/new.md +0 -4
  8. package/en/docusaurus-plugin-content-docs/current/apis/app/commands/serve.md +0 -4
  9. package/en/docusaurus-plugin-content-docs/current/apis/app/commands/test.md +0 -4
  10. package/en/docusaurus-plugin-content-docs/current/apis/app/commands/upgrade.md +0 -4
  11. package/en/docusaurus-plugin-content-docs/current/guides/troubleshooting/_category_.json +5 -0
  12. package/en/docusaurus-plugin-content-docs/current/{components/command-tip.md → guides/troubleshooting/cli.md} +8 -2
  13. package/package.json +3 -3
  14. package/zh/apis/app/commands/_category_.json +1 -1
  15. package/zh/apis/app/commands/build.md +0 -6
  16. package/zh/apis/app/commands/dev.md +28 -3
  17. package/zh/apis/app/commands/lint.md +0 -4
  18. package/zh/apis/app/commands/new.md +0 -4
  19. package/zh/apis/app/commands/serve.md +0 -4
  20. package/zh/apis/app/commands/test.md +0 -4
  21. package/zh/apis/app/commands/upgrade.md +0 -4
  22. package/zh/apis/monorepo/commands/bump.md +0 -4
  23. package/zh/apis/monorepo/commands/change.md +0 -4
  24. package/zh/apis/monorepo/commands/clear.md +0 -4
  25. package/zh/apis/monorepo/commands/deploy.md +0 -4
  26. package/zh/apis/monorepo/commands/gen-release-note.md +0 -4
  27. package/zh/apis/monorepo/commands/lint.md +0 -4
  28. package/zh/apis/monorepo/commands/new.md +0 -4
  29. package/zh/apis/monorepo/commands/pre.md +0 -4
  30. package/zh/apis/monorepo/commands/release.md +0 -4
  31. package/zh/apis/monorepo/commands/upgrade.md +0 -4
  32. package/zh/{components/command-tip.md → guides/troubleshooting/cli.md} +8 -3
@@ -1,4 +1,4 @@
1
1
 
2
- > @modern-js/main-doc@2.1.0 build /github/workspace/packages/toolkit/main-doc
2
+ > @modern-js/main-doc@2.1.0 build /tmp/repo/modern.js/packages/toolkit/main-doc
3
3
  > npx ts-node ./scripts/sync.ts
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @modern-js/main-doc
2
2
 
3
- ## 0.0.0-next-20230113074650
3
+ ## 0.0.0-next-20230113142853
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - 8a51f073d5: docs: modify data loader usage in the guide
7
+ - 8a51f073d: docs: modify data loader usage in the guide
8
8
  docs: 修改指南中 data loader 的用法
9
- - Updated dependencies [9da67a2c1e]
10
- - @modern-js/builder-doc@0.0.0-next-20230113074650
9
+ - Updated dependencies [9da67a2c1]
10
+ - @modern-js/builder-doc@0.0.0-next-20230113142853
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "label": "Commands",
3
- "position": 3,
3
+ "position": 0,
4
4
  "link": {
5
5
  "type": "doc",
6
6
  "id": "apis/app/commands/index"
@@ -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
- import CommandTip from '@site-docs-en/components/command-tip.md'
34
+ ## Compile Partial Pages
35
35
 
36
- <CommandTip />
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:
@@ -24,7 +24,3 @@ export default defineConfig({
24
24
  },
25
25
  });
26
26
  ```
27
-
28
- import CommandTip from '@site-docs-en/components/command-tip.md'
29
-
30
- <CommandTip />
@@ -30,7 +30,3 @@ Time: 0.994 s, estimated 1 s
30
30
  :::info
31
31
  files match `*.test.(js|ts)` in `api/` or `src/` will be recognized as test cases by default。
32
32
  :::
33
-
34
- import CommandTip from '@site-docs-en/components/command-tip.md'
35
-
36
- <CommandTip />
@@ -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
- :::
@@ -0,0 +1,5 @@
1
+ {
2
+ "label": "FAQ",
3
+ "position": 6,
4
+ "collapsed": true
5
+ }
@@ -1,4 +1,11 @@
1
- :::tip 提示
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-20230113074650",
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": "^0.0.0-next-20230113074650"
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-20230113074650"
27
+ "@modern-js/builder-doc": "0.0.0-next-20230113142853"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "npx ts-node ./scripts/sync.ts"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "label": "命令",
3
- "position": 3,
3
+ "position": 0,
4
4
  "link": {
5
5
  "type": "doc",
6
6
  "id": "apis/app/commands/index"
@@ -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
- import CommandTip from '@site-docs/components/command-tip.md'
34
+ ## 编译部分页面
35
35
 
36
- <CommandTip />
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
+ ```
@@ -16,7 +16,3 @@ Options:
16
16
  运行 `ESLint` 检查代码语法情况。通常情况下,我们只需要在 `git commit` 阶段通过 `lint-staged` 检查本次提交修改的部分代码。
17
17
 
18
18
  - `--no-fix` 参数设置后可以关闭自动修复 lint 错误代码的能力。
19
-
20
- import CommandTip from '@site-docs/components/command-tip.md'
21
-
22
- <CommandTip />
@@ -19,10 +19,6 @@ Options:
19
19
 
20
20
  比如添加应用入口、启用启用一些可选功能如 Tailwind CSS、微前端开发模式等。
21
21
 
22
- import CommandTip from '@site-docs/components/command-tip.md'
23
-
24
- <CommandTip />
25
-
26
22
  ### 添加入口
27
23
 
28
24
  在应用工程中,执行 `new` 命令添加入口如下:
@@ -24,7 +24,3 @@ export default defineConfig({
24
24
  },
25
25
  });
26
26
  ```
27
-
28
- import CommandTip from '@site-docs/components/command-tip.md'
29
-
30
- <CommandTip />
@@ -30,7 +30,3 @@ Time: 0.994 s, estimated 1 s
30
30
  :::info 注
31
31
  `src` 和 `api` 目录下面 `*.test.(js|ts)` 都会默认识别为测试用例。
32
32
  :::
33
-
34
- import CommandTip from '@site-docs/components/command-tip.md'
35
-
36
- <CommandTip />
@@ -15,7 +15,3 @@ Options:
15
15
  ```
16
16
 
17
17
  在项目根目录下执行命令 `npx modern upgrade`,会默认将当前执行命令项目的 `package.json` 中的 Modern.js 相关依赖更新至最新版本。
18
-
19
- :::info
20
- 命令在 `@modern-js/app-tools` 版本 >= 1.17.0 提供,之前版本可使用 `npx @modern-js/upgrade` 进行升级。
21
- :::
@@ -36,7 +36,3 @@ npx modern bump
36
36
 
37
37
  - test publish
38
38
  ```
39
-
40
- import CommandTip from '@site-docs/components/command-tip.md'
41
-
42
- <CommandTip />
@@ -53,7 +53,3 @@ $ npx modern change
53
53
 
54
54
  test publish
55
55
  ```
56
-
57
- import CommandTip from '@site-docs/components/command-tip.md'
58
-
59
- <CommandTip />
@@ -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 以及 Monorepo 子项目的 `node_modules` 进行清理。
20
16
 
21
17
  可以通过参数 `--remove-dirs` 来指定要删除的目录,例如执行:
@@ -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。
@@ -28,7 +28,3 @@ Options:
28
28
 
29
29
  [[#1264](https://github.com/modern-js-dev/modern.js/pull/1264)] fix: conventional router app use App.init not work
30
30
  ```
31
-
32
- import CommandTip from '@site-docs/components/command-tip.md'
33
-
34
- <CommandTip />
@@ -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 错误代码的能力。
@@ -15,10 +15,6 @@ Options:
15
15
  -h, --help display help for command
16
16
  ```
17
17
 
18
- import CommandTip from '@site-docs/components/command-tip.md'
19
-
20
- <CommandTip />
21
-
22
18
  `modern new` 命令在 monorepo 中可以用来添加应用工程和可复用的模块:
23
19
 
24
20
  ```bash
@@ -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>` 进入预发布模式:
@@ -13,7 +13,3 @@ Options:
13
13
  ```
14
14
 
15
15
  发布当前仓库的 Packages 至 NPM。
16
-
17
- import CommandTip from '@site-docs/components/command-tip.md'
18
-
19
- <CommandTip />
@@ -17,7 +17,3 @@ Options:
17
17
  `modern upgrade` 命令,用于升级项目 Modern.js 相关依赖至最新版本。
18
18
 
19
19
  在项目根目录下执行命令 `npx modern upgrade`,会默认将当前执行命令项目的 `package.json` 中的 Modern.js 相关依赖更新至最新版本。
20
-
21
- :::info
22
- 命令在 `@modern-js/monorepo-tools` 版本 >= 1.17.0 提供,之前版本可使用 `npx @modern-js/upgrade` 进行升级。
23
- :::
@@ -1,4 +1,11 @@
1
- :::tip 提示
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
- :::