Skip to content

Commit

Permalink
Compile chat-formatter from server
Browse files Browse the repository at this point in the history
This is the point at which all these refactors to the build system pay
off: we can now directly share code from server. First off:
chat-formatter is now built directly from the server!
  • Loading branch information
Zarel committed Apr 13, 2021
1 parent 33e6c55 commit c24cbd6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
13 changes: 10 additions & 3 deletions build-tools/update
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,19 @@ process.stdout.write("Compiling TS files... ");
let compileStartTime = process.hrtime();
let compiledFiles = 0;

let compileOpts = {
// Babel can't find babelrc if we try to compile stuff in data/pokemon-showdown/ fsr
let compileOpts = Object.assign(eval('(' + fs.readFileSync('.babelrc') + ')'), {
babelrc: false,
incremental: true,
ignore: ['src/battle-animations.js', 'src/battle-animations-moves.js'],
};
});
if (process.argv[2] === 'full') {
delete compileOpts.ignore;
compiler.compileToDir(
['data/pokemon-showdown/server/chat-formatter.ts'],
'js/server/',
compileOpts
);
} else {
try {
fs.statSync('data/graphics.js');
Expand All @@ -96,7 +103,7 @@ compiledFiles += compiler.compileToDir(`src`, `js`, compileOpts);
compiledFiles += compiler.compileToDir(`src`, `js`, compileOpts);

compiledFiles += compiler.compileToFile(
['src/battle-dex.ts', 'src/battle-dex-data.ts', 'src/battle-log.ts', 'src/battle-log-misc.js', 'data/text.js', 'src/battle-text-parser.ts'],
['src/battle-dex.ts', 'src/battle-dex-data.ts', 'src/battle-log.ts', 'src/battle-log-misc.js', 'data/pokemon-showdown/server/chat-formatter.ts', 'data/text.js', 'src/battle-text-parser.ts'],
'js/battledata.js',
compileOpts
);
Expand Down
14 changes: 0 additions & 14 deletions src/battle-log-misc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions testclient.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ <h3><button class="closebutton" tabindex="-1" aria-label="Close"><i class="fa fa
window.exports = window;
</script>

<!-- fallback for if you've never done a full build -->

This comment has been minimized.

Copy link
@urkerab

urkerab Dec 27, 2024

Contributor

This doesn't actually work though because loadRemoteData only works for files in data/.

<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="data/text.js" onerror="loadRemoteData(this.src)"></script>
<script src="data/pokedex-mini.js" onerror="loadRemoteData(this.src)"></script>
Expand Down

0 comments on commit c24cbd6

Please sign in to comment.