forked from botkalista/ayaya-league-external
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare.js
41 lines (24 loc) · 1.33 KB
/
prepare.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
const child = require('child_process');
main();
function main() {
//* Check node version
const nodeVersion = child.execSync('node -v').toString().trim();
if (nodeVersion != 'v16.10.0') return console.error(`NODE VERSION INSTALLED:\t${nodeVersion}\nNODE VERSION REQUIRED:\tv16.10.0`);
const nodeArch = child.execSync('node -p "process.arch"').toString().trim();
if (nodeArch != 'ia32') return console.error(`NODE ARCH INSTALLED:\t${nodeArch}\nNODE ARCH REQUIRED:\tia32`);
//* install tsc and typescript globally
console.log('Installing tsc');
try { child.execSync('npm i -g tsc', { stdio: 'ignore' }); } catch (ex) { }
console.log('Installing typescript');
try { child.execSync('npm i -g typescript', { stdio: 'ignore' }); } catch (ex) { }
//* install dependencies
console.log('Installing dependencies');
try { child.execSync('npm i', { stdio: 'ignore' }); } catch (ex) { }
try { child.execSync('npm i --save-dev', { stdio: 'ignore' }); } catch (ex) { }
//* rebuild modules for current platform
console.log('Rebuilding module 1/2');
try { child.execSync('npm run rebuild-dep-m', { stdio: 'ignore' }); } catch (ex) { }
console.log('Rebuilding module 2/2');
try { child.execSync('npm run rebuild-dep-a', { stdio: 'ignore' }); } catch (ex) { }
console.log('Completed');
}