UNPKG

907 BJavaScriptView Raw
1#!/usr/bin/env node
2
3/* eslint-disable no-var */
4/* eslint-disable flowtype/require-valid-file-annotation */
5'use strict';
6
7var ver = process.versions.node;
8var majorVer = parseInt(ver.split('.')[0], 10);
9
10if (majorVer < 4) {
11 console.error('Node version ' + ver + ' is not supported, please use Node.js 4.0 or higher.');
12 process.exit(1); // eslint-disable-line no-process-exit
13} else {
14 var dirPath = '../lib/';
15 var v8CompileCachePath = dirPath + 'v8-compile-cache';
16 var fs = require('fs');
17 // We don't have/need this on legacy builds and dev builds
18 if (fs.existsSync(v8CompileCachePath)) {
19 require(v8CompileCachePath);
20 }
21
22 // Just requiring this package will trigger a yarn run since the
23 // `require.main === module` check inside `cli/index.js` will always
24 // be truthy when built with webpack :(
25 var cli = require(dirPath + 'cli');
26 if (!cli.autoRun) {
27 cli.default();
28 }
29}