forked from webpack/webpack-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.js
executable file
·38 lines (27 loc) · 1015 Bytes
/
cli.js
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
#!/usr/bin/env node
'use strict';
require('v8-compile-cache');
const importLocal = require('import-local');
const logger = require('./lib/utils/logger');
// Prefer the local installation of webpack-cli
if (importLocal(__filename)) {
return;
}
process.title = 'webpack';
const updateNotifier = require('update-notifier');
const packageJson = require('./package.json');
const notifier = updateNotifier({
pkg: packageJson,
updateCheckInterval: 1000 * 60 * 60 * 24 * 30, // 1 month
});
if (notifier.update) {
logger.info(`Update available: ${notifier.update.latest}`);
}
const semver = require('semver');
const version = packageJson.engines.node;
if (!semver.satisfies(process.version, version)) {
const rawVersion = version.replace(/[^\d\.]*/, '');
logger.error('webpack CLI requires at least Node v' + rawVersion + '. ' + 'You have ' + process.version + '.\n' + 'See https://webpack.js.org/ ' + 'for migration help and similar.');
process.exit(1);
}
require('./lib/bootstrap');