Skip to content

Commit

Permalink
fix(cli): keep code clean
Browse files Browse the repository at this point in the history
  • Loading branch information
dlhandsome authored and Gcaufy committed Oct 22, 2018
1 parent af5323e commit 59e70db
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 21 deletions.
2 changes: 1 addition & 1 deletion packages/cli/core/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ exports = module.exports = class Hook {
let argLength = args.length;

if (hooks.length === 0) {
return args.length === 1 ? Promise.resolve(args[0]) : Promise.resolve(args);
return Promise.resolve(argLength === 1 ? args[0] : args);
}

return new Promise((resolve, reject) => {
Expand Down
4 changes: 0 additions & 4 deletions packages/cli/core/plugins/parser/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ const path = require('path');
const loaderUtils = require('loader-utils');

exports = module.exports = function () {
this.register('before-wepy-parser-config', function ({ node, ctx } = {}) {
return Promise.resolve({ node, ctx });
});

this.register('wepy-parser-config', function (rst, ctx) {
if (!rst) {
return {
Expand Down
4 changes: 0 additions & 4 deletions packages/cli/core/plugins/parser/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ exports = module.exports = function () {
});
});

this.register('before-wepy-parser-script', function ({ node, ctx } = {}) {
return Promise.resolve({ node, ctx });
});

this.register('wepy-parser-script', function (node, ctx) {
let assets = this.assets;
let npmModules = this.npm;
Expand Down
4 changes: 0 additions & 4 deletions packages/cli/core/plugins/parser/style.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
exports = module.exports = function () {
this.register('before-wepy-parser-style', function ({ node, ctx } = {}) {
return Promise.resolve({ node, ctx });
});

this.register('wepy-parser-style', function (node, ctx) {
return Promise.resolve(node.compiled);
});
Expand Down
4 changes: 0 additions & 4 deletions packages/cli/core/plugins/parser/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ const xmllint = require('../../util/xmllint');
const errorHandler = require('../../util/error');

exports = module.exports = function () {
this.register('before-wepy-parser-template', function ({ node, ctx } = {}) {
return Promise.resolve({ node, ctx });
});

this.register('wepy-parser-template', function (node, ctx) {
let code = node.content;
let msg = xmllint.verify(code);
Expand Down
4 changes: 0 additions & 4 deletions packages/cli/core/plugins/parser/wxs.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
const path = require('path');

exports = module.exports = function () {
this.register('before-wepy-parser-wxs', function ({ node, ctx } = {}) {
return Promise.resolve({ node, ctx });
});

this.register('wepy-parser-wxs', function (node, ctx) {

let moduleId = node.attrs.module;
Expand Down

0 comments on commit 59e70db

Please sign in to comment.