@modern-js/main-doc 2.54.0 → 2.54.1
Sign up to get free protection for your applications and to get access to all the features.
- package/docs/en/apis/app/commands.mdx +0 -35
- package/docs/en/configure/app/usage.mdx +0 -1
- package/docs/en/guides/basic-features/env-vars.mdx +0 -1
- package/docs/zh/apis/app/commands.mdx +0 -35
- package/docs/zh/configure/app/usage.mdx +0 -1
- package/docs/zh/guides/basic-features/env-vars.mdx +0 -1
- package/package.json +5 -5
@@ -266,38 +266,3 @@ Options:
|
|
266
266
|
Normally, only the part of the code modified by this commit needs to be checked by `lint-staged` during the `git commit` phase.
|
267
267
|
|
268
268
|
- `--no-fix` close auto fix by lint.
|
269
|
-
|
270
|
-
## modern test
|
271
|
-
|
272
|
-
`modern test` command will automatically run the test cases.
|
273
|
-
|
274
|
-
```bash
|
275
|
-
Usage: modern test [options]
|
276
|
-
|
277
|
-
Options:
|
278
|
-
-u --updateSnapshot use this flag to re-record snapshots.
|
279
|
-
--watch watch files for changes and rerun tests related to changed files.
|
280
|
-
-h, --help show command help
|
281
|
-
```
|
282
|
-
|
283
|
-
:::tip
|
284
|
-
`modern test` command need to execute the `new` command in advance to enable the `unit test/integration test`.
|
285
|
-
:::
|
286
|
-
|
287
|
-
The effect is as follows:
|
288
|
-
|
289
|
-
```bash
|
290
|
-
$ npx modern test
|
291
|
-
PASS src/tests/index.test.ts
|
292
|
-
The add method
|
293
|
-
✓ should work fine. (2ms)
|
294
|
-
|
295
|
-
Test Suites: 1 passed, 1 total
|
296
|
-
Tests: 1 passed, 1 total
|
297
|
-
Snapshots: 0 total
|
298
|
-
Time: 0.994 s, estimated 1 s
|
299
|
-
```
|
300
|
-
|
301
|
-
:::info
|
302
|
-
Files match `*.test.(js|ts)` in `api/` or `src/` folders will be recognized as test cases by default.
|
303
|
-
:::
|
@@ -97,7 +97,6 @@ This function takes the following parameters:
|
|
97
97
|
- `env`: same as the value of `process.env.NODE_ENV`.
|
98
98
|
- When running `modern dev` or `modern start`, the value of `env` is `development`.
|
99
99
|
- When running `modern build` or `modern serve`, the value of `env` is `production`.
|
100
|
-
- When running `modern test`, the value of `env` is `test`.
|
101
100
|
- `command`: corresponds to the currently running command, such as `dev`, `start`, `build`, `serve`.
|
102
101
|
|
103
102
|
### Export Async Function
|
@@ -17,7 +17,6 @@ The current path prefix of the asset, which is a read-only environment variable.
|
|
17
17
|
The current execution environment and is a **read-only** environment variable whose have different values under different execution commands:
|
18
18
|
|
19
19
|
- `production`: Default value when running `modern build` or `modern serve`.
|
20
|
-
- `test`: Default value when running `modern test`.
|
21
20
|
- `development`: Default value when running `modern dev`, also the default value in other cases.
|
22
21
|
|
23
22
|
### MODERN_ENV
|
@@ -268,38 +268,3 @@ Options:
|
|
268
268
|
通常情况下,我们只需要在 `git commit` 阶段通过 `lint-staged` 检查本次提交修改的部分代码。
|
269
269
|
|
270
270
|
- 设置 `--no-fix` 参数后可以关闭自动修复 lint 错误代码的能力。
|
271
|
-
|
272
|
-
## modern test
|
273
|
-
|
274
|
-
`modern test` 命令会自动运行项目下的测试用例。
|
275
|
-
|
276
|
-
```bash
|
277
|
-
Usage: modern test [options]
|
278
|
-
|
279
|
-
Options:
|
280
|
-
-u --updateSnapshot 使用此选项来更新快照
|
281
|
-
--watch 监视文件的变更并重新运行相关的测试
|
282
|
-
-h, --help 显示命令帮助
|
283
|
-
```
|
284
|
-
|
285
|
-
:::tip
|
286
|
-
在使用 `modern test` 命令前,需要先通过 [`new`](/apis/app/commands#modern-new) 命令启用「单元测试 / 集成测试」功能。
|
287
|
-
:::
|
288
|
-
|
289
|
-
效果如下:
|
290
|
-
|
291
|
-
```bash
|
292
|
-
$ npx modern test
|
293
|
-
PASS src/tests/index.test.ts
|
294
|
-
The add method
|
295
|
-
✓ should work fine. (2ms)
|
296
|
-
|
297
|
-
Test Suites: 1 passed, 1 total
|
298
|
-
Tests: 1 passed, 1 total
|
299
|
-
Snapshots: 0 total
|
300
|
-
Time: 0.994 s, estimated 1 s
|
301
|
-
```
|
302
|
-
|
303
|
-
:::info
|
304
|
-
`src` 和 `api` 目录下面的 `*.test.(js|ts)` 文件都会被识别为测试用例。
|
305
|
-
:::
|
@@ -97,7 +97,6 @@ export default defineConfig(({ env, command }) => ({
|
|
97
97
|
- `env`:对应 `process.env.NODE_ENV` 的值。
|
98
98
|
- 当运行 `modern dev` 或 `modern start` 时,`env` 的值为 `development`。
|
99
99
|
- 当运行 `modern build` 或 `modern serve` 时,`env` 的值为 `production`。
|
100
|
-
- 当运行 `modern test` 时,`env` 的值为 `test`。
|
101
100
|
- `command`:对应当前运行的命令,如 `dev`、`start`、`build`、`serve`。
|
102
101
|
|
103
102
|
### 导出异步函数
|
package/package.json
CHANGED
@@ -15,17 +15,17 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.54.
|
18
|
+
"version": "2.54.1",
|
19
19
|
"publishConfig": {
|
20
20
|
"registry": "https://registry.npmjs.org/",
|
21
21
|
"access": "public",
|
22
22
|
"provenance": true
|
23
23
|
},
|
24
24
|
"dependencies": {
|
25
|
-
"@modern-js/sandpack-react": "2.54.
|
25
|
+
"@modern-js/sandpack-react": "2.54.1"
|
26
26
|
},
|
27
27
|
"peerDependencies": {
|
28
|
-
"@modern-js/builder-doc": "^2.54.
|
28
|
+
"@modern-js/builder-doc": "^2.54.1"
|
29
29
|
},
|
30
30
|
"devDependencies": {
|
31
31
|
"classnames": "^2",
|
@@ -39,8 +39,8 @@
|
|
39
39
|
"@rspress/shared": "1.18.2",
|
40
40
|
"@types/node": "^16",
|
41
41
|
"@types/fs-extra": "9.0.13",
|
42
|
-
"@modern-js/doc
|
43
|
-
"@modern-js/
|
42
|
+
"@modern-js/builder-doc": "2.54.1",
|
43
|
+
"@modern-js/doc-plugin-auto-sidebar": "2.54.1"
|
44
44
|
},
|
45
45
|
"scripts": {
|
46
46
|
"dev": "rspress dev",
|