Commit Graph

38 Commits

Author SHA1 Message Date
Slayer95
b0dc94f196
Further update tests after startup refactor (#11521)
- Adds config.lazysockets to prevent listening to the network
- Fixes modlog tests
2026-01-25 07:58:21 -05:00
Sergio Garcia
13aa6355af
Fix various typos (#11607) 2025-12-08 18:38:02 -06:00
Mia
debd7bebc3 Fix crash on startup
Chat being loaded after roomlogs causes a crash in room initialization.
2025-10-19 23:26:20 -05:00
Slayer95
4b8c6a4d6d
Refactor startup (#11346)
Some checks failed
Node.js CI / build (18.x) (push) Has been cancelled
This minimizes side effects of import/require across the codebase,
and lets the caller be responsible of initializing child processeses,
as well as other async logic, such as restoring saved battles.
2025-10-17 19:37:47 -07:00
Mia
d1efa30cf4 Fix TeamValidatorAsync global
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
2025-08-11 15:31:42 -05:00
Slayer95
018ea4abef
Support running PS in a single process again (#11331)
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
2025-08-07 00:29:18 -07:00
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
0b6c1dbeec
Make some dependencies optional: probe-image-size, source-map-support (#11247) 2025-07-14 03:01:41 -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
e22f49ef04 Fix REPL crashing on startup
The problem is that we were cleaning up old REPL sockets after
launching new ones. This moves the cleanup step to before Artemis
and Friends processes are launched.
2023-12-29 17:08:58 -06:00
Mia
7fb904972f Ensure battle processes have source maps set up 2023-12-08 09:39:37 -06:00
Mia
c89c68ad3a Use source maps for better error stacks
This has been very annoying.
2023-11-26 22:49:46 -06: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
Mia
7811795344
Handle new TypeScript version (#8449)
Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2021-08-30 20:11:44 -07:00
Annika
c134195915
Use ts-node instead of Sucrase (#8369) 2021-07-09 19:59:22 -07:00
Annika
83df279b1d
Add a chat plugin to manage username prefixes (#8338) 2021-05-26 14:39:13 -07:00
Guangcong Luo
13189fdb02
Update Dex API (#8181)
This is the change that renames:

- `Dex.getMove` -> `Dex.moves.get`
- `Dex.getAbility` -> `Dex.abilities.get`
- `Dex.getItem` -> `Dex.items.get`
- `Dex.getSpecies` -> `Dex.species.get`
- `Dex.getEffect` -> `Dex.conditions.get`
- `Dex.getNature` -> `Dex.natures.get`
- `Dex.getType` -> `Dex.types.get`
- `Dex.getFormat` -> `Dex.formats.get`

In addition, some other APIs have been updated:

- `getByID` methods have also been added to every other table.
- `Dex.moves.all()` now gets an array of all moves
  - Plus equivalent methods for `abilities`, `items`, `species`, `formats`, `natures`, `types`
  - Note: there's no `Dex.conditions.all()`
- new API: `Dex.stats` for naming/iterating stats
- `Dex.getEffectByID` -> `Dex.conditions.getByID`
- `Dex.getType` -> `Dex.types.get`
- `Dex.data.Formats` -> `Dex.data.Rulesets`
- `Dex.formats` -> now an array `Dex.formats.all()`
- `Dex.getRuleTable` -> `Dex.formats.getRuleTable`
- `Dex.validateFormat` -> `Dex.formats.validate`

Team functions have been split off into a new `sim/teams` package:

- `Dex.packTeam` -> `Teams.pack`
- `Dex.fastUnpackTeam` -> `Teams.unpack`
- `Dex.generateTeam` -> `Teams.generate`
- `Dex.stringifyTeam` -> `Teams.export`

`Teams.export` has also been rewritten to better match how it works in client.

This implements #8178
2021-04-08 03:00:37 -07:00
Annika
36c4dd7fec
Update comment to reflect the build script (#8107)
As far as I know, our documentation recommends using `node pokemon-showdown` to start PS, not `node build && node .server-dist/index.js`.
Thus, I don't think the latter is considered starting PS normally.
2021-03-08 02:40:45 -08:00
Mia
76c10841ea
Lib: Add an index file for all exports (#7972) 2021-01-31 18:00:19 -08:00
Mia
ff6a030992
Add a --no-security flag (#7648)
* Add a --no-security flag

* Handle port detection better

* Update server/index.ts

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2020-12-24 10:11:11 -08:00
Guangcong Luo
a38f0597f8 Remove last vestiges of tslint 2020-10-27 22:49:00 +00:00
Annika
c55c741c81
Move server/'s global variables out of index.ts (#7585) 2020-10-26 13:55:51 -07:00
Guangcong Luo
3d68248efa Update to latest eslint
We're skipping two major typescript-eslint versions, so there are a
bunch of changes here, including:

- it's catching a lot of things it didn't catch in the past, for
  reasons unclear to me

- no-unused-vars has to be explicitly disabled in global-types now

- a lot of `ts-ignore`s were never necessary and have been fixed

- Crashlogger can now handle being thrown things that aren't errors.
  This has never been a problem in the past, but to satisfy TypeScript
	we might as well not die in a fire on the off chance someone tries to
	`throw null` or something.
2020-09-29 15:28:08 -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
Mia
deeed6c789
Remove sim/ and data/'s globals (#7091) 2020-08-07 06:44:15 -07:00
Annika
f34ffa9e74
Refactor Modlog into one file (#7127) 2020-08-06 00:39:37 -07:00
Annika
cd85cd7a9d
Hosts & IPTools: Refactor to remove hardcoded ranges (#7078) 2020-07-29 23:04:50 -07:00
Annika
e0c18e8e0b
Refactor IPTools and add a host management chat plugin (#7061) 2020-07-26 12:41:27 -07:00
Guangcong Luo
d592c838c2 Separate Config.ofemain and Config.ofesockets 2020-06-12 22:02:32 -07:00
Guangcong Luo
ddb9a5d11e Improve code documentation 2020-05-26 21:29:34 -04:00
Guangcong Luo
776ccf9796
Refactor Sockets to ProcessManager+TypeScript (#6584) 2020-04-17 04:05:45 -07:00
Guangcong Luo
c49343b7e2 Setting a room rank can no longer demote globals
Previously, if you gave e.g. roomvoice to a global moderator, that
would demote their room rank to voice. Now, they will remain a
moderator, with "voice" only appearing in `/roomauth` and `/auth`.

(Includes a refactor of Config.groups)
2020-04-17 03:32:11 -07:00
Guangcong Luo
125fe31d06 Improve eslintrc
Fixed some more code style, allowing these rules to be enabled:

- `comma-dangle`
- `function-paren-newline`
- `member-delimiter-style`
- `no-eval`
- `no-fallthrough`
- `no-misused-promises`
- `no-unused-vars`
- `operator-linebreak`
2020-03-06 22:35:55 -08:00
Christopher Monsanto
4cb531e4a8
Add Config.startuphook (#6382)
This is called when the server is fully initialized and ready to serve
requests. Useful for notifying a process manager.
2020-02-22 15:51:18 -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
HoeenHero
77b76a5b09 Fix mistake in ae28a960b (toId -> toID) 2020-01-04 14:54:09 -05:00
not_a_seagull
ae28a960be Convert index.js and team-validator-async.js to typescript (#5987) 2020-01-04 07:11:54 -05:00