-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
918 additions
and
992 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
# 命令行参数 | ||
某些情况下, 通过命令行传入可能更简便, 支持 [配置选项](../config/选项.md) 中的以下值类型: | ||
- string | ||
- boolean | ||
- number | ||
|
||
示例: | ||
``` sh | ||
mm proxy=http://www.httpbin.org/ | ||
``` | ||
|
||
对应配置 config.proxy: | ||
``` json | ||
{ | ||
"proxy": "http://www.httpbin.org/" | ||
} | ||
``` | ||
|
||
当命令行参数与文件配置冲突时, 命令行参数优先. | ||
|
||
命令行有一些额外的参数来实现配置文件之外的功能: | ||
- v 输出版本号 | ||
- config 指定配置文件地址. | ||
- watch 指定一些目录或文件, 当它们被修改时自动重载 mm, 多个使用逗号分隔. | ||
|
||
::: tip | ||
命令行上传入 config 却没有给出具体值时(`mm config`), 如果当前目录不存在配置文件, 会以默认参数生成 `mm.config.js` 作为模板供你使用. 然后按你的需求修改此文件即可. | ||
::: | ||
# 命令行参数 | ||
某些情况下, 通过命令行传入可能更简便, 支持 [配置选项](../config/option.md) 中的以下值类型: | ||
- string | ||
- boolean | ||
- number | ||
|
||
示例: | ||
``` sh | ||
mm proxy=http://www.httpbin.org/ | ||
``` | ||
|
||
对应配置 config.proxy: | ||
``` json | ||
{ | ||
"proxy": "http://www.httpbin.org/" | ||
} | ||
``` | ||
|
||
当命令行参数与文件配置冲突时, 命令行参数优先. | ||
|
||
命令行有一些额外的参数来实现配置文件之外的功能: | ||
- v 输出版本号 | ||
- config 指定配置文件地址. | ||
- watch 指定一些目录或文件, 当它们被修改时自动重载 mm, 多个使用逗号分隔. | ||
|
||
::: tip | ||
命令行上传入 config 却没有给出具体值时(`mm config`), 如果当前目录不存在配置文件, 会以默认参数生成 `mm.config.js` 作为模板供你使用. 然后按你的需求修改此文件即可. | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
# 配置文件 | ||
mockm 支持 js 类型的配置文件. | ||
|
||
**mm.config.js** | ||
``` js | ||
module.exports = { | ||
port: 9000 | ||
} | ||
``` | ||
|
||
作为函数使用的时候, 可以获取 mm 提供的 [工具库](../config/config_fn.md). | ||
|
||
``` js | ||
module.exports = util => { | ||
return { | ||
port: 9000 | ||
} | ||
} | ||
``` | ||
|
||
上面的文件中, 将 mockm 接口服务的端口号配置为 9000, 更多的配置请参考 [配置项](../config/选项.md#config-port). | ||
# 配置文件 | ||
mockm 支持 js 类型的配置文件. | ||
|
||
**mm.config.js** | ||
``` js | ||
module.exports = { | ||
port: 9000 | ||
} | ||
``` | ||
|
||
作为函数使用的时候, 可以获取 mm 提供的 [工具库](../config/config_fn.md). | ||
|
||
``` js | ||
module.exports = util => { | ||
return { | ||
port: 9000 | ||
} | ||
} | ||
``` | ||
|
||
上面的文件中, 将 mockm 接口服务的端口号配置为 9000, 更多的配置请参考 [配置项](../config/option.md#config-port). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.