-
Notifications
You must be signed in to change notification settings - Fork 797
/
build
executable file
·74 lines (63 loc) · 1.64 KB
/
build
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env node
if (!require('assert').strict) {
console.error("We require Node.js version 10 or later; you're using " + process.version);
process.exit(1);
}
var execSync = require('child_process').execSync;
var fs = require('fs');
process.chdir(__dirname);
try {
require.resolve('@babel/core');
} catch (e) {
console.log('Installing dependencies...');
execSync('npm install', {stdio: 'inherit'});
}
try {
require.resolve('./config/config');
} catch (err) {
if (err.code !== 'MODULE_NOT_FOUND') throw err; // should never happen
console.log('config.js does not exist. Creating one with default settings...');
fs.writeFileSync(
'config/config.js',
fs.readFileSync('config/config-example.js')
);
}
var options = {cwd: __dirname, stdio: 'inherit'};
var full = '';
switch (process.argv[2] || '') {
case 'full':
execSync(`node ./build-tools/build-indexes`, options);
execSync(`node ./build-tools/build-learnsets`, options);
execSync(`node ./build-tools/build-minidex`, options);
full = ' full';
break;
case 'indexes':
execSync(`node ./build-tools/build-indexes`, options);
break;
case 'learnsets':
execSync(`node ./build-tools/build-learnsets`, options);
break;
case 'minidex':
case 'sprites':
execSync(`node ./build-tools/build-minidex`, options);
break;
case 'replays':
execSync(`node ./replays/build`, options);
process.exit();
break;
case 'test-only':
break;
case '':
break;
default:
console.log(`Unrecognized command ${process.argv[2]}`);
process.exit();
break;
}
execSync(`node ./build-tools/update` + full, options);
if (full) {
try {
fs.statSync('./replays/build');
execSync(`node ./replays/build`, options);
} catch (e) {}
}