-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
34 lines (31 loc) · 785 Bytes
/
index.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
'use strict';
/* eslint-disable */
var color = require('cli-color');
var checkEngines = require('check-engines');
module.exports = function(exitCode, callback) {
if (typeof exitCode === 'function') {
callback = exitCode;
exitCode = undefined;
}
if (typeof exitCode !== 'number') {
exitCode = -1;
}
checkEngines(function(err) {
if (err) {
var message = err.message || '';
message.split('\n').forEach(line => {
if ((line = line.trim())) {
console.error(
color.white.bgMagenta(' Fatal ') + ' ' + color.magenta(line)
);
}
});
if (typeof callback !== 'function') {
process.exit(exitCode);
}
}
if (typeof callback === 'function') {
callback(err);
}
});
};