1 | #!/usr/bin/env node
|
2 | "use strict";
|
3 | Object.defineProperty(exports, "__esModule", { value: true });
|
4 | const lib_1 = require("../lib");
|
5 | const args_1 = require("./lib/args");
|
6 | const main = () => Promise.resolve()
|
7 |
|
8 | .then(args_1.parse)
|
9 |
|
10 | .then(({ action, format, stats, ignoredPackages, bail }) => lib_1.actions(action, { stats, ignoredPackages }).then((instance) =>
|
11 |
|
12 | instance.template.render(format)
|
13 | .then((out) => {
|
14 |
|
15 | console.log(out);
|
16 |
|
17 | if (!bail) {
|
18 | return Promise.resolve();
|
19 | }
|
20 |
|
21 | return instance.shouldBail().then((shouldBail) => {
|
22 | if (shouldBail) {
|
23 | throw new Error(`Issues found in action: ${action}`);
|
24 | }
|
25 | });
|
26 | })))
|
27 | .catch((err) => {
|
28 |
|
29 | console.error(err.stack || err.toString());
|
30 | process.exit(1);
|
31 | });
|
32 | if (require.main === module) {
|
33 | main();
|
34 | }
|