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

@@ -11,22 +11,21 @@ is a great boon to your development process.
To get ready to work on the codebase, please do the following: To get ready to work on the codebase, please do the following:
1. Fork & clone the repository, and make sure you're on the **main** branch 1. Fork & clone the repository, and make sure you're on the **main** branch
2. Run `yarn --immutable` ([install](https://yarnpkg.com/getting-started/install)) 2. Run `pnpm install --frozen-lockfile` ([install](https://pnpm.io/installation))
3. Run `yarn build` to build local packages 3. Run `pnpm run build` to build local packages
4. Code your heart out! 4. Code your heart out!
5. Run `yarn test` to run ESLint and ensure any JSDoc changes are valid 5. Run `pnpm run test` to run ESLint and ensure any JSDoc changes are valid
6. [Submit a pull request](https://github.com/discordjs/discord.js/compare) (Make sure you follow the [conventional commit format](https://github.com/discordjs/discord.js/blob/main/.github/COMMIT_CONVENTION.md)) 6. [Submit a pull request](https://github.com/discordjs/discord.js/compare) (Make sure you follow the [conventional commit format](https://github.com/discordjs/discord.js/blob/main/.github/COMMIT_CONVENTION.md))
## Testing changes locally ## Testing changes locally
If you want to test changes you've made locally, you can do so by using `yarn link`. This will create a symlink to your local copy of the discord.js libraries. If you want to test changes you've made locally, you can do so by using `pnpm link <package-you-want-to-link-to-your-current-package>`. This will create a symlink to your local copy of the discord.js libraries.
1. Create a new directory `mkdir discordjs-test` and move into it `cd discordjs-test` 1. Create a new directory `mkdir discordjs-test` and move into it `cd discordjs-test`
2. Initialize a new yarn 3 project `yarn init -2` 2. Initialize a new pnpm project `pnpm init`
3. Disable pnp `yarn config set nodeLinker node-modules` 3. Now link the local discord.js project you cloned earlier `pnpm link {PATH_TO_DISCORDJS_REPO}`
4. Now link the local discord.js project you cloned earlier `yarn link -A {PATH_TO_DISCORDJS_REPO}` 4. Install packages you'd like to test locally `pnpm add discord.js@latest`, `pnpm add @discordjs/rest@latest`, etc. **Note: Make sure you use `latest` tag or else pnpm will try to install the remote package from npm**
5. Install packages you'd like to test locally `yarn add discord.js@latest`, `yarn add @discordjs/rest@latest`, etc. **Note: Make sure you use `latest` tag or else yarn will try to install the remote package from npm** 5. Import the package in your source code and test them out!
6. Import the package in your source code and test them out!
### Working with TypeScript packages ### Working with TypeScript packages
@@ -34,14 +33,14 @@ When testing local changes, you may notice you need to manually recompile TypeSc
To avoid this you can use the `--watch` parameter in the package build script to automatically recompile the project when changes are detected. To avoid this you can use the `--watch` parameter in the package build script to automatically recompile the project when changes are detected.
For example, to automatically recompile the `@discordjs/rest` project when changes are detected, run `yarn turbo run build --filter=@discordjs/rest --concurrency=3 -- --watch` in the root folder of where you cloned the discord.js repo. For example, to automatically recompile the `@discordjs/rest` project when changes are detected, run `pnpm turbo run build --filter='@discordjs/rest' -- --watch` in the root folder of where you cloned the discord.js repo.
## Adding new packages ## Adding new packages
If you'd like to create another package under the `@discordjs` organization run the following command: If you'd like to create another package under the `@discordjs` organization run the following command:
```sh ```sh
yarn create-package <package-name> [package-description] pnpm run create-package <package-name> [package-description]
``` ```
This will create new package directory under `packages/` with the required configuration files. You can This will create new package directory under `packages/` with the required configuration files. You can

View File

@@ -4,6 +4,7 @@ on:
pull_request: pull_request:
types: types:
- closed - closed
workflow_dispatch:
jobs: jobs:
cleanup: cleanup:
name: Cleanup caches name: Cleanup caches

View File

@@ -42,13 +42,13 @@ jobs:
node-version: 18 node-version: 18
- name: Install dependencies - name: Install dependencies
uses: ./packages/actions/src/yarnCache uses: ./packages/actions/src/pnpmCache
- name: Build dependencies - name: Build dependencies
run: yarn build run: pnpm run build
- name: Build docs - name: Build docs
run: yarn docs run: pnpm run docs
- name: Checkout docs repository - name: Checkout docs repository
uses: actions/checkout@v3 uses: actions/checkout@v3

View File

@@ -18,9 +18,9 @@ jobs:
node-version: 18 node-version: 18
- name: Install dependencies - name: Install dependencies
uses: ./packages/actions/src/yarnCache uses: ./packages/actions/src/pnpmCache
- name: Deprecate versions - name: Deprecate versions
run: 'yarn npm-deprecate --name "*dev*" --package @discordjs/brokers @discordjs/builders @discordjs/collection @discordjs/core @discordjs/formatters discord.js @discordjs/next @discordjs/proxy @discordjs/rest @discordjs/util @discordjs/voice @discordjs/ws' run: 'pnpm exec npm-deprecate --name "*dev*" --package @discordjs/brokers @discordjs/builders @discordjs/collection @discordjs/core @discordjs/formatters discord.js @discordjs/next @discordjs/proxy @discordjs/rest @discordjs/util @discordjs/voice @discordjs/ws'
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

View File

@@ -18,10 +18,7 @@ jobs:
node-version: 18 node-version: 18
- name: Install dependencies - name: Install dependencies
uses: ./packages/actions/src/yarnCache uses: ./packages/actions/src/pnpmCache
- name: Build dependencies
run: yarn build
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
@@ -30,4 +27,4 @@ jobs:
run: echo ${{ secrets.DOCKER_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin run: echo ${{ secrets.DOCKER_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Build & push docker image - name: Build & push docker image
run: yarn docker build --buildkit @discordjs/proxy-container -t discordjs/proxy:latest --push run: docker build -f packages/proxy-container/Dockerfile -t discordjs/proxy:latest --push .

View File

@@ -52,14 +52,14 @@ jobs:
registry-url: https://registry.npmjs.org/ registry-url: https://registry.npmjs.org/
- name: Install dependencies - name: Install dependencies
uses: ./packages/actions/src/yarnCache uses: ./packages/actions/src/pnpmCache
- name: Build dependencies - name: Build dependencies
run: yarn build run: pnpm run build
- name: Publish package - name: Publish package
run: | run: |
yarn workspace ${{ matrix.package }} release --preid "dev.$(date +%s)-$(git rev-parse --short HEAD)" pnpm --filter=${{ matrix.package }} run release --preid "dev.$(date +%s)-$(git rev-parse --short HEAD)"
yarn workspace ${{ matrix.package }} npm publish --tag dev || true pnpm --filter=${{ matrix.package }} publish --tag dev || true
env: env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

View File

@@ -15,10 +15,7 @@ jobs:
node-version: 18 node-version: 18
- name: Install dependencies - name: Install dependencies
uses: ./packages/actions/src/yarnCache uses: ./packages/actions/src/pnpmCache
- name: Build dependencies
run: yarn build
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
@@ -27,4 +24,4 @@ jobs:
run: echo ${{ secrets.DOCKER_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin run: echo ${{ secrets.DOCKER_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Build & push docker image - name: Build & push docker image
run: yarn docker build --buildkit @discordjs/proxy-container -t discordjs/proxy:$(cut -d '.' -f1 <<< $(jq --raw-output '.version' packages/proxy-container/package.json)) --push run: docker build -f packages/proxy-container/Dockerfile -t discordjs/proxy:$(cut -d '.' -f1 <<< $(jq --raw-output '.version' packages/proxy-container/package.json)) --push .

View File

@@ -21,10 +21,10 @@ jobs:
registry-url: https://registry.npmjs.org/ registry-url: https://registry.npmjs.org/
- name: Install dependencies - name: Install dependencies
uses: ./packages/actions/src/yarnCache uses: ./packages/actions/src/pnpmCache
- name: Build dependencies - name: Build dependencies
run: yarn build run: pnpm run build
- name: Extract package and semver from tag - name: Extract package and semver from tag
id: extract-tag id: extract-tag
@@ -34,6 +34,6 @@ jobs:
- name: Publish package - name: Publish package
run: | run: |
yarn workspace ${{ steps.extract-tag.outputs.subpackage == 'true' && '@discordjs/' || '' }}${{ steps.extract-tag.outputs.package }} npm publish pnpm --filter=${{ steps.extract-tag.outputs.subpackage == 'true' && '@discordjs/' || '' }}${{ steps.extract-tag.outputs.package }} publish
env: env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

View File

@@ -25,39 +25,39 @@ jobs:
node-version: 18 node-version: 18
- name: Install dependencies - name: Install dependencies
uses: ./packages/actions/src/yarnCache uses: ./packages/actions/src/pnpmCache
- name: Build dependencies (PR) - name: Build dependencies (PR)
if: ${{ github.event_name != 'push' }} if: ${{ github.event_name != 'push' }}
run: yarn turbo run build --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]" --concurrency=3 run: pnpm exec turbo run build --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]" --concurrency=4
- name: Build dependencies (Push) - name: Build dependencies (Push)
if: ${{ github.event_name == 'push' }} if: ${{ github.event_name == 'push' }}
run: yarn turbo run build --filter="...[HEAD^1]" --concurrency=3 run: pnpm exec turbo run build --filter="...[HEAD^1]" --concurrency=4
- name: ESLint (PR) - name: ESLint (PR)
if: ${{ github.event_name != 'push' }} if: ${{ github.event_name != 'push' }}
run: yarn turbo run lint --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]" --concurrency=3 -- --format=compact run: pnpm exec turbo run lint --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]" --concurrency=4 -- --format=compact
- name: ESLint (Push) - name: ESLint (Push)
if: ${{ github.event_name == 'push' }} if: ${{ github.event_name == 'push' }}
run: yarn turbo run lint --filter="...[HEAD^1]" --concurrency=3 -- --format=compact run: pnpm exec turbo run lint --filter="...[HEAD^1]" --concurrency=4 -- --format=compact
- name: Tests (PR) - name: Tests (PR)
if: ${{ github.event_name != 'push' }} if: ${{ github.event_name != 'push' }}
run: yarn turbo run test --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]" --concurrency=3 run: pnpm exec turbo run test --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]" --concurrency=4
- name: Tests (Push) - name: Tests (Push)
if: ${{ github.event_name == 'push' }} if: ${{ github.event_name == 'push' }}
run: yarn turbo run test --filter="...[HEAD^1]" --concurrency=3 run: pnpm exec turbo run test --filter="...[HEAD^1]" --concurrency=4
- name: Docs (PR) - name: Docs (PR)
if: ${{ github.event_name != 'push' }} if: ${{ github.event_name != 'push' }}
run: yarn turbo run docs --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]" --concurrency=3 run: pnpm exec turbo run docs --filter="...[origin/${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref || 'main' }}]" --concurrency=4
- name: Docs (Push) - name: Docs (Push)
if: ${{ github.event_name == 'push' }} if: ${{ github.event_name == 'push' }}
run: yarn turbo run docs --filter="...[HEAD^1]" --concurrency=3 run: pnpm exec turbo run docs --filter="...[HEAD^1]" --concurrency=4
- name: Upload Coverage - name: Upload Coverage
if: github.repository_owner == 'discordjs' if: github.repository_owner == 'discordjs'

View File

@@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
. "$(dirname "$0")/_/husky.sh" . "$(dirname "$0")/_/husky.sh"
yarn commitlint --edit $1 pnpm exec commitlint --edit $1

View File

@@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
. "$(dirname "$0")/_/husky.sh" . "$(dirname "$0")/_/husky.sh"
yarn build:affected && yarn lint-staged pnpm run build:affected && pnpm exec lint-staged

7
.npmrc Normal file
View File

@@ -0,0 +1,7 @@
auto-install-peers=false
resolution-mode=highest
public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=*prettier*
public-hoist-pattern[]=*@rushstack/node-core-library*
public-hoist-pattern[]=*@microsoft/api-extractor-model*
public-hoist-pattern[]=*jju*

View File

@@ -2,7 +2,11 @@
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"], "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
"eslint.useESLintClass": true, "eslint.useESLintClass": true,
"eslint.experimental.useFlatConfig": true, "eslint.experimental.useFlatConfig": true,
"eslint.workingDirectories": [{ "mode": "auto" }], "eslint.workingDirectories": [
{ "directory": "${workspaceFolder}" },
{ "pattern": "./apps/*/" },
{ "pattern": "./packages/*/" }
],
"editor.defaultFormatter": "esbenp.prettier-vscode", "editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
@@ -16,7 +20,7 @@
}, },
"files.insertFinalNewline": true, "files.insertFinalNewline": true,
"files.eol": "\n", "files.eol": "\n",
"npm.packageManager": "yarn", "npm.packageManager": "pnpm",
"typescript.tsdk": "node_modules/typescript/lib", "typescript.tsdk": "node_modules/typescript/lib",
"deno.enablePaths": ["./packages/create-discord-bot/template/Deno"], "deno.enablePaths": ["./packages/create-discord-bot/template/Deno"],
"deno.lint": true, "deno.lint": true,

View File

@@ -1,18 +0,0 @@
diff --git a/package.json b/package.json
index fc35658a40f9ba3e3513c459ba9f4f6e1b3f59f5..bc35eda66f270c95ba52e721cb6976fd61622c58 100644
--- a/package.json
+++ b/package.json
@@ -26,11 +26,13 @@
},
"exports": {
".": {
+ "types": "./dist/index.d.ts",
"node": "./dist/index.js",
"default": "./browser/index.js"
},
"./package.json": "./package.json",
"./util": {
+ "types": "./dist/util.d.ts",
"node": "./dist/util.js",
"default": "./browser/dist/util.js"
}

View File

@@ -1,260 +0,0 @@
/* eslint-disable */
module.exports = {
name: '@yarnpkg/plugin-docker-build',
factory: function (require) {
var plugin;
(() => {
'use strict';
var t = {
d: (e, o) => {
for (var r in o) t.o(o, r) && !t.o(e, r) && Object.defineProperty(e, r, { enumerable: !0, get: o[r] });
},
o: (t, e) => Object.prototype.hasOwnProperty.call(t, e),
r: (t) => {
'undefined' != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(t, Symbol.toStringTag, { value: 'Module' }),
Object.defineProperty(t, '__esModule', { value: !0 });
},
},
e = {};
t.r(e), t.d(e, { default: () => u });
const o = require('@yarnpkg/cli'),
r = require('clipanion'),
i = require('@yarnpkg/core'),
a = require('@yarnpkg/plugin-patch'),
n = require('@yarnpkg/fslib');
const s = require('@yarnpkg/plugin-pack');
async function c({ workspace: t, destination: e, report: o }) {
await s.packUtils.prepareForPack(t, { report: o }, async () => {
const r = await s.packUtils.genPackList(t),
a = i.Report.progressViaCounter(r.length),
c = o.reportProgress(a);
try {
for (const i of r) {
const r = n.ppath.join(t.cwd, i),
s = n.ppath.join(e, t.relativeCwd, i);
o.reportInfo(null, i), await n.xfs.copyPromise(s, r, { overwrite: !0 }), a.tick();
}
} finally {
c.stop();
}
});
}
function p(t, e) {
const o = (0, n.toFilename)(e);
return n.ppath.isAbsolute(o) ? n.ppath.relative(t, o) : o;
}
const l = /^builtin<([^>]+)>$/;
var d = function (t, e, o, r) {
var i,
a = arguments.length,
n = a < 3 ? e : null === r ? (r = Object.getOwnPropertyDescriptor(e, o)) : r;
if ('object' == typeof Reflect && 'function' == typeof Reflect.decorate) n = Reflect.decorate(t, e, o, r);
else
for (var s = t.length - 1; s >= 0; s--)
(i = t[s]) && (n = (a < 3 ? i(n) : a > 3 ? i(e, o, n) : i(e, o)) || n);
return a > 3 && n && Object.defineProperty(e, o, n), n;
};
class f extends o.BaseCommand {
constructor() {
super(...arguments), (this.args = []);
}
async execute() {
const t = await i.Configuration.find(this.context.cwd, this.context.plugins),
{ project: e } = await i.Project.find(t, this.context.cwd),
o = e.getWorkspaceByIdent(i.structUtils.parseIdent(this.workspaceName)),
r = (function ({
project: t,
workspaces: e,
production: o = !1,
scopes: r = o ? ['dependencies'] : i.Manifest.hardDependencies,
}) {
const a = new Set([...e]);
for (const e of a)
for (const o of r) {
const r = e.manifest.getForScope(o).values();
for (const e of r) {
const o = t.tryWorkspaceByDescriptor(e);
o && a.add(o);
}
}
for (const e of t.workspaces)
a.has(e)
? o && e.manifest.devDependencies.clear()
: (e.manifest.dependencies.clear(),
e.manifest.devDependencies.clear(),
e.manifest.peerDependencies.clear());
return a;
})({ project: e, workspaces: [o], production: this.production }),
s = await (async function (t, e = 'Dockerfile') {
const o = (0, n.toFilename)(e);
if (n.ppath.isAbsolute(o)) return o;
const r = [n.ppath.join(t.cwd, o), n.ppath.join(t.project.cwd, o)];
for (const t of r) if (await n.xfs.existsPromise(t)) return t;
throw new Error('Dockerfile is required');
})(o, this.dockerFilePath),
d = await i.Cache.find(t);
return (
await i.StreamReport.start(
{ configuration: t, stdout: this.context.stdout, includeLogs: !this.context.quiet },
async (t) => {
await t.startTimerPromise('Resolution Step', async () => {
await e.resolveEverything({ report: t, cache: d });
}),
await t.startTimerPromise('Fetch Step', async () => {
await e.fetchEverything({ report: t, cache: d });
}),
await n.xfs.mktempPromise(async (o) => {
const f = n.ppath.join(o, (0, n.toFilename)('manifests')),
u = n.ppath.join(o, (0, n.toFilename)('packs'));
await t.startTimerPromise('Copy files', async () => {
await (async function ({ destination: t, project: e, report: o }) {
const r = e.configuration.get('rcFilename');
o.reportInfo(null, r),
await n.xfs.copyPromise(n.ppath.join(t, r), n.ppath.join(e.cwd, r), { overwrite: !0 });
})({ destination: f, project: e, report: t }),
await (async function ({ destination: t, project: e, report: o }) {
const r = n.ppath.join((0, n.toFilename)('.yarn'), (0, n.toFilename)('plugins'));
o.reportInfo(null, r),
await n.xfs.copyPromise(n.ppath.join(t, r), n.ppath.join(e.cwd, r), { overwrite: !0 });
})({ destination: f, project: e, report: t }),
await (async function ({ destination: t, project: e, report: o }) {
const r = e.configuration.get('yarnPath'),
i = n.ppath.relative(e.cwd, r),
a = n.ppath.join(t, i);
o.reportInfo(null, i), await n.xfs.copyPromise(a, r, { overwrite: !0 });
})({ destination: f, project: e, report: t }),
await (async function ({ destination: t, workspaces: e, report: o }) {
for (const r of e) {
const e = n.ppath.join(r.relativeCwd, i.Manifest.fileName),
a = n.ppath.join(t, e),
s = {};
r.manifest.exportTo(s),
o.reportInfo(null, e),
await n.xfs.mkdirpPromise(n.ppath.dirname(a)),
await n.xfs.writeJsonPromise(a, s);
}
})({ destination: f, workspaces: e.workspaces, report: t }),
await (async function ({ destination: t, report: e, project: o, parseDescriptor: r }) {
const a = new Set();
for (const s of o.storedDescriptors.values()) {
const c = r(
i.structUtils.isVirtualDescriptor(s) ? i.structUtils.devirtualizeDescriptor(s) : s,
);
if (!c) continue;
const { parentLocator: p, paths: d } = c;
for (const r of d) {
if (l.test(r)) continue;
if (n.ppath.isAbsolute(r)) continue;
const i = o.getWorkspaceByLocator(p),
s = n.ppath.join(i.relativeCwd, r);
if (a.has(s)) continue;
a.add(s);
const c = n.ppath.join(i.cwd, r),
d = n.ppath.join(t, s);
e.reportInfo(null, s),
await n.xfs.mkdirpPromise(n.ppath.dirname(d)),
await n.xfs.copyFilePromise(c, d);
}
}
})({
destination: f,
report: t,
project: e,
parseDescriptor: (t) => {
if (t.range.startsWith('exec:')) {
const e = (function (t) {
const { params: e, selector: o } = i.structUtils.parseRange(t),
r = n.npath.toPortablePath(o);
return {
parentLocator:
e && 'string' == typeof e.locator ? i.structUtils.parseLocator(e.locator) : null,
path: r,
};
})(t.range);
if (!e || !e.parentLocator) return;
return { parentLocator: e.parentLocator, paths: [e.path] };
}
if (t.range.startsWith('patch:')) {
const { parentLocator: e, patchPaths: o } = a.patchUtils.parseDescriptor(t);
if (!e) return;
return { parentLocator: e, paths: o };
}
},
}),
await (async function ({ destination: t, project: e, cache: o, report: r }) {
for (const i of o.markedFiles) {
const o = n.ppath.relative(e.cwd, i);
(await n.xfs.existsPromise(i)) &&
(r.reportInfo(null, o), await n.xfs.copyPromise(n.ppath.join(t, o), i));
}
})({ destination: f, project: e, cache: d, report: t }),
await (async function ({ destination: t, project: e, report: o }) {
const r = (0, n.toFilename)(e.configuration.get('lockfileFilename')),
i = n.ppath.join(t, r);
o.reportInfo(null, r),
await n.xfs.mkdirpPromise(n.ppath.dirname(i)),
await n.xfs.writeFilePromise(i, e.generateLockfile());
})({ destination: f, project: e, report: t }),
this.copyFiles &&
this.copyFiles.length &&
(await (async function ({ destination: t, files: e, dockerFilePath: o, report: r }) {
const i = n.ppath.dirname(o);
for (const o of e) {
const e = p(i, o),
a = n.ppath.join(i, e),
s = n.ppath.join(t, e);
r.reportInfo(null, e), await n.xfs.copyPromise(s, a);
}
})({ destination: f, files: this.copyFiles, dockerFilePath: s, report: t }));
});
for (const e of r) {
const o = e.manifest.name ? i.structUtils.stringifyIdent(e.manifest.name) : '';
await t.startTimerPromise('Pack workspace ' + o, async () => {
await c({ workspace: e, report: t, destination: u });
});
}
const h = this.buildKit ? ['buildx', 'build'] : ['build'];
await i.execUtils.pipevp('docker', [...h, ...this.args, '-f', s, '.'], {
cwd: o,
strict: !0,
stdin: this.context.stdin,
stdout: this.context.stdout,
stderr: this.context.stderr,
});
});
},
)
).exitCode();
}
}
(f.usage = r.Command.Usage({
category: 'Docker-related commands',
description: 'Build a Docker image for a workspace',
details:
'\n This command will build a efficient Docker image which only contains necessary dependencies for the specified workspace.\n\n You have to create a Dockerfile in your workspace or your project. You can also specify the path to Dockerfile using the "-f, --file" option.\n\n Additional arguments can be passed to "docker build" directly, please check the Docker docs for more info: https://docs.docker.com/engine/reference/commandline/build/\n\n You can copy additional files or folders to a Docker image using the "--copy" option. This is useful for secret keys or configuration files. The files will be copied to "manifests" folder. The path can be either a path relative to the Dockerfile or an absolute path.\n ',
examples: [
['Build a Docker image for a workspace', 'yarn docker build @foo/bar'],
['Pass additional arguments to docker build command', 'yarn docker build @foo/bar -t image-tag'],
[
'Copy additional files to a Docker image',
'yarn docker build --copy secret.key --copy config.json @foo/bar',
],
['Install production dependencies only', 'yarn docker build --production @foo/bar'],
['Build a Docker image using BuildKit', 'yarn docker build --buildkit @foo/bar'],
],
})),
d([r.Command.String()], f.prototype, 'workspaceName', void 0),
d([r.Command.Proxy()], f.prototype, 'args', void 0),
d([r.Command.String('-f,--file')], f.prototype, 'dockerFilePath', void 0),
d([r.Command.Array('--copy')], f.prototype, 'copyFiles', void 0),
d([r.Command.Boolean('--production')], f.prototype, 'production', void 0),
d([r.Command.Boolean('--buildkit')], f.prototype, 'buildKit', void 0),
d([r.Command.Path('docker', 'build')], f.prototype, 'execute', null);
const u = { commands: [f] };
plugin = e;
})();
return plugin;
},
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -96,34 +96,40 @@
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"noImplicitOverride": true, "noImplicitOverride": true,
"noImplicitReturns": true, "noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": false,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"strict": true, "strict": true,
"useUnknownInCatchVariables": true,
"noUncheckedIndexedAccess": true,
// Modules // Modules
"allowArbitraryExtensions": false,
"allowImportingTsExtensions": false,
"module": "ESNext", "module": "ESNext",
"moduleResolution": "node", "moduleResolution": "node",
"resolveJsonModule": true, "resolveJsonModule": true,
"resolvePackageJsonExports": false,
"resolvePackageJsonImports": false,
// Emit // Emit
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"importHelpers": true, "importHelpers": false,
"inlineSources": true,
"newLine": "lf", "newLine": "lf",
"noEmitHelpers": true, "noEmitHelpers": true,
"outDir": "dist", "outDir": "dist",
"removeComments": false, "removeComments": false,
"sourceMap": true, "sourceMap": true,
"esModuleInterop": true,
// Interop Constraints
"esModuleInterop": false,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"isolatedModules": true,
// Language and Environment // Language and Environment
"experimentalDecorators": true, "experimentalDecorators": true,
"lib": ["ESNext"], "lib": ["ESNext"],
"target": "ES2021", "target": "ES2022",
"useDefineForClassFields": true "useDefineForClassFields": true
} }
/** /**

View File

@@ -7,22 +7,25 @@
"scripts": { "scripts": {
"test": "vitest run", "test": "vitest run",
"test:lighthouse": "lighthouse http://localhost:3000 --output-path=./lighthouse-results", "test:lighthouse": "lighthouse http://localhost:3000 --output-path=./lighthouse-results",
"build:local": "yarn build:prod", "build:local": "pnpm run build:prod",
"build:prod": "yarn build:css && yarn build:next", "build:prod": "pnpm run build:css && pnpm run build:next",
"build:next": "next build", "build:next": "next build",
"build:css": "yarn generate:css", "build:css": "pnpm run generate:css",
"build:analyze": "cross-env ANALYZE=true yarn build:prod", "build:analyze": "cross-env ANALYZE=true pnpm run build:prod",
"preview": "next start", "preview": "next start",
"dev": "concurrently 'yarn dev:css' 'yarn dev:next'", "dev": "concurrently 'pnpm run dev:css' 'pnpm run dev:next'",
"dev:next": "next dev", "dev:next": "next dev",
"dev:css": "yarn generate:css --watch", "dev:css": "pnpm run generate:css --watch",
"generate:css": "unocss 'src/**/*.tsx' 'contentlayer.config.ts' '../../packages/ui/src/lib/components/**/*.tsx' --out-file ./src/styles/unocss.css --config ../../unocss.config.ts", "generate:css": "unocss 'src/**/*.tsx' 'contentlayer.config.ts' '../../packages/ui/src/lib/components/**/*.tsx' --out-file ./src/styles/unocss.css --config ../../unocss.config.ts",
"generate:contentlayer": "contentlayer build", "generate:contentlayer": "contentlayer build",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src", "lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src", "format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"fmt": "yarn format" "fmt": "pnpm run format"
}, },
"type": "commonjs", "type": "commonjs",
"directories": {
"lib": "src"
},
"contributors": [ "contributors": [
"Crawl <icrawltogo@gmail.com>" "Crawl <icrawltogo@gmail.com>"
], ],
@@ -52,7 +55,7 @@
"@vercel/analytics": "^1.0.2", "@vercel/analytics": "^1.0.2",
"@vercel/edge-config": "^0.2.1", "@vercel/edge-config": "^0.2.1",
"@vercel/og": "^0.5.11", "@vercel/og": "^0.5.11",
"ariakit": "^2.0.0-next.44", "ariakit": "2.0.0-next.44",
"cmdk": "^0.2.0", "cmdk": "^0.2.0",
"contentlayer": "^0.3.4", "contentlayer": "^0.3.4",
"next": "^13.4.19", "next": "^13.4.19",
@@ -74,14 +77,14 @@
"@types/node": "18.17.9", "@types/node": "18.17.9",
"@types/react": "^18.2.21", "@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7", "@types/react-dom": "^18.2.7",
"@unocss/cli": "^0.55.2", "@unocss/cli": "^0.55.3",
"@unocss/eslint-plugin": "^0.55.2", "@unocss/eslint-plugin": "^0.55.3",
"@unocss/reset": "^0.55.2", "@unocss/reset": "^0.55.3",
"@vitejs/plugin-react": "^4.0.4", "@vitejs/plugin-react": "^4.0.4",
"@vitest/coverage-v8": "^0.34.2", "@vitest/coverage-v8": "^0.34.3",
"concurrently": "^8.2.1", "concurrently": "^8.2.1",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint": "^8.47.0", "eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56", "eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0", "eslint-formatter-pretty": "^5.0.0",
"happy-dom": "^10.11.0", "happy-dom": "^10.11.0",
@@ -92,11 +95,11 @@
"prettier": "^3.0.2", "prettier": "^3.0.2",
"turbo": "^1.10.13", "turbo": "^1.10.13",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"unocss": "^0.55.2", "unocss": "^0.55.3",
"vercel": "^32.0.2", "vercel": "^32.0.2",
"vitest": "^0.34.2" "vitest": "^0.34.3"
}, },
"engines": { "engines": {
"node": ">=18.13.0" "node": ">=18.17.1"
} }
} }

View File

@@ -2,14 +2,10 @@
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"lib": ["ESNext", "DOM", "DOM.Iterable"], "lib": ["ESNext", "DOM", "DOM.Iterable"],
"isolatedModules": true,
"jsx": "preserve", "jsx": "preserve",
"baseUrl": ".", "baseUrl": ".",
"noEmit": true, "noEmit": true,
"allowJs": false,
"incremental": true,
"skipLibCheck": true, "skipLibCheck": true,
"sourceMap": true,
"plugins": [ "plugins": [
{ {
"name": "next" "name": "next"
@@ -19,8 +15,10 @@
"~/*": ["./src/*"], "~/*": ["./src/*"],
"contentlayer/generated": ["./.contentlayer/generated"] "contentlayer/generated": ["./.contentlayer/generated"]
}, },
"strictNullChecks": true, "moduleResolution": "node",
"moduleResolution": "node" "resolvePackageJsonExports": false,
"resolvePackageJsonImports": false,
"esModuleInterop": true
}, },
"include": ["src/**/*.ts", "src/**/*.tsx", "next-env.d.ts", ".next/types/**/*.ts", ".contentlayer/generated"], "include": ["src/**/*.ts", "src/**/*.tsx", "next-env.d.ts", ".next/types/**/*.ts", ".contentlayer/generated"],
"exclude": ["node_modules"] "exclude": ["node_modules"]

View File

@@ -8,7 +8,7 @@ export default withBundleAnalyzer({
reactStrictMode: true, reactStrictMode: true,
experimental: { experimental: {
typedRoutes: true, typedRoutes: true,
serverComponentsExternalPackages: ['@microsoft/api-extractor-model', 'jju'], serverComponentsExternalPackages: ['@rushstack/node-core-library', '@microsoft/api-extractor-model', 'jju'],
}, },
images: { images: {
dangerouslyAllowSVG: true, dangerouslyAllowSVG: true,

View File

@@ -8,22 +8,25 @@
"test": "vitest run", "test": "vitest run",
"test:lighthouse": "lighthouse http://localhost:3000 --output-path=./lighthouse-results", "test:lighthouse": "lighthouse http://localhost:3000 --output-path=./lighthouse-results",
"build:copy_readme": "cpy '../../packages/*/README.md' 'src/assets/readme' --rename='home-{{basename}}'", "build:copy_readme": "cpy '../../packages/*/README.md' 'src/assets/readme' --rename='home-{{basename}}'",
"build:local": "cross-env NEXT_PUBLIC_LOCAL_DEV=true yarn build:prod", "build:local": "cross-env NEXT_PUBLIC_LOCAL_DEV=true pnpm run build:prod",
"build:prod": "yarn build:copy_readme && yarn build:css && yarn build:next", "build:prod": "pnpm run build:copy_readme && pnpm run build:css && pnpm run build:next",
"build:next": "next build", "build:next": "next build",
"build:css": "yarn generate:css", "build:css": "pnpm run generate:css",
"build:search_indices": "yarn node scripts/generateAllIndices.js", "build:search_indices": "pnpm run scripts/generateAllIndices.js",
"build:analyze": "turbo run docs --concurrency=3 && cross-env ANALYZE=true NEXT_PUBLIC_LOCAL_DEV=true yarn build:prod", "build:analyze": "turbo run docs --filter='@discordjs/*' --concurrency=4 && cross-env ANALYZE=true NEXT_PUBLIC_LOCAL_DEV=true pnpm run build:prod",
"preview": "next start", "preview": "next start",
"dev": "concurrently 'yarn dev:css' 'yarn dev:next'", "dev": "concurrently 'pnpm run dev:css' 'pnpm run dev:next'",
"dev:next": "next dev", "dev:next": "next dev",
"dev:css": "yarn generate:css --watch", "dev:css": "pnpm run generate:css --watch",
"generate:css": "unocss 'src/**/*.tsx' '../../packages/ui/src/lib/components/**/*.tsx' --out-file ./src/styles/unocss.css --config ../../unocss.config.ts", "generate:css": "unocss 'src/**/*.tsx' '../../packages/ui/src/lib/components/**/*.tsx' --out-file ./src/styles/unocss.css --config ../../unocss.config.ts",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src", "lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src", "format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"fmt": "yarn format" "fmt": "pnpm run format"
}, },
"type": "module", "type": "module",
"directories": {
"lib": "src"
},
"contributors": [ "contributors": [
"Crawl <icrawltogo@gmail.com>" "Crawl <icrawltogo@gmail.com>"
], ],
@@ -52,12 +55,13 @@
"@discordjs/ui": "workspace:^", "@discordjs/ui": "workspace:^",
"@microsoft/api-extractor-model": "^7.27.6", "@microsoft/api-extractor-model": "^7.27.6",
"@microsoft/tsdoc": "^0.14.2", "@microsoft/tsdoc": "^0.14.2",
"@microsoft/tsdoc-config": "0.16.2",
"@planetscale/database": "^1.11.0", "@planetscale/database": "^1.11.0",
"@react-icons/all-files": "^4.1.0", "@react-icons/all-files": "^4.1.0",
"@vercel/analytics": "^1.0.2", "@vercel/analytics": "^1.0.2",
"@vercel/edge-config": "^0.2.1", "@vercel/edge-config": "^0.2.1",
"@vercel/og": "^0.5.11", "@vercel/og": "^0.5.11",
"ariakit": "^2.0.0-next.44", "ariakit": "2.0.0-next.44",
"bright": "^0.8.4", "bright": "^0.8.4",
"class-variance-authority": "^0.7.0", "class-variance-authority": "^0.7.0",
"cmdk": "^0.2.0", "cmdk": "^0.2.0",
@@ -69,7 +73,6 @@
"react-custom-scrollbars-2": "^4.5.0", "react-custom-scrollbars-2": "^4.5.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-use": "^17.4.0", "react-use": "^17.4.0",
"rehype-raw": "^6.1.1",
"rehype-slug": "^5.1.0", "rehype-slug": "^5.1.0",
"remark-gfm": "^3.0.1", "remark-gfm": "^3.0.1",
"sharp": "^0.32.5", "sharp": "^0.32.5",
@@ -82,15 +85,15 @@
"@types/node": "18.17.9", "@types/node": "18.17.9",
"@types/react": "^18.2.21", "@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7", "@types/react-dom": "^18.2.7",
"@unocss/cli": "^0.55.2", "@unocss/cli": "^0.55.3",
"@unocss/eslint-plugin": "^0.55.2", "@unocss/eslint-plugin": "^0.55.3",
"@unocss/reset": "^0.55.2", "@unocss/reset": "^0.55.3",
"@vitejs/plugin-react": "^4.0.4", "@vitejs/plugin-react": "^4.0.4",
"@vitest/coverage-v8": "^0.34.2", "@vitest/coverage-v8": "^0.34.3",
"concurrently": "^8.2.1", "concurrently": "^8.2.1",
"cpy-cli": "^5.0.0", "cpy-cli": "^5.0.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint": "^8.47.0", "eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56", "eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0", "eslint-formatter-pretty": "^5.0.0",
"happy-dom": "^10.11.0", "happy-dom": "^10.11.0",
@@ -99,9 +102,9 @@
"turbo": "^1.10.13", "turbo": "^1.10.13",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"vercel": "^32.0.2", "vercel": "^32.0.2",
"vitest": "^0.34.2" "vitest": "^0.34.3"
}, },
"engines": { "engines": {
"node": ">=18.13.0" "node": ">=18.17.1"
} }
} }

View File

@@ -4,9 +4,17 @@ import { connect } from '@planetscale/database';
const sql = connect({ const sql = connect({
url: process.env.DATABASE_URL!, url: process.env.DATABASE_URL!,
async fetch(url, init) {
delete init?.cache;
return fetch(url, { ...init, next: { revalidate: 3_600 } });
},
}); });
export async function fetchVersions(packageName: string): Promise<string[]> { export async function fetchVersions(packageName: string): Promise<string[]> {
if (process.env.NEXT_PUBLIC_LOCAL_DEV || process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {
return ['main'];
}
const response = await fetch(`https://docs.discordjs.dev/api/info?package=${packageName}`, { const response = await fetch(`https://docs.discordjs.dev/api/info?package=${packageName}`, {
next: { revalidate: 3_600 }, next: { revalidate: 3_600 },
}); });
@@ -29,6 +37,16 @@ export async function fetchModelJSON(packageName: string, version: string): Prom
} }
} }
if (process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {
const { rows } = await sql.execute('select data from documentation where name = ? and version = ?', [
packageName,
'main',
]);
// @ts-expect-error: https://github.com/planetscale/database-js/issues/71
return rows[0].data;
}
const { rows } = await sql.execute('select data from documentation where name = ? and version = ?', [ const { rows } = await sql.execute('select data from documentation where name = ? and version = ?', [
packageName, packageName,
version, version,

View File

@@ -1,4 +1,4 @@
import { addPackageToModel, tryResolveSummaryText } from '@discordjs/scripts'; import { tryResolveSummaryText } from '@discordjs/scripts';
import type { import type {
ApiClass, ApiClass,
ApiDeclaredItem, ApiDeclaredItem,
@@ -24,6 +24,7 @@ import { TypeAlias } from '~/components/model/TypeAlias';
import { Variable } from '~/components/model/Variable'; import { Variable } from '~/components/model/Variable';
import { Enum } from '~/components/model/enum/Enum'; import { Enum } from '~/components/model/enum/Enum';
import { Function } from '~/components/model/function/Function'; import { Function } from '~/components/model/function/Function';
import { addPackageToModel } from '~/util/addPackageToModel';
import { OVERLOAD_SEPARATOR } from '~/util/constants'; import { OVERLOAD_SEPARATOR } from '~/util/constants';
import type { ItemRouteParams } from '~/util/fetchMember'; import type { ItemRouteParams } from '~/util/fetchMember';
import { fetchMember } from '~/util/fetchMember'; import { fetchMember } from '~/util/fetchMember';

View File

@@ -1,4 +1,3 @@
import { addPackageToModel } from '@discordjs/scripts';
import type { ApiFunction, ApiItem } from '@microsoft/api-extractor-model'; import type { ApiFunction, ApiItem } from '@microsoft/api-extractor-model';
import { ApiModel } from '@microsoft/api-extractor-model'; import { ApiModel } from '@microsoft/api-extractor-model';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
@@ -10,6 +9,7 @@ import { CmdKDialog } from '~/components/CmdK';
import { Nav } from '~/components/Nav'; import { Nav } from '~/components/Nav';
import type { SidebarSectionItemData } from '~/components/Sidebar'; import type { SidebarSectionItemData } from '~/components/Sidebar';
import { resolveItemURI } from '~/components/documentation/util'; import { resolveItemURI } from '~/components/documentation/util';
import { addPackageToModel } from '~/util/addPackageToModel';
import { N_RECENT_VERSIONS, PACKAGES } from '~/util/constants'; import { N_RECENT_VERSIONS, PACKAGES } from '~/util/constants';
import { Providers } from './providers'; import { Providers } from './providers';

View File

@@ -2,7 +2,6 @@ import { readFile } from 'node:fs/promises';
import { join } from 'node:path'; import { join } from 'node:path';
import type { SerializeOptions } from 'next-mdx-remote/dist/types'; import type { SerializeOptions } from 'next-mdx-remote/dist/types';
import { MDXRemote } from 'next-mdx-remote/rsc'; import { MDXRemote } from 'next-mdx-remote/rsc';
import rehypeRaw from 'rehype-raw';
import rehypeSlug from 'rehype-slug'; import rehypeSlug from 'rehype-slug';
import remarkGfm from 'remark-gfm'; import remarkGfm from 'remark-gfm';
import { SyntaxHighlighter } from '~/components/SyntaxHighlighter'; import { SyntaxHighlighter } from '~/components/SyntaxHighlighter';
@@ -16,7 +15,7 @@ const mdxOptions = {
mdxOptions: { mdxOptions: {
remarkPlugins: [remarkGfm], remarkPlugins: [remarkGfm],
remarkRehypeOptions: { allowDangerousHtml: true }, remarkRehypeOptions: { allowDangerousHtml: true },
rehypePlugins: [rehypeRaw, rehypeSlug], rehypePlugins: [rehypeSlug],
format: 'md', format: 'md',
}, },
} satisfies SerializeOptions; } satisfies SerializeOptions;

View File

@@ -13,6 +13,10 @@ async function getData(pkg: string) {
notFound(); notFound();
} }
if (process.env.NEXT_PUBLIC_LOCAL_DEV || process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {
return ['main'];
}
const res = await fetch(`https://docs.discordjs.dev/api/info?package=${pkg}`, { next: { revalidate: 3_600 } }); const res = await fetch(`https://docs.discordjs.dev/api/info?package=${pkg}`, { next: { revalidate: 3_600 } });
const data: string[] = await res.json(); const data: string[] = await res.json();

View File

@@ -9,6 +9,8 @@ import { useMemo } from 'react';
import useSWR from 'swr'; import useSWR from 'swr';
import { fetcher } from '~/util/fetcher'; import { fetcher } from '~/util/fetcher';
const isDev = process.env.NEXT_PUBLIC_LOCAL_DEV ?? process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview';
export default function VersionSelect() { export default function VersionSelect() {
const pathname = usePathname(); const pathname = usePathname();
const packageName = pathname?.split('/').slice(3, 4)[0]; const packageName = pathname?.split('/').slice(3, 4)[0];
@@ -21,7 +23,7 @@ export default function VersionSelect() {
() => () =>
versions versions
?.map((item, idx) => ( ?.map((item, idx) => (
<Link href={`/docs/packages/${packageName}/${item}`} key={`${item}-${idx}`}> <Link href={`/docs/packages/${packageName}/${isDev ? 'main' : item}`} key={`${item}-${idx}`}>
<MenuItem <MenuItem
className="my-0.5 rounded bg-white p-3 text-sm outline-none active:bg-light-800 dark:bg-dark-600 hover:bg-light-700 focus:ring focus:ring-width-2 focus:ring-blurple dark:active:bg-dark-400 dark:hover:bg-dark-500" className="my-0.5 rounded bg-white p-3 text-sm outline-none active:bg-light-800 dark:bg-dark-600 hover:bg-light-700 focus:ring focus:ring-width-2 focus:ring-blurple dark:active:bg-dark-400 dark:hover:bg-dark-500"
onClick={() => versionMenu.setOpen(false)} onClick={() => versionMenu.setOpen(false)}

View File

@@ -3,6 +3,10 @@ import { NextResponse, type NextRequest } from 'next/server';
import { PACKAGES } from './util/constants'; import { PACKAGES } from './util/constants';
async function fetchLatestVersion(packageName: string) { async function fetchLatestVersion(packageName: string) {
if (process.env.NEXT_PUBLIC_LOCAL_DEV || process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {
return 'main';
}
const res = await fetch(`https://docs.discordjs.dev/api/info?package=${packageName}`, { cache: 'no-store' }); const res = await fetch(`https://docs.discordjs.dev/api/info?package=${packageName}`, { cache: 'no-store' });
const data: string[] = await res.json(); const data: string[] = await res.json();

View File

@@ -0,0 +1,20 @@
import type { ApiModel, ApiPackage } from '@microsoft/api-extractor-model';
import { ApiItem } from '@microsoft/api-extractor-model';
import { TSDocConfiguration } from '@microsoft/tsdoc';
import { TSDocConfigFile } from '@microsoft/tsdoc-config';
export function addPackageToModel(model: ApiModel, data: any) {
const tsdocConfiguration = new TSDocConfiguration();
const tsdocConfigFile = TSDocConfigFile.loadFromObject(data.metadata.tsdocConfig);
tsdocConfigFile.configureParser(tsdocConfiguration);
const apiPackage = ApiItem.deserialize(data, {
apiJsonFilename: '',
toolPackage: data.metadata.toolPackage,
toolVersion: data.metadata.toolVersion,
versionToDeserialize: data.metadata.schemaVersion,
tsdocConfiguration,
}) as ApiPackage;
model.addMember(apiPackage);
return model;
}

View File

@@ -1,7 +1,7 @@
import { addPackageToModel } from '@discordjs/scripts';
import { ApiModel, ApiFunction } from '@microsoft/api-extractor-model'; import { ApiModel, ApiFunction } from '@microsoft/api-extractor-model';
import { notFound } from 'next/navigation'; import { notFound } from 'next/navigation';
import { fetchModelJSON } from '~/app/docAPI'; import { fetchModelJSON } from '~/app/docAPI';
import { addPackageToModel } from './addPackageToModel';
import { OVERLOAD_SEPARATOR, PACKAGES } from './constants'; import { OVERLOAD_SEPARATOR, PACKAGES } from './constants';
import { findMember, findMemberByKey } from './model'; import { findMember, findMemberByKey } from './model';

View File

@@ -2,14 +2,10 @@
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"lib": ["ESNext", "DOM", "DOM.Iterable"], "lib": ["ESNext", "DOM", "DOM.Iterable"],
"isolatedModules": true,
"jsx": "preserve", "jsx": "preserve",
"baseUrl": ".", "baseUrl": ".",
"noEmit": true, "noEmit": true,
"allowJs": false,
"incremental": true,
"skipLibCheck": true, "skipLibCheck": true,
"sourceMap": true,
"plugins": [ "plugins": [
{ {
"name": "next" "name": "next"
@@ -18,8 +14,10 @@
"paths": { "paths": {
"~/*": ["./src/*"] "~/*": ["./src/*"]
}, },
"strictNullChecks": true, "moduleResolution": "node",
"moduleResolution": "node" "resolvePackageJsonExports": false,
"resolvePackageJsonImports": false,
"esModuleInterop": true
}, },
"include": ["src/**/*.ts", "src/**/*.tsx", "next-env.d.ts", ".next/types/**/*.ts"], "include": ["src/**/*.ts", "src/**/*.tsx", "next-env.d.ts", ".next/types/**/*.ts"],
"exclude": ["node_modules"] "exclude": ["node_modules"]

View File

@@ -7,6 +7,7 @@ import prettier from 'eslint-config-neon/flat/prettier.js';
import react from 'eslint-config-neon/flat/react.js'; import react from 'eslint-config-neon/flat/react.js';
import typescript from 'eslint-config-neon/flat/typescript.js'; import typescript from 'eslint-config-neon/flat/typescript.js';
import merge from 'lodash.merge'; import merge from 'lodash.merge';
// import {join} from "node:path"
const commonFiles = '{js,mjs,cjs,ts,mts,cts,jsx,tsx}'; const commonFiles = '{js,mjs,cjs,ts,mts,cts,jsx,tsx}';
@@ -18,6 +19,7 @@ const typeScriptRuleset = merge(...typescript, {
files: [`**/*${commonFiles}`], files: [`**/*${commonFiles}`],
languageOptions: { languageOptions: {
parserOptions: { parserOptions: {
warnOnUnsupportedTypeScriptVersion: false,
allowAutomaticSingleRunInference: true, allowAutomaticSingleRunInference: true,
project: ['tsconfig.eslint.json', 'apps/*/tsconfig.eslint.json', 'packages/*/tsconfig.eslint.json'], project: ['tsconfig.eslint.json', 'apps/*/tsconfig.eslint.json', 'packages/*/tsconfig.eslint.json'],
}, },

View File

@@ -5,22 +5,23 @@
"description": "A powerful library for interacting with the Discord API", "description": "A powerful library for interacting with the Discord API",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "turbo run build --concurrency=3", "build": "pnpm -- turbo run build --concurrency=4",
"build:affected": "turbo run build --filter='...[origin/main]' --concurrency=3", "build:affected": "turbo run build --filter='...[origin/main]' --concurrency=4",
"build:apps": "turbo run build:local --filter='...{apps/*}' --concurrency=3", "build:apps": "turbo run build:local --filter='...{apps/*}' --concurrency=4",
"build:apps:affected": "turbo run build:local --filter='...{apps/*}[origin/main]' --concurrency=3", "build:apps:affected": "turbo run build:local --filter='...{apps/*}[origin/main]' --concurrency=4",
"test": "turbo run test --concurrency=3", "test": "turbo run test --concurrency=4",
"test:affected": "turbo run test --filter='...[origin/main]' --concurrency=3", "test:affected": "turbo run test --filter='...[origin/main]' --concurrency=4",
"lint": "turbo run lint --concurrency=3", "lint": "turbo run lint --concurrency=4",
"lint:affected": "turbo run lint --filter='...[origin/main]' --concurrency=3", "lint:affected": "turbo run lint --filter='...[origin/main]' --concurrency=4",
"format": "turbo run format --concurrency=3", "format": "turbo run format --concurrency=4",
"format:affected": "turbo run format --filter='...[origin/main]' --concurrency=3", "format:affected": "turbo run format --filter='...[origin/main]' --concurrency=4",
"fmt": "turbo run format --concurrency=3", "fmt": "turbo run format --concurrency=4",
"fmt:affected": "turbo run format --filter='...[origin/main]' --concurrency=3", "fmt:affected": "turbo run format --filter='...[origin/main]' --concurrency=4",
"docs": "turbo run docs --concurrency=3", "docs": "turbo run docs --concurrency=4",
"docs:affected": "turbo run docs --filter='...[origin/main]' --concurrency=3", "docs:affected": "turbo run docs --filter='...[origin/main]' --concurrency=4",
"postinstall": "is-ci || husky install", "prepare": "is-ci || husky install",
"update": "yarn upgrade-interactive", "update": "pnpm --recursive update --interactive",
"update:latest": "pnpm --recursive update --interactive --latest",
"create-package": "turbo gen create-package" "create-package": "turbo gen create-package"
}, },
"type": "module", "type": "module",
@@ -53,9 +54,10 @@
"@favware/cliff-jumper": "^2.1.1", "@favware/cliff-jumper": "^2.1.1",
"@favware/npm-deprecate": "^1.0.7", "@favware/npm-deprecate": "^1.0.7",
"@types/lodash.merge": "^4.6.7", "@types/lodash.merge": "^4.6.7",
"@unocss/eslint-plugin": "^0.55.2", "@unocss/eslint-plugin": "^0.55.3",
"@vitest/coverage-v8": "^0.34.3",
"conventional-changelog-cli": "^3.0.0", "conventional-changelog-cli": "^3.0.0",
"eslint": "^8.47.0", "eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56", "eslint-config-neon": "^0.1.56",
"husky": "^8.0.3", "husky": "^8.0.3",
"is-ci": "^3.0.1", "is-ci": "^3.0.1",
@@ -64,32 +66,26 @@
"tsup": "^7.2.0", "tsup": "^7.2.0",
"turbo": "^1.10.13", "turbo": "^1.10.13",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"unocss": "^0.55.2", "unocss": "^0.55.3",
"vercel": "^32.0.2", "vercel": "^32.1.0",
"vitest": "^0.34.2" "vitest": "^0.34.3"
}, },
"resolutions": { "pnpm": {
"@contentlayer/utils/@opentelemetry/core": "^1.15.1", "overrides": {
"@contentlayer/utils/@opentelemetry/exporter-trace-otlp-grpc": "^0.41.1", "@contentlayer/utils>@opentelemetry/core": "^1.15.1",
"@contentlayer/utils/@opentelemetry/resources": "^1.15.1", "@contentlayer/utils>@opentelemetry/exporter-trace-otlp-grpc": "^0.41.1",
"@contentlayer/utils/@opentelemetry/sdk-trace-base": "^1.15.1", "@contentlayer/utils>@opentelemetry/resources": "^1.15.1",
"@contentlayer/utils/@opentelemetry/sdk-trace-node": "^1.15.1", "@contentlayer/utils>@opentelemetry/sdk-trace-base": "^1.15.1",
"@contentlayer/utils/@opentelemetry/semantic-conventions": "^1.15.1", "@contentlayer/utils>@opentelemetry/sdk-trace-node": "^1.15.1",
"@microsoft/tsdoc-config@~0.16.1": "patch:@microsoft/tsdoc-config@npm%3A0.16.2#./.yarn/patches/@microsoft-tsdoc-config-npm-0.16.2-30fd115d09.patch", "@contentlayer/utils>@opentelemetry/semantic-conventions": "^1.15.1"
"@microsoft/tsdoc-config@0.16.2": "patch:@microsoft/tsdoc-config@npm%3A0.16.2#./.yarn/patches/@microsoft-tsdoc-config-npm-0.16.2-30fd115d09.patch", },
"eslint-plugin-import@npm:eslint-plugin-i@latest": "patch:eslint-plugin-i@npm%3A2.28.0-2#./.yarn/patches/eslint-plugin-i-npm-2.28.0-2-4a8edfc1f1.patch", "patchedDependencies": {
"yaml@2.2.2": "patch:yaml@npm%3A2.2.2#./.yarn/patches/yaml-npm-2.2.2-6e3cddb343.patch", "@microsoft/tsdoc-config@0.16.2": "patches/@microsoft__tsdoc-config@0.16.2.patch",
"yaml@^2.2.2": "patch:yaml@npm%3A2.2.2#./.yarn/patches/yaml-npm-2.2.2-6e3cddb343.patch", "eslint-plugin-i@2.28.0-2": "patches/eslint-plugin-i@2.28.0-2.patch"
"yaml@^1.10.2": "patch:yaml@npm%3A2.2.2#./.yarn/patches/yaml-npm-2.2.2-6e3cddb343.patch", }
"yaml@^1.10.0": "patch:yaml@npm%3A2.2.2#./.yarn/patches/yaml-npm-2.2.2-6e3cddb343.patch",
"yaml@^2.1.1": "patch:yaml@npm%3A2.2.2#./.yarn/patches/yaml-npm-2.2.2-6e3cddb343.patch"
}, },
"engines": { "engines": {
"node": ">=16.11.0" "node": ">=18.17.1"
}, },
"workspaces": [ "packageManager": "pnpm@8.7.0"
"apps/*",
"packages/*"
],
"packageManager": "yarn@3.6.1"
} }

View File

@@ -6,10 +6,10 @@
"private": true, "private": true,
"scripts": { "scripts": {
"test": "vitest run", "test": "vitest run",
"build": "tsup", "build": "tsc --noEmit --skipLibCheck && tsup",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__", "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__", "format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"fmt": "yarn format" "fmt": "pnpm run format"
}, },
"type": "module", "type": "module",
"directories": { "directories": {
@@ -48,16 +48,16 @@
}, },
"devDependencies": { "devDependencies": {
"@types/node": "16.18.44", "@types/node": "16.18.44",
"@vitest/coverage-v8": "^0.34.2", "@vitest/coverage-v8": "^0.34.3",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint": "^8.47.0", "eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56", "eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0", "eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2", "prettier": "^3.0.2",
"tsup": "^7.2.0", "tsup": "^7.2.0",
"turbo": "^1.10.13", "turbo": "^1.10.13",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"vitest": "^0.34.2" "vitest": "^0.34.3"
}, },
"engines": { "engines": {
"node": ">=16.11.0" "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" - name: Expose yarn config as "$GITHUB_OUTPUT"
id: yarn-config id: yarn-config
shell: bash shell: bash
env:
YARN_ENABLE_GLOBAL_CACHE: 'false'
run: | run: |
echo "CACHE_FOLDER=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT 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 - name: Restore yarn cache
uses: actions/cache@v3 uses: actions/cache@v3
id: yarn-download-cache id: yarn-download-cache
with: with:
path: ${{ steps.yarn-config.outputs.CACHE_FOLDER }} 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: | restore-keys: |
yarn-download-cache- yarn-download-cache-default-
- name: Restore yarn install state - name: Restore global npm cache folder
id: yarn-install-state-cache id: npm-global-cache
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: .yarn/ci-cache/ path: ${{ steps.yarn-config.outputs.NPM_GLOBAL_CACHE_FOLDER }}
key: ${{ runner.os }}-yarn-install-state-cache-${{ hashFiles('yarn.lock', '.yarnrc.yml') }} key: npm-global-cache-default-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ hashFiles(yarn.lock, .yarnrc.yml) }}
- name: Install dependencies - name: Install dependencies
shell: bash shell: bash
@@ -37,6 +42,7 @@ runs:
yarn install --immutable --inline-builds yarn install --immutable --inline-builds
env: env:
YARN_ENABLE_GLOBAL_CACHE: 'false' YARN_ENABLE_GLOBAL_CACHE: 'false'
YARN_ENABLE_MIRROR: 'false'
YARN_NM_MODE: 'hardlinks-local' 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' HUSKY: '0'

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -5,12 +5,12 @@
"description": "A powerful TypeScript library for interacting with the Discord API", "description": "A powerful TypeScript library for interacting with the Discord API",
"scripts": { "scripts": {
"test": "vitest run", "test": "vitest run",
"build": "tsup", "build": "tsc --noEmit && tsup",
"build:docs": "tsc -p tsconfig.docs.json", "build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__", "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__", "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", "docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"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/next/*'", "changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/next/*'",
"release": "cliff-jumper" "release": "cliff-jumper"
}, },
@@ -77,20 +77,20 @@
"@favware/cliff-jumper": "^2.1.1", "@favware/cliff-jumper": "^2.1.1",
"@microsoft/api-extractor": "^7.36.4", "@microsoft/api-extractor": "^7.36.4",
"@types/node": "18.17.9", "@types/node": "18.17.9",
"@vitest/coverage-v8": "^0.34.2", "@vitest/coverage-v8": "^0.34.3",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"esbuild-plugin-version-injector": "^1.2.0", "esbuild-plugin-version-injector": "^1.2.0",
"eslint": "^8.47.0", "eslint": "^8.48.0",
"eslint-config-neon": "^0.1.56", "eslint-config-neon": "^0.1.56",
"eslint-formatter-pretty": "^5.0.0", "eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2", "prettier": "^3.0.2",
"tsup": "^7.2.0", "tsup": "^7.2.0",
"turbo": "^1.10.13", "turbo": "^1.10.13",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"vitest": "^0.34.2" "vitest": "^0.34.3"
}, },
"engines": { "engines": {
"node": ">=18.13.0" "node": ">=18.17.1"
}, },
"publishConfig": { "publishConfig": {
"access": "public" "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 update
RUN apk add --no-cache libc6-compat 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 pnpm install --frozen-lockfile --ignore-scripts
RUN rm -rf .yarn/cache 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 addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 proxy RUN adduser --system --uid 1001 proxy-container
USER proxy USER proxy-container
COPY --from=builder /usr/proxy . COPY --from=pruned /usr/proxy-container/pruned .
COPY packs .
CMD ["node", "--enable-source-maps", "dist/index.js"] CMD ["node", "--enable-source-maps", "dist/index.js"]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
diff --git a/lib/rules/extensions.js b/lib/rules/extensions.js diff --git a/lib/rules/extensions.js b/lib/rules/extensions.js
index 3bd6529d40ae428e6efbda0fd6d48de10e7ea110..3d94d9f6ac3d3b47460585816c79ac39a407e0a5 100644 index 3bd6529d40ae428e6efbda0fd6d48de10e7ea110..52bbef8fb8335a81239e145f304a0d8ddfff6323 100644
--- a/lib/rules/extensions.js --- a/lib/rules/extensions.js
+++ b/lib/rules/extensions.js +++ b/lib/rules/extensions.js
@@ -3,7 +3,8 @@ @@ -3,7 +3,8 @@

23958
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

3
pnpm-workspace.yaml Normal file
View File

@@ -0,0 +1,3 @@
packages:
- 'apps/*'
- 'packages/*'

View File

@@ -9,34 +9,41 @@
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"noImplicitOverride": true, "noImplicitOverride": true,
"noImplicitReturns": true, "noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": false,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"strict": true, "strict": true,
"useUnknownInCatchVariables": true,
"noUncheckedIndexedAccess": true,
// Modules // Modules
"allowArbitraryExtensions": false,
"allowImportingTsExtensions": false,
"module": "ESNext", "module": "ESNext",
"moduleResolution": "bundler", "moduleResolution": "Bundler",
"resolveJsonModule": true, "resolveJsonModule": true,
"resolvePackageJsonExports": true,
"resolvePackageJsonImports": true,
// Emit // Emit
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"importHelpers": true, "importHelpers": false,
"inlineSources": true,
"newLine": "lf", "newLine": "lf",
"noEmitHelpers": true, "noEmitHelpers": true,
"outDir": "dist", "outDir": "dist",
"removeComments": false, "removeComments": false,
"sourceMap": true, "sourceMap": true,
"esModuleInterop": true,
// Interop Constraints
"allowSyntheticDefaultImports": true,
"esModuleInterop": false,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"isolatedModules": true,
// Language and Environment // Language and Environment
"experimentalDecorators": true, "experimentalDecorators": true,
"lib": ["ESNext"], "lib": ["ESNext"],
"target": "ES2021", "target": "ES2022",
"useDefineForClassFields": true "useDefineForClassFields": true
} }
} }

View File

@@ -10,8 +10,14 @@ export function createTsupConfig({
target = 'es2022', target = 'es2022',
skipNodeModulesBundle = true, skipNodeModulesBundle = true,
clean = true, clean = true,
shims = true, shims = format.includes('cjs'),
cjsInterop = format.includes('cjs'),
minify = false, minify = false,
terserOptions = {
mangle: false,
keep_classnames: true,
keep_fnames: true,
},
splitting = false, splitting = false,
keepNames = true, keepNames = true,
dts = true, dts = true,
@@ -29,7 +35,9 @@ export function createTsupConfig({
target, target,
clean, clean,
shims, shims,
cjsInterop,
minify, minify,
terserOptions,
splitting, splitting,
keepNames, keepNames,
dts, dts,

View File

@@ -5,7 +5,6 @@
".gitignore", ".gitignore",
".lintstagedrc.json", ".lintstagedrc.json",
".prettierrc.json", ".prettierrc.json",
".yarnrc.yml",
"api-extractor.json", "api-extractor.json",
"codecov.yml", "codecov.yml",
"eslint.config.js", "eslint.config.js",
@@ -18,12 +17,17 @@
"turbo.json", "turbo.json",
"unocss.config.ts", "unocss.config.ts",
"vitest.config.ts", "vitest.config.ts",
"yarn.lock" "pnpm-lock.yaml",
"pnpm-workspace.yaml"
], ],
"pipeline": { "pipeline": {
"build": { "build": {
"dependsOn": ["^build"], "dependsOn": ["^build"],
"inputs": [ "inputs": [
"bin/**/*.ts",
"bin/**/*.js",
"bin/**/*.mjs",
"bin/**/*.cjs",
"src/**/*.ts", "src/**/*.ts",
"src/**/*.tsx", "src/**/*.tsx",
"src/**/*.js", "src/**/*.js",
@@ -106,7 +110,7 @@
"tsconfig.eslint.json", "tsconfig.eslint.json",
"tsconfig.json" "tsconfig.json"
], ],
"outputs": [".contentlayer/**/*", ".next/**/*"], "outputs": [".contentlayer/**/*", ".next/**/*", "!.next/cache/**/*"],
"outputMode": "full" "outputMode": "full"
}, },
"@discordjs/guide#build:prod": { "@discordjs/guide#build:prod": {
@@ -127,7 +131,7 @@
"tsconfig.eslint.json", "tsconfig.eslint.json",
"tsconfig.json" "tsconfig.json"
], ],
"outputs": [".contentlayer/**/*", ".next/**/*"], "outputs": [".contentlayer/**/*", ".next/**/*", "!.next/cache/**/*"],
"outputMode": "full" "outputMode": "full"
}, },
"@discordjs/website#build:local": { "@discordjs/website#build:local": {
@@ -152,7 +156,7 @@
"tsconfig.eslint.json", "tsconfig.eslint.json",
"tsconfig.json" "tsconfig.json"
], ],
"outputs": [".next/**/*"], "outputs": [".next/**/*", "!.next/cache/**/*"],
"outputMode": "full" "outputMode": "full"
}, },
"@discordjs/website#build:prod": { "@discordjs/website#build:prod": {
@@ -173,7 +177,7 @@
"tsconfig.eslint.json", "tsconfig.eslint.json",
"tsconfig.json" "tsconfig.json"
], ],
"outputs": [".next/**/*"], "outputs": [".next/**/*", "!.next/cache/**/*"],
"outputMode": "full" "outputMode": "full"
}, },
"@discordjs/guide#generate:contentlayer": { "@discordjs/guide#generate:contentlayer": {

25993
yarn.lock

File diff suppressed because it is too large Load Diff