This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
index.js
65 lines (59 loc) · 1.57 KB
/
index.js
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*jshint node: true*/
'use strict';
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const config = require('./config/sky-pages/sky-pages.config');
// Used to suppress logging unless it's a known command
function getConfig(command) {
return config.getSkyPagesConfig(command);
}
module.exports = {
runCommand: (command, argv) => {
const shorthand = {
f: 'force',
l: 'launch',
b: 'browser',
s: 'serve'
};
// Process shorthand flags
Object.keys(shorthand).forEach(key => {
if (argv[key]) {
argv[shorthand[key]] = argv[key];
}
});
switch (command) {
case 'build':
require('./cli/build')(argv, getConfig(command), webpack);
break;
case 'build-public-library':
require('./cli/build-public-library')(getConfig(command), webpack);
break;
case 'e2e':
require('./cli/e2e')(command, argv, getConfig(command), webpack);
break;
case 'serve':
require('./cli/serve')(argv, getConfig(command), webpack, WebpackDevServer);
break;
case 'lint':
require('./cli/lint')();
break;
case 'pact':
require('./cli/pact')(command, argv);
break;
case 'test':
case 'watch':
require('./cli/test')(command, argv);
break;
case 'version':
require('./cli/version')();
break;
case 'generate':
case 'g':
require('./cli/generate')(argv);
break;
default:
return false;
}
return true;
}
};