Fix build
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run

This commit is contained in:
Guangcong Luo
2026-09-11 22:51:35 -07:00
parent b83967e980
commit e47b8be410
4 changed files with 16 additions and 17 deletions

4
build
View File

@@ -75,8 +75,6 @@ default:
break;
}
execSync(`node ./build-tools/update` + full, options);
if (full) {
try {
execSync(`node ./build-tools/build-commands`, options);
@@ -84,3 +82,5 @@ if (full) {
console.error(e);
}
}
execSync(`node ./build-tools/update` + full, options);

View File

@@ -6,6 +6,8 @@ const child_process = require('node:child_process');
process.chdir(__dirname + '/..');
fs.mkdirSync('play.pokemonshowdown.com/data', { recursive: true });
const noUpdate = process.argv.includes('--no-update');
if (!fs.existsSync('caches/pokemon-showdown')) {
if (noUpdate) {

View File

@@ -182,7 +182,7 @@ function compileToDir(srcDir, destDir, opts = {}) {
return total;
}
function compileToFile(srcFile, destFile, opts) {
async function compileToFile(srcFile, destFile, opts) {
const incremental = opts.incremental;
delete opts.incremental;
@@ -205,12 +205,11 @@ function compileToFile(srcFile, destFile, opts) {
if (VERBOSE) console.log(src + " ->");
}
combineResults(results, {
const combined = await combineResults(results, {
file: path.basename(destFile),
sourceRoot: opts.sourceRoot,
}, opts).then(combined => {
outputFileSync(destFile, combined, opts);
});
}, opts);
outputFileSync(destFile, combined, opts);
if (VERBOSE) console.log("-> " + destFile);
if (incremental) opts.incremental = true; // incredibly dumb hack to preserve the option

View File

@@ -6,14 +6,12 @@
* It also updates news and the learnsets-g6.js file.
*/
"use strict";
import fs from 'node:fs';
import crypto from 'node:crypto';
import child_process from 'node:child_process';
import * as compiler from './compiler.mjs';
const fs = require('node:fs');
const crypto = require('node:crypto');
const child_process = require('node:child_process');
const compiler = require('./compiler.mjs');
process.chdir(__dirname + '/..');
process.chdir(import.meta.dirname + '/..');
const AUTOCONFIG_START = '/*** Begin automatically generated configuration ***/';
const AUTOCONFIG_END = '/*** End automatically generated configuration ***/';
@@ -38,7 +36,7 @@ function readOptionalFile(filename) {
process.stdout.write("Updating version... ");
let version = require('../package.json').version;
let version = JSON.parse(fs.readFileSync('package.json', UTF8)).version;
try {
let commit = child_process.execSync('git rev-parse HEAD', {
stdio: ['ignore', 'pipe', 'ignore'],
@@ -130,7 +128,7 @@ compiledFiles += compiler.compileToDir(`teams.pokemonshowdown.com/src`, `teams.p
try {
fs.statSync('play.pokemonshowdown.com/data/text/en.js');
// English text exists, we can compile battledata
compiledFiles += compiler.compileToFile(
compiledFiles += await compiler.compileToFile(
[
'play.pokemonshowdown.com/src/battle-dex.ts',
'play.pokemonshowdown.com/src/battle-teams.ts',
@@ -147,7 +145,7 @@ try {
} catch {}
if (!compileOpts.ignore) {
compiledFiles += compiler.compileToFile(
compiledFiles += await compiler.compileToFile(
['play.pokemonshowdown.com/src/battle-animations.ts', 'play.pokemonshowdown.com/src/battle-animations-moves.ts'],
'play.pokemonshowdown.com/data/graphics.js',
compileOpts