-
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathdefault.js
More file actions
42 lines (37 loc) · 1.03 KB
/
default.js
File metadata and controls
42 lines (37 loc) · 1.03 KB
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
'use strict';
const args = require('../../src/args');
const emberCliUpdate = require('../../src');
const reset = require('../../src/reset');
const stats = require('../../src/stats');
const compare = require('../../src/compare');
const codemods = require('../../src/codemods');
module.exports.command = '$0';
module.exports.builder = args;
module.exports.handler = async function handler(argv) {
try {
let result;
if (argv.reset) {
result = await reset(argv);
} else if (argv.statsOnly) {
result = { promise: stats(argv) };
} else if (argv.compareOnly) {
result = { promise: compare(argv) };
} else if (argv.listCodemods || argv.runCodemods) {
result = {
promise: codemods({
...argv,
list: argv.listCodemods,
sourceJson: argv.codemodsJson
})
};
} else {
result = await emberCliUpdate(argv);
}
let message = await result.promise;
if (message) {
console.log(message);
}
} catch (err) {
console.error(err);
}
};