mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-08-20 10:02:05 -05:00
(Zarel refactored it to modern build-tool syntax.) --------- Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
31 lines
865 B
JavaScript
Executable File
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.");
|