-
Notifications
You must be signed in to change notification settings - Fork 657
/
ionic
executable file
·73 lines (55 loc) · 1.87 KB
/
ionic
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
66
67
68
69
70
71
72
73
#!/usr/bin/env node
'use strict';
// IMPORTANT: This file uses ES5 syntax to avoid syntax errors in older Node
// versions (mostly 0.12). See https://node.green for syntax support.
process.title = 'ionic';
process.on('unhandledRejection', function(r) { process.stderr.write(String(r)); process.exit(1); });
var events = require('events');
var path = require('path');
var evt = new events.EventEmitter();
var cli;
process.on('message', function(msg) {
evt.once('ready', function() {
cli.receive(msg);
});
});
var semver = require('semver');
var version = semver.parse(process.version);
var minversion = 'v16.0.0';
if (semver.lt(version, minversion)) {
var details = version.major === 10
? ' Node.js 10 reached end-of-life on 2021-04-30 and is no longer supported.'
: version.major === 12
? ' Node.js 12 reached end-of-life on 2022-04-30 and is no longer supported.'
: version.major === 14
? ' Node.js 14 reached end-of-life on 2023-04-30 and is no longer supported.'
: '';
process.stderr.write('ERR: Your Node.js version is ' + version.raw + '.' + details + ' Please update to the latest Node LTS version.\n');
process.exit(1);
}
if (process.argv.includes('--verbose')) {
process.env.DEBUG = '*';
}
if (process.argv.includes('--no-color')) {
process.env.DEBUG_COLORS = '0';
}
var pargv = process.argv.slice(2);
var lib = path.resolve(__dirname, '..');
process.env.IONIC_CLI_BIN = __filename;
process.env.IONIC_CLI_LIB = lib;
var bootstrap = require(path.resolve(lib, 'bootstrap'));
bootstrap.detectLocalCLI()
.then(function(localPath) {
cli = require(localPath);
return cli.run(pargv, process.env);
}, function(err) {
cli = require(lib);
if (typeof err !== 'string') {
throw err;
}
process.env.IONIC_CLI_LOCAL_ERROR = err;
return cli.run(pargv, process.env);
})
.then(function() {
evt.emit('ready');
});