Don't build graphics.js by default

graphics.js will still be built by `./build full`, and once it already
exists, `./build` will rebuild it when it's modified.

Fixes #1150
This commit is contained in:
Guangcong Luo 2018-10-16 03:25:22 -05:00
parent fb4f83a580
commit 9019543dc1
3 changed files with 29 additions and 12 deletions

9
build
View File

@ -31,12 +31,14 @@ try {
}
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);
@ -60,8 +62,11 @@ default:
break;
}
execSync(`node ./build-tools/update`, options);
execSync(`node ./build-tools/update` + full, options);
if (process.argv[2] === 'full') {
execSync(`node ../replay.pokemonshowdown.com/build`, options);
try {
fs.statSync('../replay.pokemonshowdown.com/build');
execSync(`node ../replay.pokemonshowdown.com/build`, options);
} catch (e) {}
}

View File

@ -38,7 +38,18 @@ console.log("DONE");
* Compile TS files
*********************************************************/
child_process.execSync(`node build-tools/babel-cli/bin/babel.js src --out-dir js --extensions ".ts,.tsx" --incremental`);
let ignoreGraphics = ' --ignore "src/battle-animations.js","src/battle-animations-moves.js"';
if (process.argv[2] === 'full') {
ignoreGraphics = '';
} else {
try {
fs.statSync('data/graphics.js');
// graphics.js exists, recompile it
ignoreGraphics = '';
} catch (e) {}
}
child_process.execSync(`node build-tools/babel-cli/bin/babel.js src --out-dir js --extensions ".ts,.tsx" --incremental${ignoreGraphics}`);
fs.writeFileSync(
'js/battledata.js',
@ -47,11 +58,13 @@ fs.writeFileSync(
fs.readFileSync('src/battle-dex-misc.js')
);
fs.writeFileSync(
'data/graphics.js',
fs.readFileSync('js/battle-animations.js') + '\n\n' +
fs.readFileSync('js/battle-animations-moves.js')
);
if (!ignoreGraphics) {
fs.writeFileSync(
'data/graphics.js',
fs.readFileSync('js/battle-animations.js') + '\n\n' +
fs.readFileSync('js/battle-animations-moves.js')
);
}
/*********************************************************
* Update cachebuster and News

View File

@ -14,9 +14,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<script>
function loadRemoteData(src) {
var elem = document.createElement('script');
elem.src = src.replace(/.*\/?data\//g, 'https://play.pokemonshowdown.com/data/');
document.head.appendChild(elem);
// load synchronously
document.write('<script src="' + src.replace(/.*\/?data\//g, 'https://play.pokemonshowdown.com/data/') + '"><\/script>');
}
var Config = {testclient: true};
(function() {
@ -107,7 +106,7 @@
<script src="js/client-battle.js"></script>
<script src="js/client-rooms.js"></script>
<script src="js/storage.js"></script>
<script src="data/graphics.js"></script>
<script src="data/graphics.js" onerror="loadRemoteData(this.src)"></script>
<script>
var app = new App();