Skip to content

Commit f04628c

Browse files
2 parents adf9b97 + 10d262d commit f04628c

File tree

356 files changed

+397802
-54584
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

356 files changed

+397802
-54584
lines changed

.github/workflows/publish.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
outputs:
1414
current_version: ${{ steps.current_version.outputs.version }}
1515
last_version: ${{ steps.last_version.outputs.version }}
16+
token_exists: ${{ steps.check_token.outputs.token }}
1617
steps:
1718
- uses: actions/checkout@v3
1819
with:
@@ -27,13 +28,17 @@ jobs:
2728
run: |
2829
git checkout ${{ github.event.before }}
2930
echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
31+
- name: Check if NPM_TOKEN exists
32+
id: check_token
33+
run: |
34+
echo "token=$(if [ -n "${{ secrets.NPM_TOKEN }}" ]; then echo true; else echo false; fi)" >> $GITHUB_OUTPUT
3035
npm-publish:
3136
needs:
3237
- test
3338
- get-version
3439
runs-on: ubuntu-latest
3540
# We only want to publish if the package.json version field has changed
36-
if: needs.get-version.outputs.current_version != needs.get-version.outputs.last_version
41+
if: needs.get-version.outputs.current_version != needs.get-version.outputs.last_version && needs.get-version.outputs.token_exists == 'true'
3742
steps:
3843
- uses: actions/checkout@v3
3944
- uses: actions/setup-node@v3

.github/workflows/test.yml

+50-1
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,60 @@ jobs:
2121

2222
steps:
2323
- uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 100 # assumes PR/push to master is no larger than 100 commits. Other solutions are needlessly complex.
26+
2427
- name: Use Node.js ${{ matrix.node-version }}
2528
uses: actions/setup-node@v3
2629
with:
2730
node-version: ${{ matrix.node-version }}
31+
cache: 'npm'
32+
2833
- run: npm ci
29-
- run: npm run full-test
34+
35+
- name: Determine which files to lint (if pull request)
36+
if: ${{ github.event_name == 'pull_request' }}
37+
id: changed-files
38+
uses: tj-actions/changed-files@v35
39+
with:
40+
files: |
41+
./config/*.ts
42+
./data/**/*.ts
43+
./lib/*.ts
44+
./server/**/*.ts
45+
./server/**/*.tsx
46+
./sim/**/*.ts
47+
./tools/set-import/*.ts
48+
files_ignore: |
49+
./logs/
50+
./node_modules/
51+
./dist/
52+
./data/**/learnsets.ts
53+
./tools/set-import/importer.js
54+
./tools/set-import/sets
55+
./tools/modlog/converter.js
56+
./server/global-variables.d.ts
57+
58+
- name: Determine whether test/sim or test/random-battles need to run (if pull request)
59+
if: ${{ github.event_name == 'pull_request' }}
60+
id: changed-directories
61+
uses: tj-actions/changed-files@v35
62+
with:
63+
files: |
64+
config/formats.ts
65+
data/**
66+
sim/**
67+
68+
- name: Run selective lint & neccessary tests (if pull request)
69+
if: ${{ github.event_name == 'pull_request' }}
70+
run: npm run full-test-ci
71+
env:
72+
CI: true
73+
FILES: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
74+
SKIPSIMTESTS: ${{ steps.changed-directories.outputs.all_changed_and_modified_files == '' }}
75+
76+
- name: Run full lint & test (if push to master)
77+
run: npm run full-test
78+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
3079
env:
3180
CI: true

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
/config/*
44
!/config/formats.ts
5+
!/config/config-example.js
56
/logs/*
67
/test/modlogs
78
/node_modules

ARCHITECTURE.md

+9-12
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ Pokemon Showdown architecture
33

44
At the highest level, PS is split into three parts:
55

6-
- Client
7-
- Login server
8-
- Game server
9-
10-
The game server is in this repository, **[smogon/pokemon-showdown](https://github.com/smogon/pokemon-showdown)**, while the client and login server are in **[smogon/pokemon-showdown-client](https://github.com/smogon/pokemon-showdown-client)**. All three communicate directly with each other.
6+
- Game server (**[smogon/pokemon-showdown](https://github.com/smogon/pokemon-showdown)**)
7+
- Client (**[smogon/pokemon-showdown-client](https://github.com/smogon/pokemon-showdown-client)**)
8+
- Login server (**[smogon/pokemon-showdown-loginserver](https://github.com/smogon/pokemon-showdown-loginserver)**)
119

10+
All three communicate directly with each other.
1211

1312
Game server
1413
-----------
@@ -25,22 +24,20 @@ Its entry point is [server/index.ts](./server/index.ts), which launches several
2524

2625
- [server/chat.ts](./server/chat.ts) sets up `Chat`, which handles chat commands and messages coming in from users (all client-to-server commands are routed through there)
2726

28-
`Rooms` also includes support for battle rooms, which is where the game simulation itself is done. Game simulation code is in [sim/](./sim/).
29-
27+
`Rooms` also includes support for battle rooms, which is where the server connects to the game simulator itself. Game simulation code is in [sim/](./sim/).
3028

3129
Client
3230
------
3331

3432
The client is built in a mix of TypeScript and JavaScript, with a mostly hand-rolled framework built on Backbone. There’s a rewrite to migrate it to Preact but it’s very stalled.
3533

36-
Its entry point is [index.template.html](https://github.com/smogon/pokemon-showdown-client/blob/master/index.template.html).
37-
38-
It was written long ago, so instead of a single JS entry point, it includes a lot of JS files. Everything important is launched from [js/client.js](https://github.com/smogon/pokemon-showdown-client/blob/master/js/client.js).
34+
Its entry point is [index.template.html](https://github.com/smogon/pokemon-showdown-client/blob/master/play.pokemonshowdown.com/index.template.html)
3935

36+
It was written long ago, so instead of a single JS entry point, it includes a lot of JS files. Everything important is launched from [js/client.js](https://github.com/smogon/pokemon-showdown-client/blob/master/play.pokemonshowdown.com/js/client.js)
4037

4138
Login server
4239
------------
4340

44-
The client’s login server, which handles logins and most database interaction, is written in PHP, with a rewrite to TypeScript in progress. The backend is split between a MySQL InnoDB database and a Percona database, with a migration to Postgres planned.
41+
The client’s login server, which handles logins and most database interaction, is written in TypeScript in progress. The backend is split between a MySQL InnoDB database (for most things) and a Postgres database (for Replays).
4542

46-
Its entry point is [action.php](https://github.com/smogon/pokemon-showdown-client/blob/master/action.php).
43+
Its entry point is [server.ts](https://github.com/smogon/pokemon-showdown-loginserver/blob/master/src/server.ts).

CODEOWNERS

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ data/random-sets.json @MathyFurret @ACakeWearingAHat @livid-washed @adrivrie
55
data/random-teams.ts @AnnikaCodes @KrisXV @MathyFurret @ACakeWearingAHat @livid-washed @adrivrie
66
data/text/ @Marty-D
77
databases/ @monsanto
8+
lib/sql.ts @mia-pi-git
89
server/artemis/* @mia-pi-git
910
server/chat-plugins/abuse-monitor.ts @mia-pi-git
1011
server/chat-plugins/friends.ts @mia-pi-git
@@ -13,15 +14,18 @@ server/chat-plugins/hosts.ts @AnnikaCodes
1314
server/chat-plugins/helptickets*.ts @mia-pi-git
1415
server/chat-plugins/mafia.ts @HoeenCoder
1516
server/chat-plugins/othermetas.ts @KrisXV
17+
server/chat-plugins/permalocks.ts @mia-pi-git
1618
server/chat-plugins/quotes.ts @mia-pi-git @KrisXV
1719
server/chat-plugins/random-battles.ts @KrisXV @AnnikaCodes
1820
server/chat-plugins/repeats.ts @AnnikaCodes
1921
server/chat-plugins/responder.ts @mia-pi-git
2022
server/chat-plugins/rock-paper-scissors.ts @mia-pi-git
2123
server/chat-plugins/sample-teams.ts @KrisXV
2224
server/chat-plugins/scavenger*.ts @xfix @sparkychildcharlie @PartMan7
25+
sever/chat-plugins/teams.ts @mia-pi-git
2326
server/chat-plugins/the-studio.ts @KrisXV
24-
server/chat-plugins/trivia/ @AnnikaCodes
27+
server/friends.ts @mia-pi-git
28+
server/private-messages/* @mia-pi-git
2529
server/chat-plugins/username-prefixes.ts @AnnikaCodes
2630
server/chat-plugins/wifi.ts @KrisXV
2731
server/friends.ts @mia-pi-git

COMMANDLINE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Note: Commands that ask for a team want the team in [packed team format](./sim/T
4747
- Simulates a battle, taking input to stdin and writing output to stdout
4848

4949
Using Pokémon Showdown as a command-line simulator is documented at:
50-
[sim/README.md](./README.md)
50+
[sim/README.md](./sim/README.md)
5151

5252
`./pokemon-showdown json-team`
5353

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Pokémon Showdown is many things:
3636

3737
- [server/README.md](./server/README.md)
3838

39-
Pokémon Showdown simulates singles, doubles and triples battles in all the games out so far (Generations 1 through 8).
39+
Pokémon Showdown simulates singles, doubles and triples battles in all the games out so far (Generations 1 through 9).
4040

4141

4242
Documentation quick links
@@ -89,8 +89,10 @@ Staff
8989
- Andrew Werner [HoeenHero] - Development
9090
- Annika L. [Annika] - Development
9191
- Chris Monsanto [chaos] - Development, Sysadmin
92-
- Leonard Craft III - Research (game mechanics)
92+
- Kris Johnson [Kris] - Development
93+
- Leonard Craft III [DaWoblefet] - Research (game mechanics)
9394
- Mathieu Dias-Martins [Marty-D] - Research (game mechanics), Development
95+
- Mia A [Mia] - Development
9496

9597
Contributors
9698

build

+8-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ try {
3030
console.log('Installing dependencies...');
3131
shell('npm install');
3232
}
33-
// for some reason, esbuild won't be requirable until a tick has passed
34-
// see https://stackoverflow.com/questions/53270058/node-cant-find-certain-modules-after-synchronous-install
35-
setImmediate(() => {
36-
require('./tools/build-utils').transpile(force, decl);
37-
});
3833

3934
// Make sure config.js exists. If not, copy it over synchronously from
4035
// config-example.js, since it's needed before we can start the server
@@ -49,3 +44,11 @@ try {
4944
fs.readFileSync('config/config-example.js')
5045
);
5146
}
47+
48+
// for some reason, esbuild won't be requirable until a tick has passed
49+
// see https://stackoverflow.com/questions/53270058/node-cant-find-certain-modules-after-synchronous-install
50+
setImmediate(() => {
51+
// npm package, don't rebuild
52+
if (process.argv[2] === 'postinstall' && fs.existsSync('dist')) return;
53+
require('./tools/build-utils').transpile(force, decl);
54+
});

config/CUSTOM-RULES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Pokémon Showdown supports custom rules in three ways:
77

88
- Tournaments, using the command `/tour rules RULES` (see the [Tournament command help][tour-help])
99

10-
- Custom formats on your side server, by editing `config/formats.js`
10+
- Custom formats on your side server, by editing `config/formats.ts`
1111

1212
[tour-help]: https://www.smogon.com/forums/threads/pok%C3%A9mon-showdown-forum-rules-resources-read-here-first.3570628/#post-6777489
1313

config/config-example.js

+1
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ exports.reportjoinsperiod = 0;
245245
* report battles - shows messages like "OU battle started" in the lobby
246246
* This feature can lag larger servers - turn this off if your server is
247247
* getting more than 160 or so users.
248+
* @type {boolean | string[] | string}
248249
*/
249250
exports.reportbattles = true;
250251

0 commit comments

Comments
 (0)