Skip to content

Commit 48ce796

Browse files
committed
feat: 更新部分逻辑
1 parent 77bc931 commit 48ce796

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,18 +234,18 @@ npx micro-app show methods
234234
description: 'update package.json',
235235
usage: 'micro-app update [options]',
236236
options: {
237-
'-': 'update all.',
237+
'--all': 'update all.',
238238
'-n <name>': 'only update <name>.',
239239
},
240240
details: `
241241
Examples:
242242
${chalk.gray('# update all')}
243-
micro-app update
243+
micro-app update --all
244244
${chalk.gray('# only update <name>')}
245-
micro-app update -n <name>
245+
micro-app update -name <name>
246246
`.trim(),
247247
}, args => {
248-
const name = args.n;
248+
const name = args.name;
249249
return updateMicro(api, name);
250250
});
251251

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@
5252
}
5353
},
5454
"devDependencies": {
55-
"@micro-app/plugin-deploy": "^0.0.8",
55+
"@micro-app/plugin-deploy": "^0.0.9",
5656
"@types/jest": "^24.9.1",
5757
"eslint-config-2o3t": "^2.0.2",
5858
"husky": "^3.1.0",
5959
"jest": "^24.9.0"
6060
},
6161
"dependencies": {
62-
"@micro-app/core": "^0.4.2",
62+
"@micro-app/core": "^0.4.3",
6363
"@zkochan/cmd-shim": "^4.3.0",
6464
"read-cmd-shim": "^2.0.0",
6565
"update-notifier": "^4.1.3"

src/plugins/commands/update/index.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,24 @@ module.exports = function updateCommand(api, opts) {
1616
description: 'update package.json',
1717
usage: 'micro-app update [options]',
1818
options: {
19-
'-': 'update all.',
19+
'--all': 'update all.',
2020
'--name <name>': 'only update <name>.',
2121
},
2222
details: `
2323
Examples:
2424
${chalk.gray('# update all')}
25-
micro-app update
25+
micro-app update --all
2626
${chalk.gray('# only update <name>')}
27-
micro-app update -n <name>
27+
micro-app update --name <name>
2828
`.trim(),
2929
}, args => {
3030
const name = args.name;
31-
return updateMicro(api, name);
31+
const isAll = args.all;
32+
return updateMicro(api, name, isAll);
3233
});
3334
};
3435

35-
function updateMicro(api, name) {
36+
function updateMicro(api, name, isAll) {
3637
const logger = api.logger;
3738
const microAppConfig = api.selfConfig;
3839
const micros = api.micros;
@@ -64,7 +65,7 @@ function updateMicro(api, name) {
6465
}
6566
}
6667
}
67-
} else if (!_name) { // all
68+
} else if (isAll) { // all
6869
const gitPaths = _micros.map(key => {
6970
const microConfig = microsConfig[key];
7071
if (microConfig) {
@@ -97,7 +98,7 @@ function updateMicro(api, name) {
9798
}
9899

99100
logger.logo(`${chalk.green('Finish!')}`);
100-
} else {
101+
} else if (_name) {
101102
logger.error('[update]', `Not Found micros: "${_name}"`);
102103
}
103104

0 commit comments

Comments
 (0)