Skip to content

Commit 126be1b

Browse files
committed
✨ add options
1 parent 44b6540 commit 126be1b

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333
},
3434
"license": "MIT",
3535
"peerDependencies": {
36-
"@micro-app/cli": ">=0.1.4",
37-
"@micro-app/core": ">=0.1.4",
38-
"@micro-app/plugin-webpack-adapter": ">=0.0.4",
36+
"@micro-app/cli": ">=0.1.6",
37+
"@micro-app/core": ">=0.1.7",
38+
"@micro-app/plugin-webpack-adapter": ">=0.0.5",
3939
"vue-template-compiler": "^2.0.0"
4040
},
4141
"devDependencies": {
42-
"@micro-app/cli": "^0.1.4-beta.1",
43-
"@micro-app/core": "^0.1.4-beta.1",
44-
"@micro-app/plugin-webpack-adapter": "^0.0.3",
42+
"@micro-app/cli": "^0.1.6",
43+
"@micro-app/core": "^0.1.7",
44+
"@micro-app/plugin-webpack-adapter": "^0.0.5",
4545
"@types/jest": "^24.0.18",
4646
"babel-eslint": "^10.0.3",
4747
"coveralls": "^3.0.6",

src/buildInPlugins.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ module.exports = function(api, opts = {}) {
2121
/**
2222
* Generate a cache identifier from a number of variables
2323
*/
24-
api.extendMethod('genCacheConfig', (id, partialIdentifier, configFiles = []) => {
24+
api.extendMethod('genCacheConfig', {
25+
description: 'Generate a cache identifier from a number of variables',
26+
}, (id, partialIdentifier, configFiles = []) => {
2527
const fs = require('fs');
2628
const cacheDirectory = api.resolve(`node_modules/.cache/${id}`);
2729

@@ -83,8 +85,6 @@ module.exports = function(api, opts = {}) {
8385
const hash = require('hash-sum');
8486
const cacheIdentifier = hash(variables);
8587
return { cacheDirectory, cacheIdentifier };
86-
}, {
87-
description: 'Generate a cache identifier from a number of variables',
8888
});
8989

9090
require('./methods.js')(api, projectOptions);

src/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ module.exports = function VueCLIAdapter(api, opts = {}) {
1010
require('./commands/version')(api);
1111

1212
// Current working directory.
13-
api.extendMethod('getCwd', () => {
14-
return opts.root || api.root;
15-
}, {
13+
api.extendMethod('getCwd', {
1614
description: 'Current working directory.',
15+
}, () => {
16+
return opts.root || api.root;
1717
});
1818

1919
/**
@@ -22,11 +22,11 @@ module.exports = function VueCLIAdapter(api, opts = {}) {
2222
* @param {string} _path - Relative path from project root
2323
* @return {string} The resolved absolute path.
2424
*/
25-
api.extendMethod('resolve', _path => {
25+
api.extendMethod('resolve', {
26+
description: 'Resolve path for a project.',
27+
}, _path => {
2628
const context = api.getCwd();
2729
return path.resolve(context, _path);
28-
}, {
29-
description: 'Resolve path for a project.',
3030
});
3131

3232
api.registerMethod('chainWebpack', {

src/methods.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ const fs = require('fs');
66
module.exports = function Methods(api, projectOptions) {
77

88
// 针对 vue plugin 的注册
9-
api.extendMethod('registerVuePlugin', options => {
9+
api.extendMethod('registerVuePlugin', {
10+
description: '针对 vue-cli plugin 的注册方法.',
11+
}, options => {
1012
const { id, opts = {}, link, apply } = options;
1113
assert(id, 'id must supplied');
1214
assert(typeof id === 'string', 'id must be string');
@@ -25,11 +27,11 @@ module.exports = function Methods(api, projectOptions) {
2527
id: `vue-service:plugins-${id}`,
2628
opts: Object.assign({}, projectOptions, opts), // vue.config.js
2729
});
28-
}, {
29-
description: '针对 vue-cli plugin 的注册方法.',
3030
});
3131

32-
api.extendMethod('registerVueCommand', (name, opts, fn) => {
32+
api.extendMethod('registerVueCommand', {
33+
description: '针对 vue-cli command 的注册方法.',
34+
}, (name, opts, fn) => {
3335
assert(name, 'name must supplied');
3436
assert(typeof name === 'string', 'name must be string');
3537
switch (name) {
@@ -80,8 +82,6 @@ module.exports = function Methods(api, projectOptions) {
8082
break;
8183
}
8284
api.registerCommand(`vue-service-${name}`, opts, fn);
83-
}, {
84-
description: '针对 vue-cli command 的注册方法.',
8585
});
8686

8787
};

0 commit comments

Comments
 (0)