build: post pnpm migration fixes (#1786)

This commit is contained in:
Jiralite
2026-09-02 21:57:28 +03:00
committed by GitHub
parent 4a68cbc589
commit 2aa94596bf
12 changed files with 405 additions and 233 deletions
+3 -10
View File
@@ -17,17 +17,10 @@ jobs:
- name: Add problem matcher
run: echo "::add-matcher::.github/problemMatchers/eslint.json" && echo "::add-matcher::.github/problemMatchers/tsc.json"
- name: Install pnpm
uses: pnpm/action-setup@v5
- name: Use Node.js
uses: actions/setup-node@v7
- name: Install pnpm, Node.js and dependencies
uses: pnpm/setup@v2.1.0 # Pinned due to https://github.com/pnpm/setup/issues/47.
with:
cache: 'pnpm'
node-version-file: package.json
- name: Install Dependencies
run: pnpm install --frozen-lockfile
cache: true
- name: Check lint on discord-api-types
run: pnpm test:lint
+14 -13
View File
@@ -43,17 +43,10 @@ jobs:
with:
ref: ${{ inputs.ref || '' }}
- name: Install pnpm
uses: pnpm/action-setup@v5
- name: Use Node.js
uses: actions/setup-node@v7
- name: Install pnpm, Node.js and dependencies
uses: pnpm/setup@v2.1.0 # Pinned due to https://github.com/pnpm/setup/issues/47.
with:
cache: 'pnpm'
node-version-file: package.json
- name: Install Dependencies for discord-api-types
run: pnpm install --frozen-lockfile
cache: true
#region DJS start (mostly from discord.js/packages/actions/src/pnpmCache)
# pnpm --filter="*api-*" --filter="scripts" --filter="actions" run build
@@ -70,14 +63,16 @@ jobs:
with:
swap-size-gb: 10
- uses: pnpm/action-setup@v6.0.10
name: Install pnpm
- uses: pnpm/action-setup@v6
name: Install pnpm for discord.js
with:
run_install: false
package_json_file: djs/package.json
dest: ~/setup-pnpm-djs
- name: Expose pnpm config(s) through "$GITHUB_OUTPUT"
id: pnpm-config
working-directory: djs
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
@@ -92,7 +87,7 @@ jobs:
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-config.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-${{ hashFiles('**/pnpm-lock.yaml') }}
key: ${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-${{ hashFiles('djs/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-
@@ -112,6 +107,12 @@ jobs:
#endregion
# pnpm from discord.js above on PATH. This is for discord-api-types.
- name: Restore pnpm for discord-api-types
uses: pnpm/setup@v2.1.0 # Pinned due to https://github.com/pnpm/setup/issues/47.
with:
install: false
- name: Extract package and semver from tag
if: ${{ env.REF_TYPE == 'tag' }}
id: extract-tag
+10 -31
View File
@@ -30,17 +30,10 @@ jobs:
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v5
- name: Use Node.js
uses: actions/setup-node@v7
- name: Install pnpm, Node.js and dependencies
uses: pnpm/setup@v2.1.0 # Pinned due to https://github.com/pnpm/setup/issues/47.
with:
cache: 'pnpm'
node-version-file: package.json
- name: Install Dependencies
run: pnpm install --frozen-lockfile
cache: true
- name: Bump version
run: node ./scripts/bump-version.mjs
@@ -75,17 +68,10 @@ jobs:
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v5
- name: Use Node.js
uses: actions/setup-node@v7
- name: Install pnpm, Node.js and dependencies
uses: pnpm/setup@v2.1.0 # Pinned due to https://github.com/pnpm/setup/issues/47.
with:
cache: 'pnpm'
node-version-file: package.json
- name: Install Dependencies
run: pnpm install --frozen-lockfile
cache: true
- name: Install website dependencies
run: pushd website && npm ci --ignore-scripts && popd
@@ -132,7 +118,7 @@ jobs:
- uses: actions/create-github-app-token@v3
id: app-token
with:
app-id: ${{ vars.DISCORDJS_APP_ID }}
client-id: ${{ vars.DISCORDJS_APP_ID }}
private-key: ${{ secrets.DISCORDJS_APP_KEY_RELEASE }}
permission-contents: write
permission-pull-requests: write
@@ -142,17 +128,10 @@ jobs:
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v5
- name: Use Node.js
uses: actions/setup-node@v7
- name: Install pnpm, Node.js and dependencies
uses: pnpm/setup@v2.1.0 # Pinned due to https://github.com/pnpm/setup/issues/47.
with:
cache: 'pnpm'
node-version-file: package.json
- name: Install Dependencies
run: pnpm install --frozen-lockfile
cache: true
- name: Publish release to npm
run: |
+3 -10
View File
@@ -12,17 +12,10 @@ jobs:
- name: Checkout Project
uses: actions/checkout@v7
- name: Install pnpm
uses: pnpm/action-setup@v5
- name: Use Node.js
uses: actions/setup-node@v7
- name: Install pnpm, Node.js and dependencies
uses: pnpm/setup@v2.1.0 # Pinned due to https://github.com/pnpm/setup/issues/47.
with:
cache: 'pnpm'
node-version-file: package.json
- name: Install Dependencies
run: pnpm install --frozen-lockfile
cache: true
- name: Run Check Script
run: node ./scripts/actions/report-deno-not-ran.mjs
+1 -6
View File
@@ -1,7 +1,2 @@
audit=false
fund=false
tag-version-prefix=""
# scripts/bump-version.mjs uses `npm version`; this stops it committing and tagging.
git-tag-version=false
message="chore(release): %s 🎉"
auto-install-peers=true
strict-peer-dependencies=false
-1
View File
@@ -37,7 +37,6 @@ rest/v8/*
utils/v8.ts
v8.ts
.yarn/*
djs/*
_generated_
pnpm-lock.yaml
+7
View File
@@ -205,6 +205,13 @@
}
},
"packageManager": "pnpm@11.24.0",
"devEngines": {
"runtime": {
"name": "node",
"version": "24.20.0",
"onFail": "warn"
}
},
"volta": {
"node": "24.20.0",
"pnpm": "11.24.0"
+4 -18
View File
@@ -1,5 +1,3 @@
$schema: 'https://www.schemastore.org/pnpm-workspace.json'
packages:
- 'scripts/actions/documentation'
@@ -7,20 +5,7 @@ allowBuilds:
esbuild: true
unrs-resolver: true
minimumReleaseAgeExclude:
- '@typescript-eslint/eslint-plugin@8.69.0'
- '@typescript-eslint/parser@8.69.0'
- '@typescript-eslint/project-service@8.69.0'
- '@typescript-eslint/scope-manager@8.69.0'
- '@typescript-eslint/tsconfig-utils@8.69.0'
- '@typescript-eslint/type-utils@8.69.0'
- '@typescript-eslint/types@8.69.0'
- '@typescript-eslint/typescript-estree@8.69.0'
- '@typescript-eslint/utils@8.69.0'
- '@typescript-eslint/visitor-keys@8.69.0'
- typescript-eslint@8.69.0
# 1 day
# Renovate uses the same age.
minimumReleaseAge: 1440
# We don't need this
@@ -28,5 +13,6 @@ verifyDepsBeforeRun: false
# Consistency with npm
nodeLinker: hoisted
publicHoistPattern:
- '*'
autoInstallPeers: true
strictPeerDependencies: false
+1
View File
@@ -2,6 +2,7 @@
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:recommended", ":semanticCommitTypeAll(chore)"],
"semanticCommits": "enabled",
"minimumReleaseAge": "1 day",
"lockFileMaintenance": {
"enabled": true,
"schedule": ["before 1pm on friday"],
+18 -18
View File
@@ -22,7 +22,7 @@ channel.
:::
### Install dependencies first
## Install dependencies first
One of the most crucial steps is installing dependencies via `pnpm install --frozen-lockfile`. This ensures that linting
can be done, and it also sets up the `git` hooks for building the `deno` types and automatically formatting/linting the
@@ -35,7 +35,7 @@ web), you might see a comment like this one being sent as a review to your pull
The easiest way to solve this is to run the `build:deno` script (`pnpm build:deno`) and pushing the results.
### Figure out if the update you want to contribute respects our rules about documentation
## Figure out if the update you want to contribute respects our rules about documentation
:::danger
@@ -55,7 +55,7 @@ good example is the UserFlags `SPAMMER` flag). As such, if you think your update
it and we will be handled on a case by case basis. If approved, your update will be documented with an `@unstable` tag.
It will also not be subject to the same versioning rules as the rest of the types.
### Figure out what API versions need to receive the update
## Figure out what API versions need to receive the update
`discord-api-types` has multiple API versions in the repository, some of which may be considered `deprecated` or
`discontinued` as we keep them till the version is completely dead before removing them. This is a good time to figure
@@ -76,7 +76,7 @@ If the version you want to contribute to is not listed above (for instance if a
version you want to contribute to is for a different part of the API (for instance `voice`), feel free to submit it and
we will review it accordingly.
### Figure out where exactly are the files you need to modify to make the update
## Figure out where exactly are the files you need to modify to make the update
The file structure might seem confusing at first, especially if it's your first time contributing, but we're here to
guide you through it.
@@ -88,7 +88,7 @@ files you need to keep in mind when contributing.
```bash {2,4-6,9-10,12-16}
├── deno
├── gateway
├── node_modules (once you ran `npm ci`)
├── node_modules (once you ran `pnpm install`)
├── payloads
├── rest
├── rpc
@@ -105,7 +105,7 @@ files you need to keep in mind when contributing.
└── package.json
```
#### `deno`
### `deno`
This folder stores the [`deno`](https://deno.land/) compatible typings for Discord's API.
@@ -117,7 +117,7 @@ Any changes that need to be done to this folder need to be done through the `scr
:::
#### `gateway`
### `gateway`
This folder holds types that are strictly received from
[`Discord's gateway`](https://discord.com/developers/docs/topics/gateway). It stores the gateway version the types are
@@ -134,7 +134,7 @@ extension of the `APIGuild` type with extra fields received only through the gat
:::
#### `payloads`
### `payloads`
This folder holds the bulk of type definitions for Discord's APIs. Each API version receives its own folder. Inside of
each folder there is always an `index.ts` file that exports every type available in that version, as well as the common
@@ -158,7 +158,7 @@ normal name (for instance `UserFlags`).
:::
#### `rest`
### `rest`
This folder holds all the types that are related to Discord's REST API. Just like [`payloads`](#payloads), it is split
into folders that have an `index.ts` file, from the structure in [`Discord's API Documentation`](https://discord.dev),
@@ -185,7 +185,7 @@ OAuth2 may not follow the structure exactly, but should aim to follow it as much
:::
#### `rpc`
### `rpc`
This folder holds types that are strictly related to
[`Discord's RPC API`](https://discord.com/developers/docs/topics/rpc). Just like [`gateway`](#gateway), each RPC API
@@ -197,12 +197,12 @@ Types created here must start with the `RPC` prefix (for instance `RPCErrorCodes
:::
#### `scripts`
### `scripts`
This folder holds the module's scripts that empower our Continuous Integration / Deployment pipelines, as well as other
miscellaneous scripts we might need. There's really not much to say about these really...
#### `tests`
### `tests`
This folder holds tests for certain complex types that the module might have, and is especially useful for validating
unions.
@@ -214,7 +214,7 @@ Files created here **must** end in `.test-d.ts`, as otherwise they will not be p
:::
#### `utils`
### `utils`
This folder holds certain utility functions which can be used while working with some complicated types (for instance
for more complicated unions). Each API version gets its own file with utility functions, but a folder can be created if
@@ -227,7 +227,7 @@ types should never be exported from the module.
:::
#### `voice`
### `voice`
This folder holds types that are strictly related to
[`Discord's Voice API`](https://discord.com/developers/docs/topics/voice-connections). It follows the same folder
@@ -239,7 +239,7 @@ Types in this folder must start with the `Voice` prefix (for instance `VoiceOpco
:::
#### `website`
### `website`
This folder holds...well...this very site you are reading this page from! For the most part, you do not need to alter
its contents, except if you're contributing a new API version to the module.
@@ -247,16 +247,16 @@ its contents, except if you're contributing a new API version to the module.
To add the new version to this very website, edit the `docusaurus.config.js` file, and in the `plugins` array, for the
`docusaurus-plugin-typedoc-api` plugin, you need to add an entry similar to the ones already present.
#### `globals.ts`
### `globals.ts`
This file stores types that are present regardless of the API version you use.
#### `v*.ts`
### `v*.ts`
These files export everything from the previously mentioned folders that match the version the file is named after. It
serves as the entry point for importing types from the module (for example by importing `discord-api-types/v10`).
#### `package.json`
### `package.json`
This is the entry point of the package for [`npm`](https://www.npmjs.com/). You won't need to edit this file unless
you're adding a new API version, in which case you should follow the same structure as seen in the `exports` field.
+341 -124
View File
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -21,7 +21,7 @@
"typecheck": "tsc",
"lint": "eslint src --fix",
"lint:no-fix": "eslint src",
"lint:md": "markdownlint-cli2-fix",
"lint:md": "markdownlint-cli2 --fix",
"lint:md-no-fix": "markdownlint-cli2",
"clean": "node scripts/clean.mjs",
"format": "prettier --write \"{src,static,scripts,docs}/**/*.{js,jsx,ts,tsx,css,scss,json,md,mdx,yml}\"",
@@ -68,8 +68,9 @@
"jiti": "^2.6.1",
"markdownlint": "^0.41.1",
"markdownlint-cli2": "^0.23.1",
"npm-run-all2": "^9.0.3",
"patch-package": "^8.0.0",
"prettier": "^3.4.1",
"prettier": "^3.9.6",
"pretty-quick": "^4.0.0",
"typescript-eslint": "^8.69.0",
"tsx": "^4.22.4",