1 |
|
2 |
|
3 | ;
|
4 |
|
5 | /**
|
6 | * @license
|
7 | * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
8 | * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
9 | * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
10 | * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
11 | * Code distributed by Google as part of the polymer project is also
|
12 | * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
13 | */
|
14 | process.title = 'polymer';
|
15 |
|
16 | /*
|
17 | * NOTE: The contents of this file should work on as many version of Node.js
|
18 | * as possible. This means it *can not* use any >ES5 syntax and features.
|
19 | * Other files, which may use >=ES2015 syntax, should only be loaded
|
20 | * asynchronously after this version check has been performed.
|
21 | */
|
22 |
|
23 | // NOTE 04-21-2017: Confirmed "semver" supports Node versions as low as 0.10
|
24 | var semver = require('semver');
|
25 | var version = require('../package.json').engines.node;
|
26 |
|
27 | // Exit early if the user's node version is too low.
|
28 | if (!semver.satisfies(process.version, version)) {
|
29 | // Strip version range characters leaving the raw semantic version for output
|
30 | var rawVersion = version.replace(/[^\d\.]*/, '');
|
31 | console.log(
|
32 | 'Polymer CLI requires at least Node v' + rawVersion + '. ' +
|
33 | 'You have ' + process.version + '.\n' +
|
34 | 'See https://www.polymer-project.org/2.0/docs/tools/node-support ' +
|
35 | 'for details.');
|
36 | process.exit(1);
|
37 | }
|
38 |
|
39 | // Ok, safe to load ES2015.
|
40 | require('../lib/run');
|