This repository has been archived by the owner on Jul 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathpostinstall.js
58 lines (46 loc) · 1.96 KB
/
postinstall.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Get the defaults
const PROPLUGINS = isenv(process.env.PROPLUGINS);
const plugin_name = process.env.npm_package_name || 'Unknown';
const CI = isenv(process.env.CI);
const COLOR = CI ? false : isenv(process.env.npm_config_color);
function isenv(val) {
return !!val && val !== '0' && val !== 'false';
}
function log(value) {
console.log(COLOR ? value : value.replace(/\u001B\[[\d|1;\d]+m/g, ''));
}
function padr(value, size) {
while(value.length < size) {
value += ' ';
}
return value;
}
function padc(value, size) {
while(value.length < size) {
value = ' ' + value + ' ';
}
return value.substr(0, size);
}
function highlight(value, color) {
if (color == null) { color = "33"; }
return "\u001B["+color+"m"+value+"\u001B[37m";
}
if (!PROPLUGINS) {
if (COLOR) { console.log('\x07'); }
log('\n\u001B[37m\u001B[1;41m--------------------------------[ \u001B[5m\u001B[33mWARNING\u001B[0m\u001B[1;41m\u001B[37m ]------------------------------------\u001B[0m');
log('\u001B[37m\u001B[1;41m'+padr('- '+highlight(plugin_name)+' is DEPRECATED and is not maintained!', 88)+'-\u001B[0m');
log('\u001B[37m\u001B[1;41m'+padr('- This plugin has NOT been tested in NS 6.x, and is likely to crash or fail!', 78)+'-\u001B[0m');
log('\u001B[37m\u001B[1;41m'+padr('- ', 78)+'-\u001B[0m');
log('\u001B[37m\u001B[1;41m'+padr('- Please switch to the supported, tested, and maintained version:', 78)+'-\u001B[0m');
log('\u001B[37m\u001B[1;41m-'+padc(highlight('@proplugins/'+plugin_name), 87)+'-\u001B[0m');
log('\u001B[37m\u001B[1;41m'+padr('- ', 78)+'-\u001B[0m');
log('\u001B[37m\u001B[1;41m'+padr('- For more information see '+highlight('https://proplugins.org/upgrade'), 88)+'-\u001B[0m');
log('\u001B[37m\u001B[1;41m-------------------------------------------------------------------------------\u001B[0m\n');
if (!COLOR) {
// console.log("\u001B[0m");
}
delay();
}
async function delay() {
await new Promise( (resolve) => { setTimeout(resolve, 5000); } );
}