Skip to content

Commit b3b84a1

Browse files
committed
opti: yapi-cli to yapi and fix install plugin findPlugin name bug
1 parent eef7768 commit b3b84a1

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "yapi-cli",
3-
"version": "1.1.5",
3+
"version": "1.1.6@rc",
44
"description": "",
55
"main": "index.js",
66
"bin": {
7-
"yapi-cli": "./bin/yapi-cli",
8-
"yapi" : "./bin/yapi-cli"
7+
"yapi": "./bin/yapi-cli",
8+
"yapi-cli": "./bin/yapi-cli"
99
},
1010
"scripts": {
1111
"test": "echo \"Error: no test specified\" && exit 1"

src/commands/plugin.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,14 @@ module.exports = {
3535
}
3636

3737
let pluginName = name.substr('yapi-plugin-'.length)
38-
if (_.find(config.plugins, { name: pluginName })) {
39-
throw new Error('此插件已安装');
40-
} else if (_.find(config.plugins, p=> p == pluginName)) {
38+
if (_.find(config.plugins, plugin=>{
39+
if(!plugin) return null;
40+
if(typeof plugin === 'string'){
41+
return plugin == pluginName;
42+
}else if(typeof plugin === 'object'){
43+
return plugin.name == pluginName
44+
}
45+
})) {
4146
throw new Error('此插件已安装');
4247
}
4348
shell.cd('vendors');

0 commit comments

Comments
 (0)