-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·37 lines (31 loc) · 894 Bytes
/
index.js
File metadata and controls
executable file
·37 lines (31 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict';
const BbPromise = require('bluebird');
const colors = require('colors/safe');
const getArgs = require('./lib/get-args');
const tools = {
'build': require('./lib/build'),
'bundle': require('./lib/bundle'),
'clean': require('./lib/clean'),
'copy': require('./lib/copy'),
'image': require('./lib/image'),
'serve': require('./lib/serve'),
};
const argv = process.argv.slice(
process.argv.findIndex(a => /ec-tools/.test(a)) + 1
);
function startTools(extra) {
if (argv.length === 0 || argv[0] === 'help') {
console.log('Usage TODO');
return BbPromise.reject();
}
return getArgs(argv.slice(1))
.then(args => Object.assign(args, { tool: argv[0] }, extra))
.then(args => {
if (args.tool && tools[args.tool]) {
args.tool = tools[args.tool];
}
return args;
});
}
startTools.tools = tools;
module.exports = startTools;