chore: move to yarn

fuck npm
This commit is contained in:
Vlad Frangu
2025-05-31 12:41:31 +03:00
parent 3cfa7f8ea7
commit e37ebed680
20 changed files with 11262 additions and 16613 deletions

View File

@@ -12,3 +12,5 @@ utils/v8.ts
v8.ts
djs/**/*
.yarn/*

View File

@@ -18,13 +18,14 @@ jobs:
- name: Checkout Project
uses: actions/checkout@v4
- name: Use Node.js v20
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
node-version-file: package.json
- name: Install Dependencies
run: npm ci
run: yarn
- name: Run Check Script
run: node ./scripts/actions/report-deno-not-ran.mjs

View File

@@ -17,21 +17,20 @@ jobs:
- name: Add problem matcher
run: echo "::add-matcher::.github/problemMatchers/eslint.json" && echo "::add-matcher::.github/problemMatchers/tsc.json"
- name: Use Node.js v20
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
registry-url: https://registry.npmjs.org/
cache: 'yarn'
node-version-file: package.json
- name: Install dependencies
run: npm ci
- name: Install Dependencies
run: yarn
- name: Check lint on discord-api-types
run: npm run test:lint
run: yarn test:lint
- name: Run TSC
run: npm run build:ci
run: yarn build:ci
- name: Run Type Tests
run: npm run test:types
run: yarn test:types

View File

@@ -21,14 +21,14 @@ jobs:
with:
fetch-depth: 0
- name: Install Node v20
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
cache: 'yarn'
node-version-file: package.json
- name: Install dependencies
run: npm ci
- name: Install Dependencies
run: yarn
- name: Install website dependencies
run: pushd website && npm ci --ignore-scripts && popd
@@ -48,7 +48,7 @@ jobs:
git checkout -b "chore/release/$(jq --raw-output '.version' package.json)"
# Run changelog generation, deno script, website version bump
npm run ci:pr
yarn ci:pr
# Add all changes, commit and push
git add --all .
@@ -77,17 +77,17 @@ jobs:
with:
fetch-depth: 0
- name: Install Node v20
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
cache: 'yarn'
node-version-file: package.json
- name: Install dependencies
run: npm ci
- name: Install Dependencies
run: yarn
- name: Publish release to npm
run: npm publish
run: yarn npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

View File

@@ -43,13 +43,14 @@ jobs:
with:
ref: ${{ inputs.ref || '' }}
- name: Install Node.js v22
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'yarn'
node-version-file: package.json
- name: Install dependencies for discord-api-types
run: npm ci
- name: Install Dependencies for discord-api-types
run: yarn
#region DJS start (mostly from discord.js/packages/actions/src/pnpmCache)
# pnpm --filter="*api-*" --filter="scripts" --filter="actions" run build
@@ -122,10 +123,10 @@ jobs:
- name: Build docs
shell: bash
run: |
npm run prepublishOnly
yarn prepublishOnly
./djs/packages/api-extractor/bin/api-extractor run --local --minify
./djs/packages/scripts/bin/generateSplitDocumentation.js
npm run postpublish
yarn postpublish
- name: Upload documentation to database
if: ${{ env.REF_TYPE == 'tag' && (!inputs.ref || inputs.ref == 'main') }}
@@ -141,7 +142,7 @@ jobs:
ACTION_PACKAGE: ${{ env.ACTION_PACKAGE }}
ACTION_VERSION: ${{ steps.extract-tag.outputs.semver }}
run: |
npx tsx ./scripts/actions/documentation/uploadDocumentation.ts
yarn tsx ./scripts/actions/documentation/uploadDocumentation.ts
- name: Upload documentation to database
if: ${{ env.REF_TYPE == 'tag' && inputs.ref && inputs.ref != 'main' }}
@@ -157,7 +158,7 @@ jobs:
ACTION_PACKAGE: ${{ env.ACTION_PACKAGE }}
ACTION_VERSION: ${{ steps.extract-tag.outputs.semver }}
run: |
npx tsx ./scripts/actions/documentation/uploadDocumentation.ts
yarn tsx ./scripts/actions/documentation/uploadDocumentation.ts
- name: Upload split documentation to blob storage
if: ${{ env.REF_TYPE == 'tag' && (!inputs.ref || inputs.ref == 'main') }}
@@ -169,7 +170,7 @@ jobs:
ACTION_PACKAGE: ${{ env.ACTION_PACKAGE }}
ACTION_VERSION: ${{ steps.extract-tag.outputs.semver }}
run: |
npx tsx ./scripts/actions/documentation/uploadSplitDocumentation.ts
yarn tsx ./scripts/actions/documentation/uploadSplitDocumentation.ts
- name: Upload split documentation to blob storage
if: ${{ env.REF_TYPE == 'tag' && inputs.ref && inputs.ref != 'main' }}
@@ -181,7 +182,7 @@ jobs:
ACTION_PACKAGE: ${{ env.ACTION_PACKAGE }}
ACTION_VERSION: ${{ steps.extract-tag.outputs.semver }}
run: |
npx tsx ./scripts/actions/documentation/uploadSplitDocumentation.ts
yarn tsx ./scripts/actions/documentation/uploadSplitDocumentation.ts
- name: Upload documentation to database
if: ${{ env.REF_TYPE == 'branch' && (!inputs.ref || inputs.ref == 'main') }}
@@ -197,7 +198,7 @@ jobs:
ACTION_PACKAGE: ${{ env.ACTION_PACKAGE }}
ACTION_VERSION: ${{ steps.extract-tag.outputs.semver }}
run: |
npx tsx ./scripts/actions/documentation/uploadDocumentation.ts
yarn tsx ./scripts/actions/documentation/uploadDocumentation.ts
- name: Upload documentation to database
if: ${{ env.REF_TYPE == 'branch' && inputs.ref && inputs.ref != 'main' }}
@@ -213,7 +214,7 @@ jobs:
ACTION_PACKAGE: ${{ env.ACTION_PACKAGE }}
ACTION_VERSION: ${{ steps.extract-tag.outputs.semver }}
run: |
npx tsx ./scripts/actions/documentation/uploadDocumentation.ts
yarn tsx ./scripts/actions/documentation/uploadDocumentation.ts
- name: Upload split documentation to blob storage
if: ${{ env.REF_TYPE == 'branch' && (!inputs.ref || inputs.ref == 'main') }}
@@ -225,7 +226,7 @@ jobs:
ACTION_PACKAGE: ${{ env.ACTION_PACKAGE }}
ACTION_VERSION: ${{ steps.extract-tag.outputs.semver }}
run: |
npx tsx ./scripts/actions/documentation/uploadSplitDocumentation.ts
yarn tsx ./scripts/actions/documentation/uploadSplitDocumentation.ts
- name: Upload split documentation to blob storage
if: ${{ env.REF_TYPE == 'branch' && inputs.ref && inputs.ref != 'main' }}
@@ -237,4 +238,4 @@ jobs:
ACTION_PACKAGE: ${{ env.ACTION_PACKAGE }}
ACTION_VERSION: ${{ steps.extract-tag.outputs.semver }}
run: |
npx tsx ./scripts/actions/documentation/uploadSplitDocumentation.ts
yarn tsx ./scripts/actions/documentation/uploadSplitDocumentation.ts

View File

@@ -13,41 +13,40 @@ jobs:
cancel-in-progress: true
name: Publish @next release to npm
runs-on: ubuntu-latest
permissions:
id-token: write
if: github.repository_owner == 'discordjs' && !(github.event_name == 'push' && startsWith(github.event.head_commit.message, 'chore(release)'))
steps:
# - name: Cancel previous publish attempts
# uses: styfle/cancel-workflow-action@0.12.1
# with:
# access_token: ${{ github.token }}
if: github.repository_owner == 'discordjs' && !(github.event_name == 'push' && startsWith(github.event.head_commit.message, 'chore(release)'))
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Node v20
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
cache: 'yarn'
node-version-file: package.json
- name: Install dependencies
run: npm ci
- name: Install Dependencies
run: yarn
- name: Bump version
run: node ./scripts/bump-version.mjs
- name: Deprecate old @next versions
run: npx npm-deprecate --name "*next*" --package discord-api-types --message "No longer supported. Install the latest @next release" || true
run: yarn 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: |
npm version $(jq --raw-output '.version' package.json)-next.$(git rev-parse --short HEAD).$(date +%s)
npm publish --tag next
yarn version $(jq --raw-output '.version' package.json)-next.$(git rev-parse --short HEAD).$(date +%s)
yarn npm publish --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

1
.gitignore vendored
View File

@@ -1,4 +1,5 @@
node_modules/
.yarn/install-state.gz
# Custom ESLint rules
.eslint-plugin-local/*

View File

@@ -1 +1 @@
npx --no-install commitlint --edit $1
yarn commitlint --edit $1

View File

@@ -1 +1 @@
npx --no-install pretty-quick --staged && npx --no-install lint-staged && npm run build:deno && git add deno
yarn pretty-quick --staged && yarn lint-staged && yarn build:deno && git add deno

View File

@@ -36,3 +36,5 @@ payloads/v8/*
rest/v8/*
utils/v8.ts
v8.ts
.yarn/*

948
.yarn/releases/yarn-4.9.1.cjs vendored Executable file

File diff suppressed because one or more lines are too long

5
.yarnrc.yml Normal file
View File

@@ -0,0 +1,5 @@
enableGlobalCache: true
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-4.9.1.cjs

16532
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -111,9 +111,9 @@
"esm:versions": "node ./scripts/versions.mjs",
"esm:voice": "gen-esm-wrapper ./voice/index.js ./voice/index.mjs",
"lint": "prettier --write . && eslint --fix --ext mjs,ts \"{gateway,payloads,rest,rpc,voice,utils}/**/*.ts\" \"{globals,v*}.ts\" \"scripts/**/*.mjs\"",
"postpublish": "run-s clean:node build:deno",
"prepare": "tsc -p ./.eslint-plugin-local && (is-ci || husky)",
"prepublishOnly": "run-s clean test:lint build:node",
"postpublish": "run-s clean:node build:deno",
"test:lint": "prettier --check . && eslint --ext mjs,ts \"{gateway,payloads,rest,rpc,voice,utils}/**/*.ts\" \"{globals,v*}.ts\" \"scripts/**/*.mjs\"",
"test:types": "tsc -p tests"
},
@@ -133,28 +133,28 @@
"@commitlint/cli": "^19.8.1",
"@commitlint/config-angular": "^19.8.1",
"@favware/npm-deprecate": "^2.0.0",
"@octokit/action": "^8.0.0",
"@octokit/webhooks-types": "^7.3.2",
"@octokit/action": "^8.0.2",
"@octokit/webhooks-types": "^7.6.1",
"@sapphire/prettier-config": "^2.0.0",
"@types/node": "^22.0.0",
"@typescript-eslint/utils": "^8.0.0",
"conventional-changelog-cli": "^5.0.0",
"@types/node": "^22.15.29",
"@typescript-eslint/utils": "^8.33.0",
"conventional-changelog": "^7.0.2",
"conventional-recommended-bump": "^11.1.0",
"eslint": "^8.57.0",
"eslint-config-neon": "^0.1.59",
"eslint-import-resolver-typescript": "^4.0.0",
"eslint": "^8.57.1",
"eslint-config-neon": "^0.1.62",
"eslint-import-resolver-typescript": "^4.4.2",
"eslint-plugin-local": "^6.0.0",
"gen-esm-wrapper": "^1.1.3",
"husky": "^9.0.11",
"is-ci": "^4.0.0",
"lint-staged": "^16.0.0",
"npm-run-all2": "^8.0.0",
"prettier": "^3.2.5",
"pretty-quick": "^4.0.0",
"rimraf": "^6.0.0",
"husky": "^9.1.7",
"is-ci": "^4.1.0",
"lint-staged": "^16.1.0",
"npm-run-all2": "^8.0.4",
"prettier": "^3.5.3",
"pretty-quick": "^4.1.1",
"rimraf": "^6.0.1",
"tsutils": "^3.21.0",
"tsx": "^4.19.4",
"typescript": "^5.6.3"
"typescript": "^5.8.3"
},
"publishConfig": {
"provenance": true
@@ -197,5 +197,10 @@
"pascal-case"
]
}
},
"packageManager": "yarn@4.9.1",
"volta": {
"node": "24.1.0",
"yarn": "4.9.1"
}
}

View File

@@ -8,7 +8,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(`npm run build:deno`);
execSync(`yarn build:deno`);
console.debug('Getting the difference between clone and deno build output.');
const diff = execSync(`git diff --name-only ${process.env.GITHUB_SHA}`)
@@ -25,7 +25,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 \`npm run 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 \`yarn build:deno\`. Here are the files that are different from the base:`,
'',
];
@@ -39,7 +39,7 @@ for (const file of diff) {
);
}
messageBody.push('', 'Please run `npm run build:deno` and commit the results to update the deno types.');
messageBody.push('', 'Please run `yarn 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'));

View File

@@ -8,8 +8,8 @@ const json = JSON.parse(await readFile(new URL('../package.json', import.meta.ur
console.log(`⌛ Creating website version for ${json.version}`);
execSync(`npm run docusaurus docs:version ${json.version}`, { cwd, encoding: 'utf8' });
execSync(`npm run docusaurus api:version ${json.version}`, { cwd, encoding: 'utf8' });
execSync(`yarn docusaurus docs:version ${json.version}`, { cwd, encoding: 'utf8' });
execSync(`yarn docusaurus api:version ${json.version}`, { cwd, encoding: 'utf8' });
const bigJsonPath = new URL(`../website/versioned_docs/version-${json.version}/api-typedoc.json`, import.meta.url);

View File

@@ -35,7 +35,7 @@ request:
![An image showing the style of comment the automatic deno checker reports](./images/deno_types_out_of_sync.png)
The easiest way to solve this is to run the `build:deno` script (`npm run build:deno`) and pushing the results.
The easiest way to solve this is to run the `build:deno` script (`yarn build:deno`) and pushing the results.
### Figure out if the update you want to contribute respects our rules about documentation

View File

@@ -7,8 +7,8 @@
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "npm run clean && docusaurus start",
"build": "npm run clean && cross-env NODE_OPTIONS=\"--max_old_space_size=7500\" docusaurus build",
"start": "yarn && docusaurus start",
"build": "yarn clean && cross-env NODE_OPTIONS=\"--max_old_space_size=7500\" docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
@@ -24,7 +24,7 @@
"format": "prettier --write \"{src,static,scripts,docs}/**/*.{js,jsx,ts,tsx,css,scss,json,md,mdx,yml}\"",
"format:check": "prettier --check \"{src,static,scripts,docs}/**/*.{js,jsx,ts,tsx,css,scss,json,md,mdx,yml}\"",
"test:lint": "run-s lint:no-fix format:check lint:md-no-fix",
"vercel-build": "npm run build",
"vercel-build": "yarn build",
"postinstall": "patch-package"
},
"dependencies": {

View File

@@ -35,7 +35,7 @@ request:
![An image showing the style of comment the automatic deno checker reports](./images/deno_types_out_of_sync.png)
The easiest way to solve this is to run the `build:deno` script (`npm run build:deno`) and pushing the results.
The easiest way to solve this is to run the `build:deno` script (`yarn build:deno`) and pushing the results.
### Figure out if the update you want to contribute respects our rules about documentation

10218
yarn.lock Normal file

File diff suppressed because it is too large Load Diff