mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-05-21 02:40:08 +00:00
chore: pnpm migration
This commit is contained in:
4
.github/CONTRIBUTING.md
vendored
4
.github/CONTRIBUTING.md
vendored
@@ -32,12 +32,12 @@
|
||||
|
||||
## Development Setup
|
||||
|
||||
You will need an LTS version of [Node.js](http://nodejs.org) and [Yarn](https://yarnpkg.com).
|
||||
You will need an LTS version of [Node.js](http://nodejs.org) and [pnpm](https://pnpm.io).
|
||||
|
||||
After cloning the repo, run:
|
||||
|
||||
```bash
|
||||
$ yarn install # Install the dependencies of the project
|
||||
$ pnpm install # Install the dependencies of the project
|
||||
```
|
||||
|
||||
A high level overview of tools used:
|
||||
|
||||
13
.github/workflows/cicd.yml
vendored
13
.github/workflows/cicd.yml
vendored
@@ -17,20 +17,23 @@ 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@v6
|
||||
with:
|
||||
cache: 'yarn'
|
||||
cache: 'pnpm'
|
||||
node-version-file: package.json
|
||||
|
||||
- name: Install Dependencies
|
||||
run: yarn
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Check lint on discord-api-types
|
||||
run: yarn test:lint
|
||||
run: pnpm test:lint
|
||||
|
||||
- name: Run TSC
|
||||
run: yarn build:ci
|
||||
run: pnpm build:ci
|
||||
|
||||
- name: Run Type Tests
|
||||
run: yarn test:types
|
||||
run: pnpm test:types
|
||||
|
||||
27
.github/workflows/documentation.yml
vendored
27
.github/workflows/documentation.yml
vendored
@@ -43,14 +43,17 @@ jobs:
|
||||
with:
|
||||
ref: ${{ inputs.ref || '' }}
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v5
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
cache: 'yarn'
|
||||
cache: 'pnpm'
|
||||
node-version-file: package.json
|
||||
|
||||
- name: Install Dependencies for discord-api-types
|
||||
run: yarn
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
#region DJS start (mostly from discord.js/packages/actions/src/pnpmCache)
|
||||
# pnpm --filter="*api-*" --filter="scripts" --filter="actions" run build
|
||||
@@ -123,10 +126,10 @@ jobs:
|
||||
- name: Build docs
|
||||
shell: bash
|
||||
run: |
|
||||
yarn prepack
|
||||
pnpm prepack
|
||||
./djs/packages/api-extractor/bin/api-extractor run --local --minify
|
||||
./djs/packages/scripts/bin/generateSplitDocumentation.js
|
||||
yarn postpack
|
||||
pnpm postpack
|
||||
|
||||
- name: Upload documentation to database
|
||||
if: ${{ env.REF_TYPE == 'tag' && (!inputs.ref || inputs.ref == 'main') }}
|
||||
@@ -142,7 +145,7 @@ jobs:
|
||||
ACTION_PACKAGE: ${{ env.ACTION_PACKAGE }}
|
||||
ACTION_VERSION: ${{ steps.extract-tag.outputs.semver }}
|
||||
run: |
|
||||
yarn tsx ./scripts/actions/documentation/uploadDocumentation.ts
|
||||
pnpm exec tsx ./scripts/actions/documentation/uploadDocumentation.ts
|
||||
|
||||
- name: Upload documentation to database
|
||||
if: ${{ env.REF_TYPE == 'tag' && inputs.ref && inputs.ref != 'main' }}
|
||||
@@ -158,7 +161,7 @@ jobs:
|
||||
ACTION_PACKAGE: ${{ env.ACTION_PACKAGE }}
|
||||
ACTION_VERSION: ${{ steps.extract-tag.outputs.semver }}
|
||||
run: |
|
||||
yarn tsx ./scripts/actions/documentation/uploadDocumentation.ts
|
||||
pnpm exec tsx ./scripts/actions/documentation/uploadDocumentation.ts
|
||||
|
||||
- name: Upload split documentation to blob storage
|
||||
if: ${{ env.REF_TYPE == 'tag' && (!inputs.ref || inputs.ref == 'main') }}
|
||||
@@ -170,7 +173,7 @@ jobs:
|
||||
ACTION_PACKAGE: ${{ env.ACTION_PACKAGE }}
|
||||
ACTION_VERSION: ${{ steps.extract-tag.outputs.semver }}
|
||||
run: |
|
||||
yarn tsx ./scripts/actions/documentation/uploadSplitDocumentation.ts
|
||||
pnpm exec tsx ./scripts/actions/documentation/uploadSplitDocumentation.ts
|
||||
|
||||
- name: Upload split documentation to blob storage
|
||||
if: ${{ env.REF_TYPE == 'tag' && inputs.ref && inputs.ref != 'main' }}
|
||||
@@ -182,7 +185,7 @@ jobs:
|
||||
ACTION_PACKAGE: ${{ env.ACTION_PACKAGE }}
|
||||
ACTION_VERSION: ${{ steps.extract-tag.outputs.semver }}
|
||||
run: |
|
||||
yarn tsx ./scripts/actions/documentation/uploadSplitDocumentation.ts
|
||||
pnpm exec tsx ./scripts/actions/documentation/uploadSplitDocumentation.ts
|
||||
|
||||
- name: Upload documentation to database
|
||||
if: ${{ env.REF_TYPE == 'branch' && (!inputs.ref || inputs.ref == 'main') }}
|
||||
@@ -198,7 +201,7 @@ jobs:
|
||||
ACTION_PACKAGE: ${{ env.ACTION_PACKAGE }}
|
||||
ACTION_VERSION: ${{ steps.extract-tag.outputs.semver }}
|
||||
run: |
|
||||
yarn tsx ./scripts/actions/documentation/uploadDocumentation.ts
|
||||
pnpm exec tsx ./scripts/actions/documentation/uploadDocumentation.ts
|
||||
|
||||
- name: Upload documentation to database
|
||||
if: ${{ env.REF_TYPE == 'branch' && inputs.ref && inputs.ref != 'main' }}
|
||||
@@ -214,7 +217,7 @@ jobs:
|
||||
ACTION_PACKAGE: ${{ env.ACTION_PACKAGE }}
|
||||
ACTION_VERSION: ${{ steps.extract-tag.outputs.semver }}
|
||||
run: |
|
||||
yarn tsx ./scripts/actions/documentation/uploadDocumentation.ts
|
||||
pnpm exec tsx ./scripts/actions/documentation/uploadDocumentation.ts
|
||||
|
||||
- name: Upload split documentation to blob storage
|
||||
if: ${{ env.REF_TYPE == 'branch' && (!inputs.ref || inputs.ref == 'main') }}
|
||||
@@ -226,7 +229,7 @@ jobs:
|
||||
ACTION_PACKAGE: ${{ env.ACTION_PACKAGE }}
|
||||
ACTION_VERSION: ${{ steps.extract-tag.outputs.semver }}
|
||||
run: |
|
||||
yarn tsx ./scripts/actions/documentation/uploadSplitDocumentation.ts
|
||||
pnpm exec tsx ./scripts/actions/documentation/uploadSplitDocumentation.ts
|
||||
|
||||
- name: Upload split documentation to blob storage
|
||||
if: ${{ env.REF_TYPE == 'branch' && inputs.ref && inputs.ref != 'main' }}
|
||||
@@ -238,4 +241,4 @@ jobs:
|
||||
ACTION_PACKAGE: ${{ env.ACTION_PACKAGE }}
|
||||
ACTION_VERSION: ${{ steps.extract-tag.outputs.semver }}
|
||||
run: |
|
||||
yarn tsx ./scripts/actions/documentation/uploadSplitDocumentation.ts
|
||||
pnpm exec tsx ./scripts/actions/documentation/uploadSplitDocumentation.ts
|
||||
|
||||
31
.github/workflows/release-flows.yml
vendored
31
.github/workflows/release-flows.yml
vendored
@@ -30,28 +30,31 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v5
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
cache: 'yarn'
|
||||
cache: 'pnpm'
|
||||
node-version-file: package.json
|
||||
|
||||
- name: Install Dependencies
|
||||
run: yarn
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Bump version
|
||||
run: node ./scripts/bump-version.mjs
|
||||
|
||||
# TODO: we need a scoped token for this -.-, can't OIDC tmk
|
||||
# - name: Deprecate old @next versions
|
||||
# run: yarn npm-deprecate --name "*next*" --package discord-api-types --message "No longer supported. Install the latest @next release" || true
|
||||
# run: pnpm npm-deprecate --name "*next*" --package discord-api-types --message "No longer supported. Install the latest @next release" || true
|
||||
# env:
|
||||
# NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
|
||||
- name: Publish new @next version
|
||||
run: |
|
||||
yarn version $(jq --raw-output '.version' package.json)-next.$(git rev-parse --short HEAD).$(date +%s)
|
||||
yarn npm publish --tag next
|
||||
npm version $(jq --raw-output '.version' package.json)-next.$(git rev-parse --short HEAD).$(date +%s) --no-git-tag-version
|
||||
pnpm publish --tag next --no-git-checks
|
||||
|
||||
create_pr:
|
||||
name: Create PR for new version
|
||||
@@ -71,14 +74,17 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v5
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
cache: 'yarn'
|
||||
cache: 'pnpm'
|
||||
node-version-file: package.json
|
||||
|
||||
- name: Install Dependencies
|
||||
run: yarn
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Install website dependencies
|
||||
run: pushd website && npm ci --ignore-scripts && popd
|
||||
@@ -98,7 +104,7 @@ jobs:
|
||||
git checkout -b "chore/release/$(jq --raw-output '.version' package.json)"
|
||||
|
||||
# Run changelog generation, deno script, website version bump
|
||||
yarn ci:pr
|
||||
pnpm ci:pr
|
||||
|
||||
# Add all changes, commit and push
|
||||
git add --all .
|
||||
@@ -134,18 +140,21 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v5
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
cache: 'yarn'
|
||||
cache: 'pnpm'
|
||||
node-version-file: package.json
|
||||
|
||||
- name: Install Dependencies
|
||||
run: yarn
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Publish release to npm
|
||||
run: |
|
||||
yarn npm publish
|
||||
pnpm publish --no-git-checks
|
||||
|
||||
- name: Create GitHub release
|
||||
run: node ./scripts/actions/create-release.mjs
|
||||
|
||||
7
.github/workflows/validate-pull-request.yml
vendored
7
.github/workflows/validate-pull-request.yml
vendored
@@ -12,14 +12,17 @@ jobs:
|
||||
- name: Checkout Project
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v5
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
cache: 'yarn'
|
||||
cache: 'pnpm'
|
||||
node-version-file: package.json
|
||||
|
||||
- name: Install Dependencies
|
||||
run: yarn
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Run Check Script
|
||||
run: node ./scripts/actions/report-deno-not-ran.mjs
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,4 @@
|
||||
node_modules/
|
||||
.yarn/install-state.gz
|
||||
|
||||
# Custom ESLint rules
|
||||
.eslint-plugin-local/*
|
||||
|
||||
@@ -1 +1 @@
|
||||
yarn commitlint --edit $1
|
||||
pnpm exec commitlint --edit $1
|
||||
|
||||
@@ -1 +1 @@
|
||||
yarn pretty-quick --staged && yarn lint-staged && yarn clean:node && yarn build:deno && git add deno
|
||||
pnpm exec pretty-quick --staged && pnpm exec lint-staged && pnpm run clean:node && pnpm run build:deno && git add deno
|
||||
|
||||
3
.npmrc
3
.npmrc
@@ -1,6 +1,7 @@
|
||||
audit=false
|
||||
fund=false
|
||||
legacy-peer-deps=true
|
||||
tag-version-prefix=""
|
||||
git-tag-version=false
|
||||
message="chore(release): %s 🎉"
|
||||
auto-install-peers=true
|
||||
strict-peer-dependencies=false
|
||||
|
||||
67
.yarn/plugins/postinstallDev.cjs
vendored
67
.yarn/plugins/postinstallDev.cjs
vendored
@@ -1,67 +0,0 @@
|
||||
/**
|
||||
* Altered from https://github.com/sachinraja/yarn-plugin-postinstall-dev/blob/main/sources/index.ts
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021-2022 Sachin Raja
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
const scriptName = 'postinstallDev';
|
||||
|
||||
module.exports = {
|
||||
name: 'postinstall-dev-script',
|
||||
factory: (require) => ({
|
||||
hooks: {
|
||||
/**
|
||||
* @param {import('@yarnpkg/core').Project} project
|
||||
* @param {Parameters<import('@yarnpkg/core').Hooks['afterAllInstalled']>[1]} options
|
||||
*/
|
||||
async afterAllInstalled(project, options) {
|
||||
/**
|
||||
* @type {import('@yarnpkg/core')}
|
||||
*/
|
||||
const { scriptUtils, InstallMode } = require('@yarnpkg/core');
|
||||
|
||||
if (options.mode === InstallMode.UpdateLockfile) {
|
||||
return;
|
||||
}
|
||||
|
||||
const locator = project.topLevelWorkspace.anchoredLocator;
|
||||
|
||||
if (await scriptUtils.hasPackageScript(locator, scriptName, { project })) {
|
||||
const exitCode = await scriptUtils.executePackageScript(locator, scriptName, [], {
|
||||
project,
|
||||
stdin: process.stdin,
|
||||
stdout: process.stdout,
|
||||
stderr: process.stderr,
|
||||
});
|
||||
|
||||
if (exitCode !== 0) {
|
||||
const error = new Error(`${scriptName} script failed with exit code ${exitCode}`);
|
||||
error.stack = undefined;
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}),
|
||||
};
|
||||
940
.yarn/releases/yarn-4.13.0.cjs
vendored
940
.yarn/releases/yarn-4.13.0.cjs
vendored
File diff suppressed because one or more lines are too long
@@ -1,8 +0,0 @@
|
||||
enableGlobalCache: true
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
yarnPath: .yarn/releases/yarn-4.13.0.cjs
|
||||
|
||||
plugins:
|
||||
- path: ./.yarn/plugins/postinstallDev.cjs
|
||||
@@ -14,12 +14,12 @@ Simple type definitions for the [Discord API](https://discord.com/developers/doc
|
||||
|
||||
## Installation
|
||||
|
||||
Install with [npm](https://www.npmjs.com/) / [yarn](https://yarnpkg.com) / [pnpm](https://pnpm.js.org/):
|
||||
Install with [npm](https://www.npmjs.com/) / [pnpm](https://pnpm.io/) / [yarn](https://yarnpkg.com):
|
||||
|
||||
```sh
|
||||
npm install discord-api-types
|
||||
yarn add discord-api-types
|
||||
pnpm add discord-api-types
|
||||
yarn add discord-api-types
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
4
deno/README.md
generated
4
deno/README.md
generated
@@ -14,12 +14,12 @@ Simple type definitions for the [Discord API](https://discord.com/developers/doc
|
||||
|
||||
## Installation
|
||||
|
||||
Install with [npm](https://www.npmjs.com/) / [yarn](https://yarnpkg.com) / [pnpm](https://pnpm.js.org/):
|
||||
Install with [npm](https://www.npmjs.com/) / [pnpm](https://pnpm.io/) / [yarn](https://yarnpkg.com):
|
||||
|
||||
```sh
|
||||
npm install discord-api-types
|
||||
yarn add discord-api-types
|
||||
pnpm add discord-api-types
|
||||
yarn add discord-api-types
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
@@ -249,7 +249,6 @@ export default config([
|
||||
'v8.ts',
|
||||
|
||||
'djs/**/*',
|
||||
'.yarn/*',
|
||||
|
||||
'_generated_/**/*',
|
||||
],
|
||||
|
||||
17
package.json
17
package.json
@@ -3,9 +3,6 @@
|
||||
"version": "0.38.42",
|
||||
"description": "Discord API typings that are kept up to date for use in bot library creation.",
|
||||
"homepage": "https://discord-api-types.dev",
|
||||
"workspaces": [
|
||||
"scripts/actions/documentation"
|
||||
],
|
||||
"exports": {
|
||||
"./globals": {
|
||||
"types": "./globals.d.ts",
|
||||
@@ -97,7 +94,7 @@
|
||||
"build:ci": "tsc --noEmit --incremental false",
|
||||
"build:deno": "node ./scripts/deno.mjs",
|
||||
"build:generated": "tsx ./scripts/generate-prettier-routes-interface.ts",
|
||||
"build:node": "yarn build:generated && tsc && run-p 'esm:*'",
|
||||
"build:node": "pnpm run build:generated && tsc && run-p 'esm:*'",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
||||
"ci:pr": "run-s changelog lint build:deno && node ./scripts/bump-website-version.mjs",
|
||||
"clean:deno": "rimraf deno/",
|
||||
@@ -112,7 +109,7 @@
|
||||
"esm:versions": "node ./scripts/versions.mjs",
|
||||
"esm:voice": "gen-esm-wrapper ./voice/index.js ./voice/index.mjs",
|
||||
"lint": "prettier --write . && eslint --format=pretty --fix --ext mjs,ts \"{gateway,payloads,rest,rpc,voice,utils}/**/*.ts\" \"{globals,v*}.ts\" \"scripts/**/*.mjs\"",
|
||||
"postinstallDev": "is-ci || husky",
|
||||
"prepare": "is-ci || husky",
|
||||
"prepack": "run-s clean test:lint build:node",
|
||||
"postpack": "run-s clean:node build:deno && git checkout -- './deno/**/*.ts' './rest/**/*.ts'",
|
||||
"test:lint": "prettier --check . && eslint --format=pretty --ext mjs,ts \"{gateway,payloads,rest,rpc,voice,utils}/**/*.ts\" \"{globals,v*}.ts\" \"scripts/**/*.mjs\"",
|
||||
@@ -207,9 +204,15 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"packageManager": "yarn@4.13.0",
|
||||
"pnpm": {
|
||||
"onlyBuiltDependencies": [
|
||||
"esbuild",
|
||||
"unrs-resolver"
|
||||
]
|
||||
},
|
||||
"packageManager": "pnpm@10.33.0",
|
||||
"volta": {
|
||||
"node": "24.14.1",
|
||||
"yarn": "4.13.0"
|
||||
"pnpm": "10.33.0"
|
||||
}
|
||||
}
|
||||
|
||||
12076
pnpm-lock.yaml
generated
Normal file
12076
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
2
pnpm-workspace.yaml
Normal file
2
pnpm-workspace.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
packages:
|
||||
- 'scripts/actions/documentation'
|
||||
@@ -7,7 +7,7 @@ const commitUrl = `https://github.com/${OWNER}/${REPOSITORY}/commit/${process.en
|
||||
|
||||
console.info(`👀 Verifying that deno types are up to date with commit ${process.env.GITHUB_SHA}`);
|
||||
console.debug('Running build:deno script');
|
||||
execSync(`yarn build:deno`);
|
||||
execSync(`pnpm run build:deno`);
|
||||
|
||||
console.debug('Getting the difference between clone and deno build output.');
|
||||
const diff = execSync(`git diff --name-only ${process.env.GITHUB_SHA}`)
|
||||
@@ -24,7 +24,7 @@ if (!diff.length) {
|
||||
console.debug(`⚠️ Found ${diff.length} different files.`, { diff });
|
||||
|
||||
const messageBody = [
|
||||
`Taking a look at commit ${commitUrl}, it seems that you forgot to run \`yarn build:deno\`. Here are the files that are different from the base:`,
|
||||
`Taking a look at commit ${commitUrl}, it seems that you forgot to run \`pnpm run build:deno\`. Here are the files that are different from the base:`,
|
||||
'',
|
||||
];
|
||||
|
||||
@@ -38,7 +38,7 @@ for (const file of diff) {
|
||||
);
|
||||
}
|
||||
|
||||
messageBody.push('', 'Please run `yarn build:deno` and commit the results to update the deno types.');
|
||||
messageBody.push('', 'Please run `pnpm run build:deno` and commit the results to update the deno types.');
|
||||
|
||||
console.error('❌ Deno types are not up to date with the commit!');
|
||||
console.error(messageBody.join('\n'));
|
||||
|
||||
Reference in New Issue
Block a user