Files
Mia 3ff8ccc8b0 Add sets to build-tools
(Zarel refactored it to modern build-tool syntax.)

---------

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2026-06-24 06:42:03 +00:00

31 lines
865 B
JavaScript
Executable File

#!/usr/bin/env node
import * as child_process from 'node:child_process';
import * as fs from 'node:fs';
import * as path from 'node:path';
process.chdir(import.meta.dirname);
const shell = cmd => child_process.execSync(cmd, {
cwd: path.resolve('../caches/pokemon-showdown/'),
});
shell("node build");
console.log('Creating set files...');
shell("node tools/set-import/index.js 1.0.0");
console.log('Set files created. Moving...');
const targetDir = path.resolve('../play.pokemonshowdown.com/data/sets/');
fs.mkdirSync(targetDir, { recursive: true });
const dir = path.resolve("../caches/pokemon-showdown/tools/set-import/sets");
const files = fs.readdirSync(dir);
for (const file of files) {
if (file.endsWith('.json')) {
fs.renameSync(path.join(dir, file), path.join(targetDir, file));
}
}
console.log("DONE. " + files.length + " sets files moved.");