Skip to content

Commit 6014892

Browse files
committed
:enhance: add option disabled
1 parent f4478d7 commit 6014892

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ module.exports = {
6161

6262
```js
6363
{
64+
// disabled: false, // 是否禁用该功能
6465
git: '',
6566
branch: {
6667
name: '',

micro-app.deploy.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
module.exports = {
4+
disabled: false,
45
git: '',
56
branch: {
67
name: '',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@micro-app/plugin-deploy-command",
3-
"version": "0.0.4",
3+
"version": "0.0.6",
44
"description": "[Plugin] auto deploy command plugin.",
55
"main": "src/index.js",
66
"scripts": {

src/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Examples:
3434
3535
Config:
3636
{
37+
disabled: false, ${chalk.gray('// 是否禁用该功能')}
3738
git: '', ${chalk.gray('// git 地址')}
3839
${chalk.gray('branch: \'\',')}
3940
branch: { ${chalk.gray('// git branch')}
@@ -54,12 +55,18 @@ Config:
5455
const deployConfig = tryRequire(path.resolve(api.root, configFile));
5556

5657
if (!deployConfig || typeof deployConfig !== 'object') {
57-
logger.warn('Not Found "micro-app.deploy.config.js"');
58+
logger.warn('没有找到 "micro-app.deploy.config.js" 文件, 将使用默认配置.');
59+
}
60+
61+
const config = Object.assign({}, opts, deployConfig || {});
62+
63+
if (config && (config.disabled || config.disable)) {
64+
logger.info('已禁用命令行 Deploy...');
5865
return;
5966
}
6067

6168
const deployCommit = require('./deployCommit');
62-
return deployCommit(api, args, Object.assign({}, deployConfig, opts));
69+
return deployCommit(api, args, config);
6370
});
6471

6572

0 commit comments

Comments
 (0)