mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-10-24 11:10:46 -05:00
Support non-full builds in testclient
Non-Preact testclients don't deal well with non-full builds anymore, now that battledata includes data/text.js. This fixes it so that they're usable (although no longer being able to edit battle-dex etc without an initial full build still sucks, it's unavoidable).
This commit is contained in:
@@ -107,20 +107,24 @@ compiledFiles += compiler.compileToDir(`replay.pokemonshowdown.com/src`, `replay
|
||||
|
||||
compiledFiles += compiler.compileToDir(`teams.pokemonshowdown.com/src`, `teams.pokemonshowdown.com/js`, compileOpts);
|
||||
|
||||
compiledFiles += compiler.compileToFile(
|
||||
[
|
||||
'play.pokemonshowdown.com/src/battle-dex.ts',
|
||||
'play.pokemonshowdown.com/src/battle-dex-data.ts',
|
||||
'play.pokemonshowdown.com/src/battle-log.ts',
|
||||
'play.pokemonshowdown.com/src/battle-log-misc.js',
|
||||
'caches/pokemon-showdown/server/chat-formatter.ts',
|
||||
'play.pokemonshowdown.com/data/text.js',
|
||||
'play.pokemonshowdown.com/data/text-afd.js',
|
||||
'play.pokemonshowdown.com/src/battle-text-parser.ts',
|
||||
],
|
||||
'play.pokemonshowdown.com/js/battledata.js',
|
||||
compileOpts
|
||||
);
|
||||
try {
|
||||
fs.statSync('play.pokemonshowdown.com/data/text.js');
|
||||
// text.js exists, we can compile battledata
|
||||
compiledFiles += compiler.compileToFile(
|
||||
[
|
||||
'play.pokemonshowdown.com/src/battle-dex.ts',
|
||||
'play.pokemonshowdown.com/src/battle-dex-data.ts',
|
||||
'play.pokemonshowdown.com/src/battle-log.ts',
|
||||
'play.pokemonshowdown.com/src/battle-log-misc.js',
|
||||
'caches/pokemon-showdown/server/chat-formatter.ts',
|
||||
'play.pokemonshowdown.com/data/text.js',
|
||||
'play.pokemonshowdown.com/data/text-afd.js',
|
||||
'play.pokemonshowdown.com/src/battle-text-parser.ts',
|
||||
],
|
||||
'play.pokemonshowdown.com/js/battledata.js',
|
||||
compileOpts
|
||||
);
|
||||
} catch {}
|
||||
|
||||
if (!compileOpts.ignore) {
|
||||
compiledFiles += compiler.compileToFile(
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<script>
|
||||
function loadRemoteData(src) {
|
||||
var scriptEl = document.createElement('script');
|
||||
scriptEl.src = src.replace(/.*\/data\//g, 'https://play.pokemonshowdown.com/data/');
|
||||
scriptEl.src = src.replace(/.*\/(data|js)\//g, 'https://play.pokemonshowdown.com/$1/');
|
||||
document.head.appendChild(scriptEl);
|
||||
}
|
||||
Config.testclient = true;
|
||||
@@ -86,12 +86,12 @@
|
||||
|
||||
<!-- fallback for if you've never done a full build -->
|
||||
<script src="js/server/chat-formatter.js" onerror="loadRemoteData(this.src)"></script>
|
||||
<script src="js/battledata.js" onerror="alert('You must build the client with `node build` before using testclient.html')"></script>
|
||||
<script src="js/battledata.js" onerror="loadRemoteData(this.src)"></script>
|
||||
<script src="data/text.js" onerror="loadRemoteData(this.src)"></script>
|
||||
<script src="data/pokedex-mini.js" onerror="loadRemoteData(this.src)"></script>
|
||||
<script src="data/pokedex-mini-bw.js" onerror="loadRemoteData(this.src)"></script>
|
||||
<script src="data/typechart.js" onerror="loadRemoteData(this.src)"></script>
|
||||
<script src="js/battle.js"></script>
|
||||
<script src="js/battle.js" onerror="alert('You must build the client with `node build` before using testclient.html')"></script>
|
||||
<script src="js/lib/sockjs-1.4.0-nwjsfix.min.js"></script>
|
||||
<script src="js/lib/color-thief.min.js"></script>
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
<script src="../play.pokemonshowdown.com/js/lib/jquery-1.11.0.min.js"></script>
|
||||
<script src="../play.pokemonshowdown.com/js/lib/html-sanitizer-minified.js"></script>
|
||||
<script src="../play.pokemonshowdown.com/js/battle-sound.js"></script>
|
||||
<script src="../play.pokemonshowdown.com/js/battledata.js"></script>
|
||||
<script src="../play.pokemonshowdown.com/js/battledata.js" onerror="loadRemoteData(this.src)"></script>
|
||||
<script src="../play.pokemonshowdown.com/data/pokedex-mini.js" onerror="loadRemoteData(this.src)"></script>
|
||||
<script src="../play.pokemonshowdown.com/data/pokedex-mini-bw.js" onerror="loadRemoteData(this.src)"></script>
|
||||
<script src="../play.pokemonshowdown.com/data/graphics.js" onerror="loadRemoteData(this.src)"></script>
|
||||
|
||||
Reference in New Issue
Block a user