1 | #!/usr/bin/env node
|
2 | 'use strict';
|
3 |
|
4 | // Provide a title to the process in `ps`.
|
5 | // Due to an obscure Mac bug, do not start this title with any symbol.
|
6 | try {
|
7 | process.title = 'ng ' + Array.from(process.argv).slice(2).join(' ');
|
8 | } catch (_) {
|
9 | // If an error happened above, use the most basic title.
|
10 | process.title = 'ng';
|
11 | }
|
12 |
|
13 | // This node version check ensures that extremely old versions of node are not used.
|
14 | // These may not support ES2015 features such as const/let/async/await/etc.
|
15 | // These would then crash with a hard to diagnose error message.
|
16 | // tslint:disable-next-line: no-var-keyword
|
17 | var version = process.versions.node.split('.').map(part => Number(part));
|
18 | if (version[0] < 10 || version[0] === 11 || (version[0] === 10 && version[1] < 13)) {
|
19 | console.error(
|
20 | 'Node.js version ' + process.version + ' detected.\n' +
|
21 | 'The Angular CLI requires a minimum Node.js version of either v10.13 or v12.0.\n\n' +
|
22 | 'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n'
|
23 | );
|
24 |
|
25 | process.exitCode = 3;
|
26 | } else {
|
27 | require('../lib/init');
|
28 | }
|