1 | #!/usr/bin/env node
|
2 | 'use strict';
|
3 |
|
4 | const ver = process.versions.node;
|
5 | const majorVer = parseInt(ver.split('.')[0], 10);
|
6 |
|
7 | if (majorVer < 8) {
|
8 | console.error('Node version ' + ver + ' is not supported, please use Node.js 8.0 or higher.');
|
9 | process.exit(1);
|
10 | }
|
11 |
|
12 | let hasBundled = true
|
13 |
|
14 | try {
|
15 | require.resolve('./index.bundled.js');
|
16 | } catch(err) {
|
17 |
|
18 |
|
19 | hasBundled = false;
|
20 | }
|
21 |
|
22 | const cli = !hasBundled ? require('../') : require('./index.bundled.js');
|
23 |
|
24 | if (cli.autoRun) {
|
25 | return;
|
26 | }
|
27 |
|
28 | const run = cli.run || cli.cli || cli.default;
|
29 | run(process.argv).catch(function (error) {
|
30 | console.error(error.stack || error.message || error);
|
31 | process.exitCode = 1;
|
32 | });
|