Commit Graph

47 Commits

Author SHA1 Message Date
Slayer95
19d279c9b5
CLI: Update to use util.parseArgs (#11245)
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
---------

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2025-07-17 05:06:26 -07:00
Slayer95
7d8f01f849
Remove build on postinstall (#11244)
- Errors in the node build script will no longer cause a false perception
that dependencies cannot be installed.
- Simplifies 1cea3f39cb
2025-07-14 13:34:46 -07:00
Guangcong Luo
78439b4a02
Update to ESLint 9 (#10926)
ESLint has a whole new config format, so I figure it's a good time to
make the config system saner.

- First, we no longer have separate eslint-no-types configs. Lint
  performance shouldn't be enough of a problem to justify the
  relevant maintenance complexity.

- Second, our base config should work out-of-the-box now. `npx eslint`
  will work as expected, without any CLI flags. You should still use
  `npm run lint` which adds the `--cached` flag for performance.

- Third, whatever updates I did fixed style linting, which apparently
  has been bugged for quite some time, considering all the obvious
  mixed-tabs-and-spaces issues I found in the upgrade.

Also here are some changes to our style rules. In particular:

- Curly brackets (for objects etc) now have spaces inside them. Sorry
  for the huge change. ESLint doesn't support our old style, and most
  projects use Prettier style, so we might as well match them in this way.
  See https://github.com/eslint-stylistic/eslint-stylistic/issues/415

- String + number concatenation is no longer allowed. We now
  consistently use template strings for this.
2025-02-25 20:03:46 -08:00
Guangcong Luo
1cea3f39cb
Don't rebuild if installed by NPM package 2023-04-14 11:44:52 +09:00
Guangcong Luo
dd2d151fd7
Update Node version check 2023-04-13 19:10:19 +09:00
Mia
b11177d530
Migrate to esbuild for compilation (#9203) 2022-12-22 15:19:29 -06:00
Leonard Craft III
3f58aacb31
Correct Node version documentation (#8923) 2022-10-06 11:17:38 -07:00
Guangcong Luo
f47e38c5ad Support building TS declarations
`./build decl` now builds TS declarations for everything exported by
`sim/`. Unfortunately, the built TS declarations still refer to global
types, so some things still have `any` type, but it's much better than
nothing.
2021-06-09 17:51:49 -05:00
Guangcong Luo
4f32736bdd Clean mods/ and chat-plugins/ when building
Previously, if you deleted a file from `data/mods/`, it wouldn't also
get deleted from `.data-dist/mods/`. This fixes that, and the
corresponding issue in `server/chat-plugins/`.

For reasons of performance and/or laziness, I've chosen to only clean
those two directories, not all built directories.
2021-04-07 01:33:10 -07:00
Guangcong Luo
6e281dbe31 Move build-utils from lib to tools
The current idea is for `lib` to contain shared libraries useful to
many projects. `build-utils` is specific to this repo and so doesn't go
there.
2020-12-26 10:08:30 -08:00
Guangcong Luo
3cbf3f8a30 Fix build
Building from a fresh install currently fails since #7797

The problem is that `require('sucrase')` needs to be done _after_
sucrase is installed, which is a lot harder than it sounds.
2020-12-26 10:04:41 -08:00
Instruct
5b441c2013
Super Staff Bros 4 (#7793)
Collaborative Project lead by @xInstruct with many contributors.

See the Special Thanks section of https://www.smogon.com/articles/super-staff-bros-4
2020-12-24 11:21:02 -05:00
Adam Tran
c7c5f4253b
Support generating sourceMaps for source debugging (#7797) 2020-12-13 19:42:19 -08:00
Annika
aa069ce8fd
Support disabling modlogs (#7619)
Co-authored-by: Christopher Monsanto <chris@monsan.to>
2020-11-02 22:59:31 -05:00
Annika
f7a291df78 Build: Update dependency check 2020-10-31 14:34:44 -07:00
Annika
a3b83ba50b
Translations: Convert JSON to TypeScript (#7493) 2020-10-09 12:03:44 -07:00
Guangcong Luo
2bcea34447 Support ./pokemon-showdown simulate-battle -S
simulate-battle now has a new option: --spectate.

As a recap:

-D --debug: simulate in debug mode

-R --replay: output only the omniscient (debug) replay, rather than the
  full stream

-S --spectate: output only the spectator replay, rather than the full
  stream
2020-09-29 15:28:07 -07:00
Annika
f1b4e3d43a
Modlog: Refactor to use ModlogEntry objects (#7403) 2020-09-28 11:06:30 -07:00
Guangcong Luo
a315c93836 Switch to using import type
We were previously using `type Foo = import('bar').Foo` which works
actually equally well, because sucrase didn't support `import type`,
but now it does!
2020-08-09 08:07:00 -05:00
Guangcong Luo
23a4b11430 Support ./build --force 2020-06-05 10:48:23 -07:00
Guangcong Luo
c925c15070 Support incremental builds 2020-06-05 10:38:27 -07:00
Kris Johnson
a7948c7c9c
Typescript config/ (#6760) 2020-05-29 19:34:43 -07:00
The Immortal
ec4bb6cb4d Add CAP 1v1 format 2020-05-16 08:11:54 +04:00
Guangcong Luo
6d5ea45adf Fix misc bugs preventing build 2020-05-01 12:48:54 -07:00
Guangcong Luo
cbbd14572d Change working directory of build script
The build script currently needs to add `__dirname` everywhere. It's
much easier just to do a `process.chdir(__dirname)` at the top.
2020-05-01 11:56:54 -07:00
Christopher Monsanto
802a480af5 Make build relative to __dirname 2020-04-23 12:56:25 -04:00
Kris Johnson
28bf388b98
Typescript data (#6553) 2020-04-23 09:16:09 -07:00
Kirk Scheibelhut
37a331a4cb Get tools/set-import to work again
- a scripts.js init() method now calls toID
- Smogon updated the format of moveslots
2020-02-25 14:49:38 -08:00
Guangcong Luo
224fce2ed4 Update dependency check for sucrase
We try to feature-detect for dependencies, but this one is hard and
I don't want to actually do an actual sucrase compile to check if it's
up to date, hence digging through its version number. Too bad they
added a major feature in a minor version, complicating the check. :/
2020-02-12 15:57:27 -08:00
Kirk Scheibelhut
b9e5fcb387
Introduce set importer logic (#5749)
`node tools/set-import [version]` can be run to create a
`@pokemon-showdown/sets` package containing sets from Smogon, usage
stats and third party sources. Some notes:

- The build is set up so that `tools/set-import/importer.ts` is
  compiled to `tools/set-import/importer.js` - creating a
  `.tools-dist/set-import` directory for the sole artifact was
  deemed to be overkill
- The sets package is generated such that it can be used easily on
  Node or in a browser (where the large set JSON can be loaded
  asynchronously)
- Supported tiers/formats are mostly arbitrary - those popular
  enough to have a signficant playerbase or analyses on Smogon have
  been included, but additional formats can be added based on demand
- Some set information is redundant for ease of use by downstream
  users: certain formes are split out and information that could
  theoretically be inferred like level/ability/HP IVs are included
  to simplify parsing logic and make the sets more immediately
  available. This results in what should mostly be negligible
  size overhead.
- In a similar vein, display versions of effect names instead of IDs
  are used (name -> ID is trivial, ID -> name requires data lookup)
- All sets pass validation, provided certain simple transformations
  are applied (eg. reverting `battleOnly` formes like Megas)

This tool has primarily been tested to run on Linux - running on
other platforms is not guaranteed to result in error-free output.
2019-09-10 21:15:05 -04:00
TheJetOU
4b0be1b5b4 TypeScript RoomGame and RoomBattle (#5692) 2019-08-11 17:03:36 +02:00
Kirk Scheibelhut
a9b26fce72 Typescript server/verifier.js (#5482) 2019-05-07 14:09:01 +09:30
Kirk Scheibelhut
4975f1902b Move simulator harness to sim/tools (#5451) 2019-04-18 04:17:07 +09:30
Kirk Scheibelhut
e689913084
Unify dev-tools runners and convert to Typescript (#5441)
- Refactor dev-tools/harness.js and dev-tools/smokes.js to separate
  out the script/CLI code and implementation code into separate
  files.
- Rename 'smoke' to 'exhaustive' ('multi' mode can also be used
  for "smoke testing") to better describe its behavior.
- Rewrite the runners in Typescript for type safety.
- Refactor common build utilities into dev-tools/build.js and
  introduce the notion of a 'full' build analogous to 'full' tests.
2019-04-15 15:22:37 -07:00
Konrad Borowski
525979c72d
Remove unused rewrite function from build script 2019-03-11 18:32:35 +01:00
Kirk Scheibelhut
27c6739ff7 Make builds replace safer and easier to use (#5277) 2019-03-08 13:51:52 -06:00
Guangcong Luo
83dd5650d7
Exclude devDependencies from build script 2019-03-06 13:37:49 -06:00
Kirk Scheibelhut
427f443bf8 Use async fs APIs in build (#5251) 2019-03-05 14:08:26 -06:00
Kirk Scheibelhut
b33971a3d3 Inline replace into build and remove dependency (#5248) 2019-03-04 19:36:00 -06:00
Kirk Scheibelhut
6e88eab90f Use an absolute path instead of relative path in build (#5247) 2019-03-04 18:54:37 -06:00
Kirk Scheibelhut
7cf501aec6 Use replace recursively in build. (#5245) 2019-03-04 16:28:01 -06:00
Kirk Scheibelhut
3624863551 Fix build script on Windows. (#5241)
On Windows,	`shell` doesn't glob for us and the literal
`.sim-dist/*` is passed to `replace` and it doesn't get expanded
into the list of paths.
2019-03-03 21:00:56 -05:00
Guangcong Luo
f1379b46be Fix dependency check in build script
(This error wasn't caught because it still works without installing
the dependency, but makes the build script far slower because
`npx replace` would reinstall `replace` every time it's used.)
2019-03-03 08:16:29 -06:00
Kirk Scheibelhut
6e122d5d74 Refactor lib/ to be native Typescript (#5217) 2019-03-02 11:12:24 -06:00
Guangcong Luo
5de019ac3d Fix fs.promises warning properly
The modern `__esModule` fallback isn't compatible with Node, and also
entirely unnecessary in practice.

The approach of disabling all the fallback code allows us to once again
`import * as fs`.
2019-02-28 11:49:48 -06:00
Guangcong Luo
f5a8723f1c Fix build/hotpatch process
Hotpatching and running `./pokemon-showdown` now automatically run
`./build`. There should now mostly not be any reason you'd want to
manually run `./build`, except if you're invoking tests directly.

In addition, a lot of redundant code has been removed.

I'm not 100% sure this works on Windows, but I'm sure I'll get reports
if anything breaks.
2019-02-27 01:47:44 -06:00
Kirk Scheibelhut
b09fd63377 Refactor sim/ to be native Typescript (#5210) 2019-02-26 11:03:30 -06:00