pokemon-showdown-client/test/check-filenames
Guangcong Luo 5d41f3ec93
Reorganize directories (#2187)
Files meant to be served have been moved into
`play.pokemonshowdown.com/` and `pokemonshowdown.com/`.

We now have three directories for the three subdomains handled by this
repo:

- `pokemonshowdown.com/`
- `play.pokemonshowdown.com/`
- `replay.pokemonshowdown.com/`

Naming them after the subdomains will make it much easier to tell where
the files for each go.

The diff is probably useless; it'll be easier if you just look at the
new tree:
https://github.com/smogon/pokemon-showdown-client/tree/reorganize
2023-11-16 03:39:29 -08:00

32 lines
845 B
JavaScript
Executable File

#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const Dex = require('../caches/pokemon-showdown/dist/sim/dex').Dex;
const dir = path.resolve(process.argv[2]);
const ext = process.argv[3];
process.chdir(`${__dirname}/..`);
const files = fs.readdirSync(dir);
for (file of files) {
if (file === '.DS_Store') {
// silently remove cruft
fs.unlinkSync(`${dir}/${file}`);
continue;
}
if (!file.endsWith(ext)) {
console.log(`${file}: bad extension`);
continue;
}
const speciesid = file.slice(0, -ext.length);
const pokemon = Dex.getTemplate(speciesid);
if (!pokemon.exists) {
console.log(`${file}: not a pokemon`);
} else if (pokemon.spriteid !== speciesid) {
console.log(`${file}: spriteid should be ${pokemon.spriteid}`);
}
}