build: pnpm (#9806)

This commit is contained in:
Noel
2023-08-27 20:24:03 +02:00
committed by GitHub
parent 8325fa6540
commit e96a8a977f
82 changed files with 24444 additions and 28614 deletions

View File

@@ -6,10 +6,10 @@
"private": true,
"scripts": {
"test": "vitest run",
"build": "tsup",
"build": "tsc --noEmit --skipLibCheck && tsup",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"fmt": "yarn format"
"fmt": "pnpm run format"
},
"type": "module",
"directories": {
@@ -48,16 +48,16 @@
},
"devDependencies": {
"@types/node": "16.18.44",
"@vitest/coverage-v8": "^0.34.2",
"@vitest/coverage-v8": "^0.34.3",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",
"turbo": "^1.10.13",
"typescript": "^5.2.2",
"vitest": "^0.34.2"
"vitest": "^0.34.3"
},
"engines": {
"node": ">=16.11.0"

View File

@@ -0,0 +1,42 @@
name: 'pnpm install'
description: 'Run pnpm install with cache enabled'
runs:
using: 'composite'
steps:
- name: Set up swap space
if: runner.os == 'Linux'
uses: pierotofy/set-swap-space@v1.0
with:
swap-size-gb: 10
- uses: pnpm/action-setup@v2.2.4
name: Install pnpm
with:
run_install: false
- name: Expose pnpm config(s) through "$GITHUB_OUTPUT"
id: pnpm-config
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Cache rotation keys
id: cache-rotation
shell: bash
run: |
echo "YEAR_MONTH=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
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') }}
restore-keys: |
${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-
- name: Install dependencies
shell: bash
run: |
pnpm install --frozen-lockfile --prefer-offline --loglevel error
env:
HUSKY: '0'

View File

@@ -12,24 +12,29 @@ runs:
- name: Expose yarn config as "$GITHUB_OUTPUT"
id: yarn-config
shell: bash
env:
YARN_ENABLE_GLOBAL_CACHE: 'false'
run: |
echo "CACHE_FOLDER=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
echo "CURRENT_NODE_VERSION="node-$(node --version)"" >> $GITHUB_OUTPUT
echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's,/,-,g')" >> $GITHUB_OUTPUT
echo "NPM_GLOBAL_CACHE_FOLDER=$(npm config get cache)" >> $GITHUB_OUTPUT
- name: Restore yarn cache
uses: actions/cache@v3
id: yarn-download-cache
with:
path: ${{ steps.yarn-config.outputs.CACHE_FOLDER }}
key: yarn-download-cache-${{ hashFiles('yarn.lock') }}
key: yarn-download-cache-default-${{ hashFiles(yarn.lock, .yarnrc.yml) }}
restore-keys: |
yarn-download-cache-
yarn-download-cache-default-
- name: Restore yarn install state
id: yarn-install-state-cache
- name: Restore global npm cache folder
id: npm-global-cache
uses: actions/cache@v3
with:
path: .yarn/ci-cache/
key: ${{ runner.os }}-yarn-install-state-cache-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}
path: ${{ steps.yarn-config.outputs.NPM_GLOBAL_CACHE_FOLDER }}
key: npm-global-cache-default-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ hashFiles(yarn.lock, .yarnrc.yml) }}
- name: Install dependencies
shell: bash
@@ -37,6 +42,7 @@ runs:
yarn install --immutable --inline-builds
env:
YARN_ENABLE_GLOBAL_CACHE: 'false'
YARN_ENABLE_MIRROR: 'false'
YARN_NM_MODE: 'hardlinks-local'
YARN_INSTALL_STATE_PATH: .yarn/ci-cache/install-state.gz
YARN_INSTALL_STATE_PATH: '.yarn/ci-cache/install-state.gz'
HUSKY: '0'

View File

@@ -5,6 +5,4 @@ export default createTsupConfig({
dts: false,
format: 'esm',
minify: 'terser',
keepNames: false,
sourcemap: false,
});

View File

@@ -5,10 +5,10 @@
"description": "Utilities for api-extractor",
"private": true,
"scripts": {
"build": "tsup",
"build": "tsc --noEmit && tsup",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"fmt": "yarn format"
"fmt": "pnpm run format"
},
"exports": {
".": {
@@ -51,7 +51,7 @@
"devDependencies": {
"@types/node": "16.18.44",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",

View File

@@ -2,5 +2,4 @@ import { createTsupConfig } from '../../tsup.config.js';
export default createTsupConfig({
minify: 'terser',
keepNames: false,
});

View File

@@ -5,13 +5,13 @@
"description": "Powerful set of message brokers",
"scripts": {
"test": "vitest run",
"build": "tsup",
"build": "tsc --noEmit --skipLibCheck && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"fmt": "yarn format",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn lint && yarn test && yarn build",
"fmt": "pnpm run format",
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "pnpm run lint && pnpm run test && pnpm run build",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/brokers/*'",
"release": "cliff-jumper"
},
@@ -74,16 +74,16 @@
"@favware/cliff-jumper": "^2.1.1",
"@microsoft/api-extractor": "^7.36.4",
"@types/node": "16.18.44",
"@vitest/coverage-v8": "^0.34.2",
"@vitest/coverage-v8": "^0.34.3",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",
"turbo": "^1.10.13",
"typescript": "^5.2.2",
"vitest": "^0.34.2"
"vitest": "^0.34.3"
},
"engines": {
"node": ">=16.11.0"

View File

@@ -5,13 +5,13 @@
"description": "A set of builders that you can use when creating your bot",
"scripts": {
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc -p tsconfig.docs.json && yarn downlevel-dts ./dist-docs ./dist-docs",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json && downlevel-dts ./dist-docs ./dist-docs",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"fmt": "yarn format",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn lint && yarn test && yarn build",
"fmt": "pnpm run format",
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "pnpm run lint && pnpm run test && pnpm run build",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/builders/*'",
"release": "cliff-jumper"
},
@@ -76,18 +76,18 @@
"@favware/cliff-jumper": "^2.1.1",
"@microsoft/api-extractor": "^7.36.4",
"@types/node": "16.18.44",
"@vitest/coverage-v8": "^0.34.2",
"@vitest/coverage-v8": "^0.34.3",
"cross-env": "^7.0.3",
"downlevel-dts": "^0.11.0",
"esbuild-plugin-version-injector": "^1.2.0",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",
"turbo": "^1.10.13",
"typescript": "^5.2.2",
"vitest": "^0.34.2"
"vitest": "^0.34.3"
},
"engines": {
"node": ">=16.11.0"

View File

@@ -5,13 +5,13 @@
"description": "Utility data structure used in discord.js",
"scripts": {
"test": "vitest run",
"build": "tsup",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"fmt": "yarn format",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn lint && yarn test && yarn build",
"fmt": "pnpm run format",
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "pnpm run lint && pnpm run test && pnpm run build",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/collection/*'",
"release": "cliff-jumper"
},
@@ -63,17 +63,17 @@
"@favware/cliff-jumper": "^2.1.1",
"@microsoft/api-extractor": "^7.36.4",
"@types/node": "16.18.44",
"@vitest/coverage-v8": "^0.34.2",
"@vitest/coverage-v8": "^0.34.3",
"cross-env": "^7.0.3",
"esbuild-plugin-version-injector": "^1.2.0",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",
"turbo": "^1.10.13",
"typescript": "^5.2.2",
"vitest": "^0.34.2"
"vitest": "^0.34.3"
},
"engines": {
"node": ">=16.11.0"

View File

@@ -5,12 +5,12 @@
"description": "A thinly abstracted wrapper around the rest API, and gateway.",
"scripts": {
"test": "vitest run",
"build": "tsup",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn build && yarn lint",
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "pnpm run build && pnpm run lint",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/core/*'",
"release": "cliff-jumper"
},
@@ -40,8 +40,7 @@
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"directories": {
"lib": "src",
"test": "__tests__"
"lib": "src"
},
"files": [
"dist"
@@ -76,17 +75,17 @@
"@favware/cliff-jumper": "^2.1.1",
"@microsoft/api-extractor": "^7.36.4",
"@types/node": "18.17.9",
"@vitest/coverage-v8": "^0.34.2",
"@vitest/coverage-v8": "^0.34.3",
"cross-env": "^7.0.3",
"esbuild-plugin-version-injector": "^1.2.0",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",
"turbo": "^1.10.13",
"typescript": "^5.2.2",
"vitest": "^0.34.2"
"vitest": "^0.34.3"
},
"engines": {
"node": ">=16.11.0"

View File

@@ -4,16 +4,17 @@
"version": "0.2.1",
"description": "A simple way to create a startup Discord bot.",
"scripts": {
"build": "tsup",
"build": "tsc --noEmit && tsup",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"prepack": "yarn build && yarn lint",
"prepack": "pnpm run build && pnpm run lint",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/create-discord-bot/*'",
"release": "cliff-jumper"
},
"type": "module",
"bin": "./dist/index.js",
"directories": {
"bin": "bin",
"lib": "src"
},
"files": [
@@ -59,19 +60,19 @@
"@types/node": "16.18.44",
"@types/prompts": "^2.4.4",
"@types/validate-npm-package-name": "^4.0.0",
"@vitest/coverage-v8": "^0.34.2",
"@vitest/coverage-v8": "^0.34.3",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"terser": "^5.19.2",
"tsup": "^7.2.0",
"typescript": "^5.2.2",
"vitest": "^0.34.2"
"vitest": "^0.34.3"
},
"engines": {
"node": ">=18.16.0"
"node": ">=18.17.1"
},
"publishConfig": {
"access": "public"

View File

@@ -4,7 +4,7 @@ import path from 'node:path';
import process from 'node:process';
import { URL } from 'node:url';
import glob from 'fast-glob';
import { red, yellow, green, cyan } from 'picocolors';
import picocolors from 'picocolors';
import type { PackageManager } from './helpers/packageManager.js';
import { install } from './helpers/packageManager.js';
import { GUIDE_URL } from './util/constants.js';
@@ -34,12 +34,16 @@ export async function createDiscordBot({ directory, installPackages, typescript,
// If the directory is actually a file or if it's not empty, throw an error.
if (!directoryStats.isDirectory() || (await readdir(root)).length > 0) {
console.error(red(`The directory ${yellow(`"${directoryName}"`)} is either not a directory or is not empty.`));
console.error(red(`Please specify an empty directory.`));
console.error(
picocolors.red(
`The directory ${picocolors.yellow(`"${directoryName}"`)} is either not a directory or is not empty.`,
),
);
console.error(picocolors.red(`Please specify an empty directory.`));
process.exit(1);
}
console.log(`Creating ${directoryName} in ${green(root)}.`);
console.log(`Creating ${directoryName} in ${picocolors.green(root)}.`);
const deno = packageManager === 'deno';
await cp(new URL(`../template/${deno ? 'Deno' : typescript ? 'TypeScript' : 'JavaScript'}`, import.meta.url), root, {
recursive: true,
@@ -82,12 +86,14 @@ export async function createDiscordBot({ directory, installPackages, typescript,
await writeFile(file, newData);
}
const newPackageJSON = await readFile('./package.json', { encoding: 'utf8' }).then((str) => {
let newStr = str.replace('[REPLACE_ME]', directoryName);
newStr = newStr.replaceAll('[REPLACE_IMPORT_EXT]', typescript ? 'ts' : 'js');
return newStr;
});
await writeFile('./package.json', newPackageJSON);
if (!deno) {
const newPackageJSON = await readFile('./package.json', { encoding: 'utf8' }).then((str) => {
let newStr = str.replace('[REPLACE_ME]', directoryName);
newStr = newStr.replaceAll('[REPLACE_IMPORT_EXT]', typescript ? 'ts' : 'js');
return newStr;
});
await writeFile('./package.json', newPackageJSON);
}
if (installPackages) {
try {
@@ -96,15 +102,15 @@ export async function createDiscordBot({ directory, installPackages, typescript,
console.log();
const err = error as ExecException;
if (err.signal === 'SIGINT') {
console.log(red('Installation aborted.'));
console.log(picocolors.red('Installation aborted.'));
} else {
console.error(red('Installation failed.'));
console.error(picocolors.red('Installation failed.'));
process.exit(1);
}
}
}
console.log();
console.log(green('All done! Be sure to read through the discord.js guide for help on your journey.'));
console.log(`Link: ${cyan(GUIDE_URL)}`);
console.log(picocolors.green('All done! Be sure to read through the discord.js guide for help on your journey.'));
console.log(`Link: ${picocolors.cyan(GUIDE_URL)}`);
}

View File

@@ -1,6 +1,6 @@
import { execSync } from 'node:child_process';
import process from 'node:process';
import { yellow } from 'picocolors';
import picocolors from 'picocolors';
import { DEFAULT_PACKAGE_MANAGER } from '../util/constants.js';
/**
@@ -32,7 +32,7 @@ export function resolvePackageManager(): PackageManager {
}
console.error(
yellow(
picocolors.yellow(
`Detected an unsupported package manager (${npmConfigUserAgent}). Falling back to ${DEFAULT_PACKAGE_MANAGER}.`,
),
);

View File

@@ -17,7 +17,7 @@
"devDependencies": {
"@sapphire/ts-config": "^4.0.1",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2"
}

View File

@@ -18,9 +18,9 @@
"@sapphire/ts-config": "^4.0.1",
"bun-types": "^0.7.3",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"typescript": "^5.1.6"
"typescript": "^5.2.2"
}
}

View File

@@ -17,7 +17,7 @@
},
"devDependencies": {
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2"
}

View File

@@ -18,11 +18,11 @@
},
"devDependencies": {
"@sapphire/ts-config": "^4.0.1",
"@types/node": "^18.17.6",
"@types/node": "^18.17.11",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"typescript": "^5.1.6"
"typescript": "^5.2.2"
}
}

View File

@@ -5,6 +5,5 @@ export default createTsupConfig({
dts: false,
format: 'esm',
minify: 'terser',
keepNames: false,
sourcemap: false,
});

View File

@@ -4,14 +4,14 @@
"version": "14.13.0",
"description": "A powerful library for interacting with the Discord API",
"scripts": {
"test": "yarn docs:test && yarn test:typescript",
"test": "pnpm run docs:test && pnpm run test:typescript",
"test:typescript": "tsc --noEmit && tsd",
"lint": "prettier --check . && tslint typings/index.d.ts && cross-env ESLINT_USE_FLAT_CONFIG=false eslint --format=pretty src",
"format": "prettier --write . && cross-env ESLINT_USE_FLAT_CONFIG=false eslint --fix --format=pretty src",
"fmt": "yarn format",
"fmt": "pnpm run format",
"docs": "docgen -i './src/*.js' './src/**/*.js' -c ./docs/index.json -r ../../ -o ./docs/docs.json",
"docs:test": "docgen -i './src/*.js' './src/**/*.js' -c ./docs/index.json -r ../../",
"prepack": "yarn lint && yarn test",
"prepack": "pnpm run lint && pnpm run test",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/discord.js/*'",
"release": "cliff-jumper"
},
@@ -72,7 +72,7 @@
"@types/node": "16.18.44",
"cross-env": "^7.0.3",
"dtslint": "4.2.1",
"eslint": "8.47.0",
"eslint": "8.48.0",
"eslint-formatter-pretty": "5.0.0",
"jest": "29.6.4",
"prettier": "3.0.2",

View File

@@ -24,4 +24,4 @@ const command = createCommand()
const program = command.parse(process.argv);
const options = program.opts<CLIOptions>();
build(options);
void build(options);

View File

@@ -7,8 +7,9 @@
"build": "tsup",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"fmt": "yarn format",
"prepack": "yarn format && yarn build"
"fmt": "pnpm run format",
"prepare": "pnpm run build",
"prepack": "pnpm run format && pnpm run build"
},
"bin": "./dist/bin/index.js",
"exports": {
@@ -27,6 +28,7 @@
"module": "./dist/src/index.mjs",
"types": "./dist/src/index.d.ts",
"directories": {
"bin": "bin",
"lib": "src"
},
"files": [
@@ -60,14 +62,14 @@
"commander": "^11.0.0",
"jsdoc-to-markdown": "^8.0.0",
"tslib": "^2.6.2",
"typedoc": "^0.24.8"
"typedoc": "^0.25.0"
},
"devDependencies": {
"@favware/cliff-jumper": "^2.1.1",
"@types/jsdoc-to-markdown": "^7.0.3",
"@types/node": "16.18.44",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",

View File

@@ -17,14 +17,12 @@ interface CustomFiles {
path?: string;
}
export function build({ input, custom: customDocs, root, output, typescript }: CLIOptions) {
export async function build({ input, custom: customDocs, root, output, typescript }: CLIOptions) {
let data: (ChildTypes & RootTypes)[] | DeclarationReflection[] = [];
if (typescript) {
console.log('Parsing Typescript in source files...');
const app = new Application();
app.options.addReader(new TSConfigReader());
app.bootstrap({ entryPoints: input });
const project = app.convert();
const app = await Application.bootstrap({ entryPoints: input }, [new TSConfigReader()]);
const project = await app.convert();
if (project) {
// @ts-expect-error: Types are lost with this method
data = app.serializer.toObject(project).children!;

View File

@@ -3,6 +3,4 @@ import { createTsupConfig } from '../../tsup.config.js';
export default createTsupConfig({
entry: ['src/index.ts', 'bin/index.ts'],
minify: 'terser',
keepNames: false,
sourcemap: false,
});

View File

@@ -5,12 +5,12 @@
"description": "A set of functions to format strings for Discord.",
"scripts": {
"test": "vitest run",
"build": "tsup",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn build && yarn lint",
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "pnpm run build && pnpm run lint",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/formatters/*'",
"release": "cliff-jumper"
},
@@ -60,16 +60,16 @@
"@favware/cliff-jumper": "^2.1.1",
"@microsoft/api-extractor": "^7.36.4",
"@types/node": "16.18.44",
"@vitest/coverage-v8": "^0.34.2",
"@vitest/coverage-v8": "^0.34.3",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",
"turbo": "^1.10.13",
"typescript": "^5.2.2",
"vitest": "^0.34.2"
"vitest": "^0.34.3"
},
"engines": {
"node": ">=16.11.0"

View File

@@ -5,12 +5,12 @@
"description": "A powerful TypeScript library for interacting with the Discord API",
"scripts": {
"test": "vitest run",
"build": "tsup",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn build && yarn lint",
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "pnpm run build && pnpm run lint",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/next/*'",
"release": "cliff-jumper"
},
@@ -77,20 +77,20 @@
"@favware/cliff-jumper": "^2.1.1",
"@microsoft/api-extractor": "^7.36.4",
"@types/node": "18.17.9",
"@vitest/coverage-v8": "^0.34.2",
"@vitest/coverage-v8": "^0.34.3",
"cross-env": "^7.0.3",
"esbuild-plugin-version-injector": "^1.2.0",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",
"turbo": "^1.10.13",
"typescript": "^5.2.2",
"vitest": "^0.34.2"
"vitest": "^0.34.3"
},
"engines": {
"node": ">=18.13.0"
"node": ">=18.17.1"
},
"publishConfig": {
"access": "public"

View File

@@ -1,26 +1,34 @@
FROM node:18-alpine AS builder
FROM node:18-alpine AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN apk update
RUN apk add --no-cache libc6-compat
WORKDIR /usr/proxy
RUN corepack enable
RUN corepack prepare pnpm@latest --activate
COPY manifests .
COPY . /usr/proxy-container
WORKDIR /usr/proxy-container
RUN npm install --global is-ci husky
FROM base AS builder
RUN yarn install --immutable --inline-builds
RUN rm -rf .yarn/cache
RUN pnpm install --frozen-lockfile --ignore-scripts
RUN pnpm exec turbo run build --filter='@discordjs/proxy-container...'
FROM node:18-alpine AS runner
FROM builder AS pruned
WORKDIR /usr/proxy
RUN pnpm --filter='@discordjs/proxy-container' --prod deploy pruned
FROM node:18-alpine AS proxy
WORKDIR /usr/proxy-container
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 proxy
USER proxy
RUN adduser --system --uid 1001 proxy-container
USER proxy-container
COPY --from=builder /usr/proxy .
COPY packs .
COPY --from=pruned /usr/proxy-container/pruned .
CMD ["node", "--enable-source-maps", "dist/index.js"]

View File

@@ -4,11 +4,11 @@
"version": "1.0.0",
"description": "Lightweight HTTP proxy for Discord's API, brought to you as a container 📦",
"scripts": {
"build": "tsup",
"build": "tsc --noEmit && tsup",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"fmt": "yarn format",
"prepack": "yarn lint && yarn build"
"fmt": "pnpm run format",
"prepack": "pnpm run lint && pnpm run build"
},
"type": "module",
"directories": {
@@ -51,7 +51,7 @@
"devDependencies": {
"@types/node": "18.17.9",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",

View File

@@ -3,6 +3,8 @@ import process from 'node:process';
import { proxyRequests } from '@discordjs/proxy';
import { REST } from '@discordjs/rest';
process.on('SIGINT', () => process.exit(0));
// We want to let upstream handle retrying
const api = new REST({ rejectOnRateLimit: () => true, retries: 0 });
const server = createServer(proxyRequests(api));

View File

@@ -5,13 +5,13 @@
"description": "Tools for running an HTTP proxy for Discord's API",
"scripts": {
"test": "vitest run",
"build": "tsup",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"fmt": "yarn format",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn lint && yarn test && yarn build",
"fmt": "pnpm run format",
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "pnpm run lint && pnpm run test && pnpm run build",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/proxy/*'",
"release": "cliff-jumper"
},
@@ -74,9 +74,9 @@
"@microsoft/api-extractor": "^7.36.4",
"@types/node": "18.17.9",
"@types/supertest": "^2.0.12",
"@vitest/coverage-v8": "^0.34.2",
"@vitest/coverage-v8": "^0.34.3",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
@@ -84,7 +84,7 @@
"tsup": "^7.2.0",
"turbo": "^1.10.13",
"typescript": "^5.2.2",
"vitest": "^0.34.2"
"vitest": "^0.34.3"
},
"engines": {
"node": ">=16.11.0"

View File

@@ -5,13 +5,13 @@
"description": "The REST API for discord.js",
"scripts": {
"test": "vitest run",
"build": "tsup",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"fmt": "yarn format",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn lint && yarn test && yarn build",
"fmt": "pnpm run format",
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "pnpm run lint && pnpm run test && pnpm run build",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/rest/*'",
"release": "cliff-jumper"
},
@@ -96,17 +96,17 @@
"@favware/cliff-jumper": "^2.1.1",
"@microsoft/api-extractor": "^7.36.4",
"@types/node": "18.17.9",
"@vitest/coverage-v8": "^0.34.2",
"@vitest/coverage-v8": "^0.34.3",
"cross-env": "^7.0.3",
"esbuild-plugin-version-injector": "^1.2.0",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",
"turbo": "^1.10.13",
"typescript": "^5.2.2",
"vitest": "^0.34.2"
"vitest": "^0.34.3"
},
"engines": {
"node": ">=16.11.0"

View File

@@ -5,10 +5,10 @@
"description": "A set of scripts that we use for our workflows",
"private": true,
"scripts": {
"build": "tsup",
"build": "tsc --noEmit && tsup",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src turbo",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src turbo",
"fmt": "yarn format"
"fmt": "pnpm run format"
},
"exports": {
".": {
@@ -26,7 +26,8 @@
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"directories": {
"lib": "src"
"lib": "src",
"example": "turbo"
},
"files": [
"dist"
@@ -63,16 +64,16 @@
"devDependencies": {
"@turbo/gen": "^1.10.13",
"@types/node": "16.18.44",
"@vitest/coverage-v8": "^0.34.2",
"@vitest/coverage-v8": "^0.34.3",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",
"turbo": "^1.10.13",
"typescript": "^5.2.2",
"vitest": "^0.34.2"
"vitest": "^0.34.3"
},
"engines": {
"node": ">=16.11.0"

View File

@@ -2,5 +2,4 @@ import { createTsupConfig } from '../../tsup.config.js';
export default createTsupConfig({
minify: 'terser',
keepNames: false,
});

View File

@@ -4,12 +4,12 @@
"description": "{{description}}",
"scripts": {
"test": "vitest run",
"build": "tsup",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn build && yarn lint",
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "pnpm run build && pnpm run lint",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/{{name}}/*'",
"release": "cliff-jumper"
},
@@ -62,11 +62,11 @@
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",
"typescript": "^5.1.6",
"typescript": "^5.2.2",
"vitest": "^0.34.2"
},
"engines": {
"node": ">=18.16.0"
"node": ">=18.17.1"
},
"publishConfig": {
"access": "public"

View File

@@ -8,7 +8,7 @@
"build": "vite build",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"prepack": "yarn build && yarn lint",
"prepack": "pnpm run build && pnpm run lint",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/ui/*'",
"release": "cliff-jumper",
"storybook": "storybook dev -p 6006",
@@ -52,7 +52,7 @@
"homepage": "https://discord.js.org",
"dependencies": {
"@react-icons/all-files": "^4.1.0",
"ariakit": "^2.0.0-next.44",
"ariakit": "2.0.0-next.44",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
@@ -62,7 +62,7 @@
"@storybook/addon-essentials": "^7.3.2",
"@storybook/addon-interactions": "^7.3.2",
"@storybook/addon-links": "^7.3.2",
"@storybook/addon-styling": "^1.3.6",
"@storybook/addon-styling": "^1.3.7",
"@storybook/blocks": "^7.3.2",
"@storybook/react": "^7.3.2",
"@storybook/react-vite": "^7.3.2",
@@ -70,13 +70,13 @@
"@types/node": "16.18.44",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@unocss/eslint-plugin": "^0.55.2",
"@unocss/reset": "^0.55.2",
"@unocss/eslint-plugin": "^0.55.3",
"@unocss/reset": "^0.55.3",
"@vitejs/plugin-react": "^4.0.4",
"@vitest/coverage-c8": "^0.33.0",
"chromatic": "^6.24.0",
"@vitest/coverage-v8": "^0.34.3",
"chromatic": "^6.24.1",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
@@ -84,10 +84,10 @@
"storybook": "^7.3.2",
"turbo": "^1.10.13",
"typescript": "^5.2.2",
"unocss": "^0.55.2",
"unocss": "^0.55.3",
"vite": "^4.4.9",
"vite-plugin-dts": "^3.5.2",
"vitest": "^0.34.2"
"vitest": "^0.34.3"
},
"engines": {
"node": ">=16.11.0"

View File

@@ -3,12 +3,9 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"isolatedModules": true,
"jsx": "preserve",
"baseUrl": ".",
"noEmit": true,
"allowJs": false,
"incremental": true,
"skipLibCheck": true,
"paths": {
"~/*": ["./src/*"]

View File

@@ -4,14 +4,14 @@
"version": "1.0.1",
"description": "Utilities shared across Discord.js packages",
"scripts": {
"build": "tsup",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"test": "vitest run && tsd",
"lint": "prettier --check . && TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && TIMING=1 eslint --fix --format=pretty src",
"fmt": "yarn format",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn lint && yarn test && yarn build",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"fmt": "pnpm run format",
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "pnpm run lint && pnpm run test && pnpm run build",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/util/*'",
"release": "cliff-jumper"
},
@@ -64,9 +64,9 @@
"@favware/cliff-jumper": "^2.1.1",
"@microsoft/api-extractor": "^7.36.4",
"@types/node": "16.18.44",
"@vitest/coverage-v8": "^0.34.2",
"@vitest/coverage-v8": "^0.34.3",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
@@ -74,7 +74,7 @@
"tsup": "^7.2.0",
"turbo": "^1.10.13",
"typescript": "^5.2.2",
"vitest": "^0.34.2"
"vitest": "^0.34.3"
},
"engines": {
"node": ">=16.11.0"

View File

@@ -4,14 +4,14 @@
"version": "0.16.0",
"description": "Implementation of the Discord Voice API for Node.js",
"scripts": {
"build": "tsup && node scripts/postbuild.mjs",
"build": "tsc --noEmit && tsup && node scripts/postbuild.mjs",
"build:docs": "tsc -p tsconfig.docs.json",
"test": "jest --coverage",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"fmt": "yarn format",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn lint && yarn test && yarn build",
"fmt": "pnpm run format",
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "pnpm run lint && pnpm run test && pnpm run build",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/voice/*'",
"release": "cliff-jumper"
},
@@ -78,7 +78,7 @@
"@types/node": "16.18.44",
"cross-env": "^7.0.3",
"esbuild-plugin-version-injector": "^1.2.0",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"jest": "^29.6.4",

View File

@@ -5,12 +5,12 @@
"description": "Wrapper around Discord's gateway",
"scripts": {
"test": "vitest run",
"build": "tsup",
"build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn build && yarn lint",
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "pnpm run build && pnpm run lint",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/ws/*'",
"release": "cliff-jumper"
},
@@ -86,10 +86,10 @@
"@favware/cliff-jumper": "^2.1.1",
"@microsoft/api-extractor": "^7.36.4",
"@types/node": "18.17.9",
"@vitest/coverage-v8": "^0.34.2",
"@vitest/coverage-v8": "^0.34.3",
"cross-env": "^7.0.3",
"esbuild-plugin-version-injector": "^1.2.0",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0",
"mock-socket": "^9.2.1",
@@ -98,7 +98,7 @@
"turbo": "^1.10.13",
"typescript": "^5.2.2",
"undici": "5.23.0",
"vitest": "^0.34.2",
"vitest": "^0.34.3",
"zlib-sync": "^0.1.8"
},
"engines": {