mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 08:03:30 +01:00
build: pnpm (#9806)
This commit is contained in:
21
.github/CONTRIBUTING.md
vendored
21
.github/CONTRIBUTING.md
vendored
@@ -11,22 +11,21 @@ is a great boon to your development process.
|
||||
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
|
||||
2. Run `yarn --immutable` ([install](https://yarnpkg.com/getting-started/install))
|
||||
3. Run `yarn build` to build local packages
|
||||
2. Run `pnpm install --frozen-lockfile` ([install](https://pnpm.io/installation))
|
||||
3. Run `pnpm run build` to build local packages
|
||||
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))
|
||||
|
||||
## 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`
|
||||
2. Initialize a new yarn 3 project `yarn init -2`
|
||||
3. Disable pnp `yarn config set nodeLinker node-modules`
|
||||
4. Now link the local discord.js project you cloned earlier `yarn link -A {PATH_TO_DISCORDJS_REPO}`
|
||||
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**
|
||||
6. Import the package in your source code and test them out!
|
||||
2. Initialize a new pnpm project `pnpm init`
|
||||
3. Now link the local discord.js project you cloned earlier `pnpm link {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. Import the package in your source code and test them out!
|
||||
|
||||
### 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.
|
||||
|
||||
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
|
||||
|
||||
If you'd like to create another package under the `@discordjs` organization run the following command:
|
||||
|
||||
```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
|
||||
|
||||
1
.github/workflows/cleanup-cache.yml
vendored
1
.github/workflows/cleanup-cache.yml
vendored
@@ -4,6 +4,7 @@ on:
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
cleanup:
|
||||
name: Cleanup caches
|
||||
|
||||
6
.github/workflows/documentation.yml
vendored
6
.github/workflows/documentation.yml
vendored
@@ -42,13 +42,13 @@ jobs:
|
||||
node-version: 18
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/yarnCache
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
- name: Build dependencies
|
||||
run: yarn build
|
||||
run: pnpm run build
|
||||
|
||||
- name: Build docs
|
||||
run: yarn docs
|
||||
run: pnpm run docs
|
||||
|
||||
- name: Checkout docs repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
4
.github/workflows/npm-auto-deprecate.yml
vendored
4
.github/workflows/npm-auto-deprecate.yml
vendored
@@ -18,9 +18,9 @@ jobs:
|
||||
node-version: 18
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/yarnCache
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
- 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:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
|
||||
7
.github/workflows/publish-dev-docker.yml
vendored
7
.github/workflows/publish-dev-docker.yml
vendored
@@ -18,10 +18,7 @@ jobs:
|
||||
node-version: 18
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/yarnCache
|
||||
|
||||
- name: Build dependencies
|
||||
run: yarn build
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
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
|
||||
|
||||
- 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 .
|
||||
|
||||
10
.github/workflows/publish-dev.yml
vendored
10
.github/workflows/publish-dev.yml
vendored
@@ -52,14 +52,14 @@ jobs:
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/yarnCache
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
- name: Build dependencies
|
||||
run: yarn build
|
||||
run: pnpm run build
|
||||
|
||||
- name: Publish package
|
||||
run: |
|
||||
yarn workspace ${{ matrix.package }} release --preid "dev.$(date +%s)-$(git rev-parse --short HEAD)"
|
||||
yarn workspace ${{ matrix.package }} npm publish --tag dev || true
|
||||
pnpm --filter=${{ matrix.package }} run release --preid "dev.$(date +%s)-$(git rev-parse --short HEAD)"
|
||||
pnpm --filter=${{ matrix.package }} publish --tag dev || true
|
||||
env:
|
||||
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
|
||||
7
.github/workflows/publish-docker.yml
vendored
7
.github/workflows/publish-docker.yml
vendored
@@ -15,10 +15,7 @@ jobs:
|
||||
node-version: 18
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/yarnCache
|
||||
|
||||
- name: Build dependencies
|
||||
run: yarn build
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
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
|
||||
|
||||
- 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 .
|
||||
|
||||
8
.github/workflows/publish-release.yml
vendored
8
.github/workflows/publish-release.yml
vendored
@@ -21,10 +21,10 @@ jobs:
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/yarnCache
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
- name: Build dependencies
|
||||
run: yarn build
|
||||
run: pnpm run build
|
||||
|
||||
- name: Extract package and semver from tag
|
||||
id: extract-tag
|
||||
@@ -34,6 +34,6 @@ jobs:
|
||||
|
||||
- name: Publish package
|
||||
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:
|
||||
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
|
||||
18
.github/workflows/tests.yml
vendored
18
.github/workflows/tests.yml
vendored
@@ -25,39 +25,39 @@ jobs:
|
||||
node-version: 18
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/yarnCache
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
- name: Build dependencies (PR)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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
|
||||
if: github.repository_owner == 'discordjs'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
yarn commitlint --edit $1
|
||||
pnpm exec commitlint --edit $1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
yarn build:affected && yarn lint-staged
|
||||
pnpm run build:affected && pnpm exec lint-staged
|
||||
|
||||
7
.npmrc
Normal file
7
.npmrc
Normal 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*
|
||||
8
.vscode/settings.json
vendored
8
.vscode/settings.json
vendored
@@ -2,7 +2,11 @@
|
||||
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
|
||||
"eslint.useESLintClass": true,
|
||||
"eslint.experimental.useFlatConfig": true,
|
||||
"eslint.workingDirectories": [{ "mode": "auto" }],
|
||||
"eslint.workingDirectories": [
|
||||
{ "directory": "${workspaceFolder}" },
|
||||
{ "pattern": "./apps/*/" },
|
||||
{ "pattern": "./packages/*/" }
|
||||
],
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
@@ -16,7 +20,7 @@
|
||||
},
|
||||
"files.insertFinalNewline": true,
|
||||
"files.eol": "\n",
|
||||
"npm.packageManager": "yarn",
|
||||
"npm.packageManager": "pnpm",
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"deno.enablePaths": ["./packages/create-discord-bot/template/Deno"],
|
||||
"deno.lint": true,
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
260
.yarn/plugins/@yarnpkg/plugin-docker-build.cjs
vendored
260
.yarn/plugins/@yarnpkg/plugin-docker-build.cjs
vendored
@@ -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;
|
||||
},
|
||||
};
|
||||
541
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
541
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
File diff suppressed because one or more lines are too long
550
.yarn/plugins/@yarnpkg/plugin-version.cjs
vendored
550
.yarn/plugins/@yarnpkg/plugin-version.cjs
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
874
.yarn/releases/yarn-3.6.1.cjs
vendored
874
.yarn/releases/yarn-3.6.1.cjs
vendored
File diff suppressed because one or more lines are too long
@@ -96,34 +96,40 @@
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noImplicitOverride": true,
|
||||
"noImplicitReturns": true,
|
||||
"noPropertyAccessFromIndexSignature": false,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"strict": true,
|
||||
"useUnknownInCatchVariables": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
|
||||
// Modules
|
||||
"allowArbitraryExtensions": false,
|
||||
"allowImportingTsExtensions": false,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"resolvePackageJsonExports": false,
|
||||
"resolvePackageJsonImports": false,
|
||||
|
||||
// Emit
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"importHelpers": true,
|
||||
"inlineSources": true,
|
||||
"importHelpers": false,
|
||||
"newLine": "lf",
|
||||
"noEmitHelpers": true,
|
||||
"outDir": "dist",
|
||||
"removeComments": false,
|
||||
"sourceMap": true,
|
||||
"esModuleInterop": true,
|
||||
|
||||
// Interop Constraints
|
||||
"esModuleInterop": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"isolatedModules": true,
|
||||
|
||||
// Language and Environment
|
||||
"experimentalDecorators": true,
|
||||
"lib": ["ESNext"],
|
||||
"target": "ES2021",
|
||||
"target": "ES2022",
|
||||
"useDefineForClassFields": true
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -7,22 +7,25 @@
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"test:lighthouse": "lighthouse http://localhost:3000 --output-path=./lighthouse-results",
|
||||
"build:local": "yarn build:prod",
|
||||
"build:prod": "yarn build:css && yarn build:next",
|
||||
"build:local": "pnpm run build:prod",
|
||||
"build:prod": "pnpm run build:css && pnpm run build:next",
|
||||
"build:next": "next build",
|
||||
"build:css": "yarn generate:css",
|
||||
"build:analyze": "cross-env ANALYZE=true yarn build:prod",
|
||||
"build:css": "pnpm run generate:css",
|
||||
"build:analyze": "cross-env ANALYZE=true pnpm run build:prod",
|
||||
"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: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:contentlayer": "contentlayer build",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
|
||||
"fmt": "yarn format"
|
||||
"fmt": "pnpm run format"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"directories": {
|
||||
"lib": "src"
|
||||
},
|
||||
"contributors": [
|
||||
"Crawl <icrawltogo@gmail.com>"
|
||||
],
|
||||
@@ -52,7 +55,7 @@
|
||||
"@vercel/analytics": "^1.0.2",
|
||||
"@vercel/edge-config": "^0.2.1",
|
||||
"@vercel/og": "^0.5.11",
|
||||
"ariakit": "^2.0.0-next.44",
|
||||
"ariakit": "2.0.0-next.44",
|
||||
"cmdk": "^0.2.0",
|
||||
"contentlayer": "^0.3.4",
|
||||
"next": "^13.4.19",
|
||||
@@ -74,14 +77,14 @@
|
||||
"@types/node": "18.17.9",
|
||||
"@types/react": "^18.2.21",
|
||||
"@types/react-dom": "^18.2.7",
|
||||
"@unocss/cli": "^0.55.2",
|
||||
"@unocss/eslint-plugin": "^0.55.2",
|
||||
"@unocss/reset": "^0.55.2",
|
||||
"@unocss/cli": "^0.55.3",
|
||||
"@unocss/eslint-plugin": "^0.55.3",
|
||||
"@unocss/reset": "^0.55.3",
|
||||
"@vitejs/plugin-react": "^4.0.4",
|
||||
"@vitest/coverage-v8": "^0.34.2",
|
||||
"@vitest/coverage-v8": "^0.34.3",
|
||||
"concurrently": "^8.2.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"happy-dom": "^10.11.0",
|
||||
@@ -92,11 +95,11 @@
|
||||
"prettier": "^3.0.2",
|
||||
"turbo": "^1.10.13",
|
||||
"typescript": "^5.2.2",
|
||||
"unocss": "^0.55.2",
|
||||
"unocss": "^0.55.3",
|
||||
"vercel": "^32.0.2",
|
||||
"vitest": "^0.34.2"
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.13.0"
|
||||
"node": ">=18.17.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,10 @@
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"baseUrl": ".",
|
||||
"noEmit": true,
|
||||
"allowJs": false,
|
||||
"incremental": true,
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
@@ -19,8 +15,10 @@
|
||||
"~/*": ["./src/*"],
|
||||
"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"],
|
||||
"exclude": ["node_modules"]
|
||||
|
||||
@@ -8,7 +8,7 @@ export default withBundleAnalyzer({
|
||||
reactStrictMode: true,
|
||||
experimental: {
|
||||
typedRoutes: true,
|
||||
serverComponentsExternalPackages: ['@microsoft/api-extractor-model', 'jju'],
|
||||
serverComponentsExternalPackages: ['@rushstack/node-core-library', '@microsoft/api-extractor-model', 'jju'],
|
||||
},
|
||||
images: {
|
||||
dangerouslyAllowSVG: true,
|
||||
|
||||
@@ -8,22 +8,25 @@
|
||||
"test": "vitest run",
|
||||
"test:lighthouse": "lighthouse http://localhost:3000 --output-path=./lighthouse-results",
|
||||
"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:prod": "yarn build:copy_readme && yarn build:css && yarn build:next",
|
||||
"build:local": "cross-env NEXT_PUBLIC_LOCAL_DEV=true pnpm run build:prod",
|
||||
"build:prod": "pnpm run build:copy_readme && pnpm run build:css && pnpm run build:next",
|
||||
"build:next": "next build",
|
||||
"build:css": "yarn generate:css",
|
||||
"build:search_indices": "yarn node scripts/generateAllIndices.js",
|
||||
"build:analyze": "turbo run docs --concurrency=3 && cross-env ANALYZE=true NEXT_PUBLIC_LOCAL_DEV=true yarn build:prod",
|
||||
"build:css": "pnpm run generate:css",
|
||||
"build:search_indices": "pnpm run scripts/generateAllIndices.js",
|
||||
"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",
|
||||
"dev": "concurrently 'yarn dev:css' 'yarn dev:next'",
|
||||
"dev": "concurrently 'pnpm run dev:css' 'pnpm run dev:next'",
|
||||
"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",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
|
||||
"fmt": "yarn format"
|
||||
"fmt": "pnpm run format"
|
||||
},
|
||||
"type": "module",
|
||||
"directories": {
|
||||
"lib": "src"
|
||||
},
|
||||
"contributors": [
|
||||
"Crawl <icrawltogo@gmail.com>"
|
||||
],
|
||||
@@ -52,12 +55,13 @@
|
||||
"@discordjs/ui": "workspace:^",
|
||||
"@microsoft/api-extractor-model": "^7.27.6",
|
||||
"@microsoft/tsdoc": "^0.14.2",
|
||||
"@microsoft/tsdoc-config": "0.16.2",
|
||||
"@planetscale/database": "^1.11.0",
|
||||
"@react-icons/all-files": "^4.1.0",
|
||||
"@vercel/analytics": "^1.0.2",
|
||||
"@vercel/edge-config": "^0.2.1",
|
||||
"@vercel/og": "^0.5.11",
|
||||
"ariakit": "^2.0.0-next.44",
|
||||
"ariakit": "2.0.0-next.44",
|
||||
"bright": "^0.8.4",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"cmdk": "^0.2.0",
|
||||
@@ -69,7 +73,6 @@
|
||||
"react-custom-scrollbars-2": "^4.5.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-use": "^17.4.0",
|
||||
"rehype-raw": "^6.1.1",
|
||||
"rehype-slug": "^5.1.0",
|
||||
"remark-gfm": "^3.0.1",
|
||||
"sharp": "^0.32.5",
|
||||
@@ -82,15 +85,15 @@
|
||||
"@types/node": "18.17.9",
|
||||
"@types/react": "^18.2.21",
|
||||
"@types/react-dom": "^18.2.7",
|
||||
"@unocss/cli": "^0.55.2",
|
||||
"@unocss/eslint-plugin": "^0.55.2",
|
||||
"@unocss/reset": "^0.55.2",
|
||||
"@unocss/cli": "^0.55.3",
|
||||
"@unocss/eslint-plugin": "^0.55.3",
|
||||
"@unocss/reset": "^0.55.3",
|
||||
"@vitejs/plugin-react": "^4.0.4",
|
||||
"@vitest/coverage-v8": "^0.34.2",
|
||||
"@vitest/coverage-v8": "^0.34.3",
|
||||
"concurrently": "^8.2.1",
|
||||
"cpy-cli": "^5.0.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"happy-dom": "^10.11.0",
|
||||
@@ -99,9 +102,9 @@
|
||||
"turbo": "^1.10.13",
|
||||
"typescript": "^5.2.2",
|
||||
"vercel": "^32.0.2",
|
||||
"vitest": "^0.34.2"
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.13.0"
|
||||
"node": ">=18.17.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,17 @@ import { connect } from '@planetscale/database';
|
||||
|
||||
const sql = connect({
|
||||
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[]> {
|
||||
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}`, {
|
||||
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 = ?', [
|
||||
packageName,
|
||||
version,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { addPackageToModel, tryResolveSummaryText } from '@discordjs/scripts';
|
||||
import { tryResolveSummaryText } from '@discordjs/scripts';
|
||||
import type {
|
||||
ApiClass,
|
||||
ApiDeclaredItem,
|
||||
@@ -24,6 +24,7 @@ import { TypeAlias } from '~/components/model/TypeAlias';
|
||||
import { Variable } from '~/components/model/Variable';
|
||||
import { Enum } from '~/components/model/enum/Enum';
|
||||
import { Function } from '~/components/model/function/Function';
|
||||
import { addPackageToModel } from '~/util/addPackageToModel';
|
||||
import { OVERLOAD_SEPARATOR } from '~/util/constants';
|
||||
import type { ItemRouteParams } from '~/util/fetchMember';
|
||||
import { fetchMember } from '~/util/fetchMember';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { addPackageToModel } from '@discordjs/scripts';
|
||||
import type { ApiFunction, ApiItem } from '@microsoft/api-extractor-model';
|
||||
import { ApiModel } from '@microsoft/api-extractor-model';
|
||||
import dynamic from 'next/dynamic';
|
||||
@@ -10,6 +9,7 @@ import { CmdKDialog } from '~/components/CmdK';
|
||||
import { Nav } from '~/components/Nav';
|
||||
import type { SidebarSectionItemData } from '~/components/Sidebar';
|
||||
import { resolveItemURI } from '~/components/documentation/util';
|
||||
import { addPackageToModel } from '~/util/addPackageToModel';
|
||||
import { N_RECENT_VERSIONS, PACKAGES } from '~/util/constants';
|
||||
import { Providers } from './providers';
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import { readFile } from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
import type { SerializeOptions } from 'next-mdx-remote/dist/types';
|
||||
import { MDXRemote } from 'next-mdx-remote/rsc';
|
||||
import rehypeRaw from 'rehype-raw';
|
||||
import rehypeSlug from 'rehype-slug';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import { SyntaxHighlighter } from '~/components/SyntaxHighlighter';
|
||||
@@ -16,7 +15,7 @@ const mdxOptions = {
|
||||
mdxOptions: {
|
||||
remarkPlugins: [remarkGfm],
|
||||
remarkRehypeOptions: { allowDangerousHtml: true },
|
||||
rehypePlugins: [rehypeRaw, rehypeSlug],
|
||||
rehypePlugins: [rehypeSlug],
|
||||
format: 'md',
|
||||
},
|
||||
} satisfies SerializeOptions;
|
||||
|
||||
@@ -13,6 +13,10 @@ async function getData(pkg: string) {
|
||||
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 data: string[] = await res.json();
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ import { useMemo } from 'react';
|
||||
import useSWR from 'swr';
|
||||
import { fetcher } from '~/util/fetcher';
|
||||
|
||||
const isDev = process.env.NEXT_PUBLIC_LOCAL_DEV ?? process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview';
|
||||
|
||||
export default function VersionSelect() {
|
||||
const pathname = usePathname();
|
||||
const packageName = pathname?.split('/').slice(3, 4)[0];
|
||||
@@ -21,7 +23,7 @@ export default function VersionSelect() {
|
||||
() =>
|
||||
versions
|
||||
?.map((item, idx) => (
|
||||
<Link href={`/docs/packages/${packageName}/${item}`} key={`${item}-${idx}`}>
|
||||
<Link href={`/docs/packages/${packageName}/${isDev ? 'main' : item}`} key={`${item}-${idx}`}>
|
||||
<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"
|
||||
onClick={() => versionMenu.setOpen(false)}
|
||||
|
||||
@@ -3,6 +3,10 @@ import { NextResponse, type NextRequest } from 'next/server';
|
||||
import { PACKAGES } from './util/constants';
|
||||
|
||||
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 data: string[] = await res.json();
|
||||
|
||||
|
||||
20
apps/website/src/util/addPackageToModel.ts
Normal file
20
apps/website/src/util/addPackageToModel.ts
Normal 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;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { addPackageToModel } from '@discordjs/scripts';
|
||||
import { ApiModel, ApiFunction } from '@microsoft/api-extractor-model';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { fetchModelJSON } from '~/app/docAPI';
|
||||
import { addPackageToModel } from './addPackageToModel';
|
||||
import { OVERLOAD_SEPARATOR, PACKAGES } from './constants';
|
||||
import { findMember, findMemberByKey } from './model';
|
||||
|
||||
|
||||
@@ -2,14 +2,10 @@
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"baseUrl": ".",
|
||||
"noEmit": true,
|
||||
"allowJs": false,
|
||||
"incremental": true,
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
@@ -18,8 +14,10 @@
|
||||
"paths": {
|
||||
"~/*": ["./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"],
|
||||
"exclude": ["node_modules"]
|
||||
|
||||
@@ -7,6 +7,7 @@ import prettier from 'eslint-config-neon/flat/prettier.js';
|
||||
import react from 'eslint-config-neon/flat/react.js';
|
||||
import typescript from 'eslint-config-neon/flat/typescript.js';
|
||||
import merge from 'lodash.merge';
|
||||
// import {join} from "node:path"
|
||||
|
||||
const commonFiles = '{js,mjs,cjs,ts,mts,cts,jsx,tsx}';
|
||||
|
||||
@@ -18,6 +19,7 @@ const typeScriptRuleset = merge(...typescript, {
|
||||
files: [`**/*${commonFiles}`],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
warnOnUnsupportedTypeScriptVersion: false,
|
||||
allowAutomaticSingleRunInference: true,
|
||||
project: ['tsconfig.eslint.json', 'apps/*/tsconfig.eslint.json', 'packages/*/tsconfig.eslint.json'],
|
||||
},
|
||||
|
||||
80
package.json
80
package.json
@@ -5,22 +5,23 @@
|
||||
"description": "A powerful library for interacting with the Discord API",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "turbo run build --concurrency=3",
|
||||
"build:affected": "turbo run build --filter='...[origin/main]' --concurrency=3",
|
||||
"build:apps": "turbo run build:local --filter='...{apps/*}' --concurrency=3",
|
||||
"build:apps:affected": "turbo run build:local --filter='...{apps/*}[origin/main]' --concurrency=3",
|
||||
"test": "turbo run test --concurrency=3",
|
||||
"test:affected": "turbo run test --filter='...[origin/main]' --concurrency=3",
|
||||
"lint": "turbo run lint --concurrency=3",
|
||||
"lint:affected": "turbo run lint --filter='...[origin/main]' --concurrency=3",
|
||||
"format": "turbo run format --concurrency=3",
|
||||
"format:affected": "turbo run format --filter='...[origin/main]' --concurrency=3",
|
||||
"fmt": "turbo run format --concurrency=3",
|
||||
"fmt:affected": "turbo run format --filter='...[origin/main]' --concurrency=3",
|
||||
"docs": "turbo run docs --concurrency=3",
|
||||
"docs:affected": "turbo run docs --filter='...[origin/main]' --concurrency=3",
|
||||
"postinstall": "is-ci || husky install",
|
||||
"update": "yarn upgrade-interactive",
|
||||
"build": "pnpm -- turbo run build --concurrency=4",
|
||||
"build:affected": "turbo run build --filter='...[origin/main]' --concurrency=4",
|
||||
"build:apps": "turbo run build:local --filter='...{apps/*}' --concurrency=4",
|
||||
"build:apps:affected": "turbo run build:local --filter='...{apps/*}[origin/main]' --concurrency=4",
|
||||
"test": "turbo run test --concurrency=4",
|
||||
"test:affected": "turbo run test --filter='...[origin/main]' --concurrency=4",
|
||||
"lint": "turbo run lint --concurrency=4",
|
||||
"lint:affected": "turbo run lint --filter='...[origin/main]' --concurrency=4",
|
||||
"format": "turbo run format --concurrency=4",
|
||||
"format:affected": "turbo run format --filter='...[origin/main]' --concurrency=4",
|
||||
"fmt": "turbo run format --concurrency=4",
|
||||
"fmt:affected": "turbo run format --filter='...[origin/main]' --concurrency=4",
|
||||
"docs": "turbo run docs --concurrency=4",
|
||||
"docs:affected": "turbo run docs --filter='...[origin/main]' --concurrency=4",
|
||||
"prepare": "is-ci || husky install",
|
||||
"update": "pnpm --recursive update --interactive",
|
||||
"update:latest": "pnpm --recursive update --interactive --latest",
|
||||
"create-package": "turbo gen create-package"
|
||||
},
|
||||
"type": "module",
|
||||
@@ -53,9 +54,10 @@
|
||||
"@favware/cliff-jumper": "^2.1.1",
|
||||
"@favware/npm-deprecate": "^1.0.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",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"husky": "^8.0.3",
|
||||
"is-ci": "^3.0.1",
|
||||
@@ -64,32 +66,26 @@
|
||||
"tsup": "^7.2.0",
|
||||
"turbo": "^1.10.13",
|
||||
"typescript": "^5.2.2",
|
||||
"unocss": "^0.55.2",
|
||||
"vercel": "^32.0.2",
|
||||
"vitest": "^0.34.2"
|
||||
"unocss": "^0.55.3",
|
||||
"vercel": "^32.1.0",
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"resolutions": {
|
||||
"@contentlayer/utils/@opentelemetry/core": "^1.15.1",
|
||||
"@contentlayer/utils/@opentelemetry/exporter-trace-otlp-grpc": "^0.41.1",
|
||||
"@contentlayer/utils/@opentelemetry/resources": "^1.15.1",
|
||||
"@contentlayer/utils/@opentelemetry/sdk-trace-base": "^1.15.1",
|
||||
"@contentlayer/utils/@opentelemetry/sdk-trace-node": "^1.15.1",
|
||||
"@contentlayer/utils/@opentelemetry/semantic-conventions": "^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",
|
||||
"@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",
|
||||
"yaml@2.2.2": "patch:yaml@npm%3A2.2.2#./.yarn/patches/yaml-npm-2.2.2-6e3cddb343.patch",
|
||||
"yaml@^2.2.2": "patch:yaml@npm%3A2.2.2#./.yarn/patches/yaml-npm-2.2.2-6e3cddb343.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"
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
"@contentlayer/utils>@opentelemetry/core": "^1.15.1",
|
||||
"@contentlayer/utils>@opentelemetry/exporter-trace-otlp-grpc": "^0.41.1",
|
||||
"@contentlayer/utils>@opentelemetry/resources": "^1.15.1",
|
||||
"@contentlayer/utils>@opentelemetry/sdk-trace-base": "^1.15.1",
|
||||
"@contentlayer/utils>@opentelemetry/sdk-trace-node": "^1.15.1",
|
||||
"@contentlayer/utils>@opentelemetry/semantic-conventions": "^1.15.1"
|
||||
},
|
||||
"patchedDependencies": {
|
||||
"@microsoft/tsdoc-config@0.16.2": "patches/@microsoft__tsdoc-config@0.16.2.patch",
|
||||
"eslint-plugin-i@2.28.0-2": "patches/eslint-plugin-i@2.28.0-2.patch"
|
||||
}
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
"node": ">=18.17.1"
|
||||
},
|
||||
"workspaces": [
|
||||
"apps/*",
|
||||
"packages/*"
|
||||
],
|
||||
"packageManager": "yarn@3.6.1"
|
||||
"packageManager": "pnpm@8.7.0"
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "tsup",
|
||||
"build": "tsc --noEmit --skipLibCheck && tsup",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
|
||||
"fmt": "yarn format"
|
||||
"fmt": "pnpm run format"
|
||||
},
|
||||
"type": "module",
|
||||
"directories": {
|
||||
@@ -48,16 +48,16 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "16.18.44",
|
||||
"@vitest/coverage-v8": "^0.34.2",
|
||||
"@vitest/coverage-v8": "^0.34.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
"tsup": "^7.2.0",
|
||||
"turbo": "^1.10.13",
|
||||
"typescript": "^5.2.2",
|
||||
"vitest": "^0.34.2"
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
|
||||
42
packages/actions/src/pnpmCache/action.yml
Normal file
42
packages/actions/src/pnpmCache/action.yml
Normal 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'
|
||||
@@ -12,24 +12,29 @@ runs:
|
||||
- name: Expose yarn config as "$GITHUB_OUTPUT"
|
||||
id: yarn-config
|
||||
shell: bash
|
||||
env:
|
||||
YARN_ENABLE_GLOBAL_CACHE: 'false'
|
||||
run: |
|
||||
echo "CACHE_FOLDER=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||
echo "CURRENT_NODE_VERSION="node-$(node --version)"" >> $GITHUB_OUTPUT
|
||||
echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's,/,-,g')" >> $GITHUB_OUTPUT
|
||||
echo "NPM_GLOBAL_CACHE_FOLDER=$(npm config get cache)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Restore yarn cache
|
||||
uses: actions/cache@v3
|
||||
id: yarn-download-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-config.outputs.CACHE_FOLDER }}
|
||||
key: yarn-download-cache-${{ hashFiles('yarn.lock') }}
|
||||
key: yarn-download-cache-default-${{ hashFiles(yarn.lock, .yarnrc.yml) }}
|
||||
restore-keys: |
|
||||
yarn-download-cache-
|
||||
yarn-download-cache-default-
|
||||
|
||||
- name: Restore yarn install state
|
||||
id: yarn-install-state-cache
|
||||
- name: Restore global npm cache folder
|
||||
id: npm-global-cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: .yarn/ci-cache/
|
||||
key: ${{ runner.os }}-yarn-install-state-cache-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}
|
||||
path: ${{ steps.yarn-config.outputs.NPM_GLOBAL_CACHE_FOLDER }}
|
||||
key: npm-global-cache-default-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ hashFiles(yarn.lock, .yarnrc.yml) }}
|
||||
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
@@ -37,6 +42,7 @@ runs:
|
||||
yarn install --immutable --inline-builds
|
||||
env:
|
||||
YARN_ENABLE_GLOBAL_CACHE: 'false'
|
||||
YARN_ENABLE_MIRROR: 'false'
|
||||
YARN_NM_MODE: 'hardlinks-local'
|
||||
YARN_INSTALL_STATE_PATH: .yarn/ci-cache/install-state.gz
|
||||
YARN_INSTALL_STATE_PATH: '.yarn/ci-cache/install-state.gz'
|
||||
HUSKY: '0'
|
||||
|
||||
@@ -5,6 +5,4 @@ export default createTsupConfig({
|
||||
dts: false,
|
||||
format: 'esm',
|
||||
minify: 'terser',
|
||||
keepNames: false,
|
||||
sourcemap: false,
|
||||
});
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
"description": "Utilities for api-extractor",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
|
||||
"fmt": "yarn format"
|
||||
"fmt": "pnpm run format"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
@@ -51,7 +51,7 @@
|
||||
"devDependencies": {
|
||||
"@types/node": "16.18.44",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
|
||||
@@ -2,5 +2,4 @@ import { createTsupConfig } from '../../tsup.config.js';
|
||||
|
||||
export default createTsupConfig({
|
||||
minify: 'terser',
|
||||
keepNames: false,
|
||||
});
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
"description": "Powerful set of message brokers",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "tsup",
|
||||
"build": "tsc --noEmit --skipLibCheck && tsup",
|
||||
"build:docs": "tsc -p tsconfig.docs.json",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
|
||||
"fmt": "yarn format",
|
||||
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "yarn lint && yarn test && yarn build",
|
||||
"fmt": "pnpm run format",
|
||||
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "pnpm run lint && pnpm run test && pnpm run build",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/brokers/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
@@ -74,16 +74,16 @@
|
||||
"@favware/cliff-jumper": "^2.1.1",
|
||||
"@microsoft/api-extractor": "^7.36.4",
|
||||
"@types/node": "16.18.44",
|
||||
"@vitest/coverage-v8": "^0.34.2",
|
||||
"@vitest/coverage-v8": "^0.34.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
"tsup": "^7.2.0",
|
||||
"turbo": "^1.10.13",
|
||||
"typescript": "^5.2.2",
|
||||
"vitest": "^0.34.2"
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
"description": "A set of builders that you can use when creating your bot",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "tsup",
|
||||
"build:docs": "tsc -p tsconfig.docs.json && yarn downlevel-dts ./dist-docs ./dist-docs",
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"build:docs": "tsc -p tsconfig.docs.json && downlevel-dts ./dist-docs ./dist-docs",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
|
||||
"fmt": "yarn format",
|
||||
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "yarn lint && yarn test && yarn build",
|
||||
"fmt": "pnpm run format",
|
||||
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "pnpm run lint && pnpm run test && pnpm run build",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/builders/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
@@ -76,18 +76,18 @@
|
||||
"@favware/cliff-jumper": "^2.1.1",
|
||||
"@microsoft/api-extractor": "^7.36.4",
|
||||
"@types/node": "16.18.44",
|
||||
"@vitest/coverage-v8": "^0.34.2",
|
||||
"@vitest/coverage-v8": "^0.34.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"downlevel-dts": "^0.11.0",
|
||||
"esbuild-plugin-version-injector": "^1.2.0",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
"tsup": "^7.2.0",
|
||||
"turbo": "^1.10.13",
|
||||
"typescript": "^5.2.2",
|
||||
"vitest": "^0.34.2"
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
"description": "Utility data structure used in discord.js",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "tsup",
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"build:docs": "tsc -p tsconfig.docs.json",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
|
||||
"fmt": "yarn format",
|
||||
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "yarn lint && yarn test && yarn build",
|
||||
"fmt": "pnpm run format",
|
||||
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "pnpm run lint && pnpm run test && pnpm run build",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/collection/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
@@ -63,17 +63,17 @@
|
||||
"@favware/cliff-jumper": "^2.1.1",
|
||||
"@microsoft/api-extractor": "^7.36.4",
|
||||
"@types/node": "16.18.44",
|
||||
"@vitest/coverage-v8": "^0.34.2",
|
||||
"@vitest/coverage-v8": "^0.34.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild-plugin-version-injector": "^1.2.0",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
"tsup": "^7.2.0",
|
||||
"turbo": "^1.10.13",
|
||||
"typescript": "^5.2.2",
|
||||
"vitest": "^0.34.2"
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
"description": "A thinly abstracted wrapper around the rest API, and gateway.",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "tsup",
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"build:docs": "tsc -p tsconfig.docs.json",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
|
||||
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "yarn build && yarn lint",
|
||||
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "pnpm run build && pnpm run lint",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/core/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
@@ -40,8 +40,7 @@
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"directories": {
|
||||
"lib": "src",
|
||||
"test": "__tests__"
|
||||
"lib": "src"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
@@ -76,17 +75,17 @@
|
||||
"@favware/cliff-jumper": "^2.1.1",
|
||||
"@microsoft/api-extractor": "^7.36.4",
|
||||
"@types/node": "18.17.9",
|
||||
"@vitest/coverage-v8": "^0.34.2",
|
||||
"@vitest/coverage-v8": "^0.34.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild-plugin-version-injector": "^1.2.0",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
"tsup": "^7.2.0",
|
||||
"turbo": "^1.10.13",
|
||||
"typescript": "^5.2.2",
|
||||
"vitest": "^0.34.2"
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
|
||||
@@ -4,16 +4,17 @@
|
||||
"version": "0.2.1",
|
||||
"description": "A simple way to create a startup Discord bot.",
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
|
||||
"prepack": "yarn build && yarn lint",
|
||||
"prepack": "pnpm run build && pnpm run lint",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/create-discord-bot/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
"type": "module",
|
||||
"bin": "./dist/index.js",
|
||||
"directories": {
|
||||
"bin": "bin",
|
||||
"lib": "src"
|
||||
},
|
||||
"files": [
|
||||
@@ -59,19 +60,19 @@
|
||||
"@types/node": "16.18.44",
|
||||
"@types/prompts": "^2.4.4",
|
||||
"@types/validate-npm-package-name": "^4.0.0",
|
||||
"@vitest/coverage-v8": "^0.34.2",
|
||||
"@vitest/coverage-v8": "^0.34.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
"terser": "^5.19.2",
|
||||
"tsup": "^7.2.0",
|
||||
"typescript": "^5.2.2",
|
||||
"vitest": "^0.34.2"
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.16.0"
|
||||
"node": ">=18.17.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
||||
@@ -4,7 +4,7 @@ import path from 'node:path';
|
||||
import process from 'node:process';
|
||||
import { URL } from 'node:url';
|
||||
import glob from 'fast-glob';
|
||||
import { red, yellow, green, cyan } from 'picocolors';
|
||||
import picocolors from 'picocolors';
|
||||
import type { PackageManager } from './helpers/packageManager.js';
|
||||
import { install } from './helpers/packageManager.js';
|
||||
import { GUIDE_URL } from './util/constants.js';
|
||||
@@ -34,12 +34,16 @@ export async function createDiscordBot({ directory, installPackages, typescript,
|
||||
|
||||
// If the directory is actually a file or if it's not empty, throw an error.
|
||||
if (!directoryStats.isDirectory() || (await readdir(root)).length > 0) {
|
||||
console.error(red(`The directory ${yellow(`"${directoryName}"`)} is either not a directory or is not empty.`));
|
||||
console.error(red(`Please specify an empty directory.`));
|
||||
console.error(
|
||||
picocolors.red(
|
||||
`The directory ${picocolors.yellow(`"${directoryName}"`)} is either not a directory or is not empty.`,
|
||||
),
|
||||
);
|
||||
console.error(picocolors.red(`Please specify an empty directory.`));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`Creating ${directoryName} in ${green(root)}.`);
|
||||
console.log(`Creating ${directoryName} in ${picocolors.green(root)}.`);
|
||||
const deno = packageManager === 'deno';
|
||||
await cp(new URL(`../template/${deno ? 'Deno' : typescript ? 'TypeScript' : 'JavaScript'}`, import.meta.url), root, {
|
||||
recursive: true,
|
||||
@@ -82,12 +86,14 @@ export async function createDiscordBot({ directory, installPackages, typescript,
|
||||
await writeFile(file, newData);
|
||||
}
|
||||
|
||||
const newPackageJSON = await readFile('./package.json', { encoding: 'utf8' }).then((str) => {
|
||||
let newStr = str.replace('[REPLACE_ME]', directoryName);
|
||||
newStr = newStr.replaceAll('[REPLACE_IMPORT_EXT]', typescript ? 'ts' : 'js');
|
||||
return newStr;
|
||||
});
|
||||
await writeFile('./package.json', newPackageJSON);
|
||||
if (!deno) {
|
||||
const newPackageJSON = await readFile('./package.json', { encoding: 'utf8' }).then((str) => {
|
||||
let newStr = str.replace('[REPLACE_ME]', directoryName);
|
||||
newStr = newStr.replaceAll('[REPLACE_IMPORT_EXT]', typescript ? 'ts' : 'js');
|
||||
return newStr;
|
||||
});
|
||||
await writeFile('./package.json', newPackageJSON);
|
||||
}
|
||||
|
||||
if (installPackages) {
|
||||
try {
|
||||
@@ -96,15 +102,15 @@ export async function createDiscordBot({ directory, installPackages, typescript,
|
||||
console.log();
|
||||
const err = error as ExecException;
|
||||
if (err.signal === 'SIGINT') {
|
||||
console.log(red('Installation aborted.'));
|
||||
console.log(picocolors.red('Installation aborted.'));
|
||||
} else {
|
||||
console.error(red('Installation failed.'));
|
||||
console.error(picocolors.red('Installation failed.'));
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log();
|
||||
console.log(green('All done! Be sure to read through the discord.js guide for help on your journey.'));
|
||||
console.log(`Link: ${cyan(GUIDE_URL)}`);
|
||||
console.log(picocolors.green('All done! Be sure to read through the discord.js guide for help on your journey.'));
|
||||
console.log(`Link: ${picocolors.cyan(GUIDE_URL)}`);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { execSync } from 'node:child_process';
|
||||
import process from 'node:process';
|
||||
import { yellow } from 'picocolors';
|
||||
import picocolors from 'picocolors';
|
||||
import { DEFAULT_PACKAGE_MANAGER } from '../util/constants.js';
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ export function resolvePackageManager(): PackageManager {
|
||||
}
|
||||
|
||||
console.error(
|
||||
yellow(
|
||||
picocolors.yellow(
|
||||
`Detected an unsupported package manager (${npmConfigUserAgent}). Falling back to ${DEFAULT_PACKAGE_MANAGER}.`,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"devDependencies": {
|
||||
"@sapphire/ts-config": "^4.0.1",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint-config-neon": "^0.1.47",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2"
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
"@sapphire/ts-config": "^4.0.1",
|
||||
"bun-types": "^0.7.3",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint-config-neon": "^0.1.47",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
"typescript": "^5.1.6"
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.47.0",
|
||||
"eslint-config-neon": "^0.1.47",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2"
|
||||
}
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sapphire/ts-config": "^4.0.1",
|
||||
"@types/node": "^18.17.6",
|
||||
"@types/node": "^18.17.11",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint-config-neon": "^0.1.47",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
"typescript": "^5.1.6"
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,5 @@ export default createTsupConfig({
|
||||
dts: false,
|
||||
format: 'esm',
|
||||
minify: 'terser',
|
||||
keepNames: false,
|
||||
sourcemap: false,
|
||||
});
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
"version": "14.13.0",
|
||||
"description": "A powerful library for interacting with the Discord API",
|
||||
"scripts": {
|
||||
"test": "yarn docs:test && yarn test:typescript",
|
||||
"test": "pnpm run docs:test && pnpm run test:typescript",
|
||||
"test:typescript": "tsc --noEmit && tsd",
|
||||
"lint": "prettier --check . && tslint typings/index.d.ts && cross-env ESLINT_USE_FLAT_CONFIG=false eslint --format=pretty src",
|
||||
"format": "prettier --write . && cross-env ESLINT_USE_FLAT_CONFIG=false eslint --fix --format=pretty src",
|
||||
"fmt": "yarn format",
|
||||
"fmt": "pnpm run format",
|
||||
"docs": "docgen -i './src/*.js' './src/**/*.js' -c ./docs/index.json -r ../../ -o ./docs/docs.json",
|
||||
"docs:test": "docgen -i './src/*.js' './src/**/*.js' -c ./docs/index.json -r ../../",
|
||||
"prepack": "yarn lint && yarn test",
|
||||
"prepack": "pnpm run lint && pnpm run test",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/discord.js/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
@@ -72,7 +72,7 @@
|
||||
"@types/node": "16.18.44",
|
||||
"cross-env": "^7.0.3",
|
||||
"dtslint": "4.2.1",
|
||||
"eslint": "8.47.0",
|
||||
"eslint": "8.48.0",
|
||||
"eslint-formatter-pretty": "5.0.0",
|
||||
"jest": "29.6.4",
|
||||
"prettier": "3.0.2",
|
||||
|
||||
@@ -24,4 +24,4 @@ const command = createCommand()
|
||||
const program = command.parse(process.argv);
|
||||
const options = program.opts<CLIOptions>();
|
||||
|
||||
build(options);
|
||||
void build(options);
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
"build": "tsup",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
|
||||
"fmt": "yarn format",
|
||||
"prepack": "yarn format && yarn build"
|
||||
"fmt": "pnpm run format",
|
||||
"prepare": "pnpm run build",
|
||||
"prepack": "pnpm run format && pnpm run build"
|
||||
},
|
||||
"bin": "./dist/bin/index.js",
|
||||
"exports": {
|
||||
@@ -27,6 +28,7 @@
|
||||
"module": "./dist/src/index.mjs",
|
||||
"types": "./dist/src/index.d.ts",
|
||||
"directories": {
|
||||
"bin": "bin",
|
||||
"lib": "src"
|
||||
},
|
||||
"files": [
|
||||
@@ -60,14 +62,14 @@
|
||||
"commander": "^11.0.0",
|
||||
"jsdoc-to-markdown": "^8.0.0",
|
||||
"tslib": "^2.6.2",
|
||||
"typedoc": "^0.24.8"
|
||||
"typedoc": "^0.25.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@favware/cliff-jumper": "^2.1.1",
|
||||
"@types/jsdoc-to-markdown": "^7.0.3",
|
||||
"@types/node": "16.18.44",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
|
||||
@@ -17,14 +17,12 @@ interface CustomFiles {
|
||||
path?: string;
|
||||
}
|
||||
|
||||
export function build({ input, custom: customDocs, root, output, typescript }: CLIOptions) {
|
||||
export async function build({ input, custom: customDocs, root, output, typescript }: CLIOptions) {
|
||||
let data: (ChildTypes & RootTypes)[] | DeclarationReflection[] = [];
|
||||
if (typescript) {
|
||||
console.log('Parsing Typescript in source files...');
|
||||
const app = new Application();
|
||||
app.options.addReader(new TSConfigReader());
|
||||
app.bootstrap({ entryPoints: input });
|
||||
const project = app.convert();
|
||||
const app = await Application.bootstrap({ entryPoints: input }, [new TSConfigReader()]);
|
||||
const project = await app.convert();
|
||||
if (project) {
|
||||
// @ts-expect-error: Types are lost with this method
|
||||
data = app.serializer.toObject(project).children!;
|
||||
|
||||
@@ -3,6 +3,4 @@ import { createTsupConfig } from '../../tsup.config.js';
|
||||
export default createTsupConfig({
|
||||
entry: ['src/index.ts', 'bin/index.ts'],
|
||||
minify: 'terser',
|
||||
keepNames: false,
|
||||
sourcemap: false,
|
||||
});
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
"description": "A set of functions to format strings for Discord.",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "tsup",
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"build:docs": "tsc -p tsconfig.docs.json",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
|
||||
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "yarn build && yarn lint",
|
||||
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "pnpm run build && pnpm run lint",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/formatters/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
@@ -60,16 +60,16 @@
|
||||
"@favware/cliff-jumper": "^2.1.1",
|
||||
"@microsoft/api-extractor": "^7.36.4",
|
||||
"@types/node": "16.18.44",
|
||||
"@vitest/coverage-v8": "^0.34.2",
|
||||
"@vitest/coverage-v8": "^0.34.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
"tsup": "^7.2.0",
|
||||
"turbo": "^1.10.13",
|
||||
"typescript": "^5.2.2",
|
||||
"vitest": "^0.34.2"
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
"description": "A powerful TypeScript library for interacting with the Discord API",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "tsup",
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"build:docs": "tsc -p tsconfig.docs.json",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
|
||||
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "yarn build && yarn lint",
|
||||
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "pnpm run build && pnpm run lint",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/next/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
@@ -77,20 +77,20 @@
|
||||
"@favware/cliff-jumper": "^2.1.1",
|
||||
"@microsoft/api-extractor": "^7.36.4",
|
||||
"@types/node": "18.17.9",
|
||||
"@vitest/coverage-v8": "^0.34.2",
|
||||
"@vitest/coverage-v8": "^0.34.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild-plugin-version-injector": "^1.2.0",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
"tsup": "^7.2.0",
|
||||
"turbo": "^1.10.13",
|
||||
"typescript": "^5.2.2",
|
||||
"vitest": "^0.34.2"
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.13.0"
|
||||
"node": ">=18.17.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
||||
@@ -1,26 +1,34 @@
|
||||
FROM node:18-alpine AS builder
|
||||
FROM node:18-alpine AS base
|
||||
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
|
||||
RUN apk update
|
||||
RUN apk add --no-cache libc6-compat
|
||||
|
||||
WORKDIR /usr/proxy
|
||||
RUN corepack enable
|
||||
RUN corepack prepare pnpm@latest --activate
|
||||
|
||||
COPY manifests .
|
||||
COPY . /usr/proxy-container
|
||||
WORKDIR /usr/proxy-container
|
||||
|
||||
RUN npm install --global is-ci husky
|
||||
FROM base AS builder
|
||||
|
||||
RUN yarn install --immutable --inline-builds
|
||||
RUN rm -rf .yarn/cache
|
||||
RUN pnpm install --frozen-lockfile --ignore-scripts
|
||||
RUN pnpm exec turbo run build --filter='@discordjs/proxy-container...'
|
||||
|
||||
FROM node:18-alpine AS runner
|
||||
FROM builder AS pruned
|
||||
|
||||
WORKDIR /usr/proxy
|
||||
RUN pnpm --filter='@discordjs/proxy-container' --prod deploy pruned
|
||||
|
||||
FROM node:18-alpine AS proxy
|
||||
|
||||
WORKDIR /usr/proxy-container
|
||||
|
||||
RUN addgroup --system --gid 1001 nodejs
|
||||
RUN adduser --system --uid 1001 proxy
|
||||
USER proxy
|
||||
RUN adduser --system --uid 1001 proxy-container
|
||||
USER proxy-container
|
||||
|
||||
COPY --from=builder /usr/proxy .
|
||||
COPY packs .
|
||||
COPY --from=pruned /usr/proxy-container/pruned .
|
||||
|
||||
CMD ["node", "--enable-source-maps", "dist/index.js"]
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
"version": "1.0.0",
|
||||
"description": "Lightweight HTTP proxy for Discord's API, brought to you as a container 📦",
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
|
||||
"fmt": "yarn format",
|
||||
"prepack": "yarn lint && yarn build"
|
||||
"fmt": "pnpm run format",
|
||||
"prepack": "pnpm run lint && pnpm run build"
|
||||
},
|
||||
"type": "module",
|
||||
"directories": {
|
||||
@@ -51,7 +51,7 @@
|
||||
"devDependencies": {
|
||||
"@types/node": "18.17.9",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
|
||||
@@ -3,6 +3,8 @@ import process from 'node:process';
|
||||
import { proxyRequests } from '@discordjs/proxy';
|
||||
import { REST } from '@discordjs/rest';
|
||||
|
||||
process.on('SIGINT', () => process.exit(0));
|
||||
|
||||
// We want to let upstream handle retrying
|
||||
const api = new REST({ rejectOnRateLimit: () => true, retries: 0 });
|
||||
const server = createServer(proxyRequests(api));
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
"description": "Tools for running an HTTP proxy for Discord's API",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "tsup",
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"build:docs": "tsc -p tsconfig.docs.json",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
|
||||
"fmt": "yarn format",
|
||||
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "yarn lint && yarn test && yarn build",
|
||||
"fmt": "pnpm run format",
|
||||
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "pnpm run lint && pnpm run test && pnpm run build",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/proxy/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
@@ -74,9 +74,9 @@
|
||||
"@microsoft/api-extractor": "^7.36.4",
|
||||
"@types/node": "18.17.9",
|
||||
"@types/supertest": "^2.0.12",
|
||||
"@vitest/coverage-v8": "^0.34.2",
|
||||
"@vitest/coverage-v8": "^0.34.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
@@ -84,7 +84,7 @@
|
||||
"tsup": "^7.2.0",
|
||||
"turbo": "^1.10.13",
|
||||
"typescript": "^5.2.2",
|
||||
"vitest": "^0.34.2"
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
"description": "The REST API for discord.js",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "tsup",
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"build:docs": "tsc -p tsconfig.docs.json",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
|
||||
"fmt": "yarn format",
|
||||
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "yarn lint && yarn test && yarn build",
|
||||
"fmt": "pnpm run format",
|
||||
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "pnpm run lint && pnpm run test && pnpm run build",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/rest/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
@@ -96,17 +96,17 @@
|
||||
"@favware/cliff-jumper": "^2.1.1",
|
||||
"@microsoft/api-extractor": "^7.36.4",
|
||||
"@types/node": "18.17.9",
|
||||
"@vitest/coverage-v8": "^0.34.2",
|
||||
"@vitest/coverage-v8": "^0.34.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild-plugin-version-injector": "^1.2.0",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
"tsup": "^7.2.0",
|
||||
"turbo": "^1.10.13",
|
||||
"typescript": "^5.2.2",
|
||||
"vitest": "^0.34.2"
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
"description": "A set of scripts that we use for our workflows",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src turbo",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src turbo",
|
||||
"fmt": "yarn format"
|
||||
"fmt": "pnpm run format"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
@@ -26,7 +26,8 @@
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"directories": {
|
||||
"lib": "src"
|
||||
"lib": "src",
|
||||
"example": "turbo"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
@@ -63,16 +64,16 @@
|
||||
"devDependencies": {
|
||||
"@turbo/gen": "^1.10.13",
|
||||
"@types/node": "16.18.44",
|
||||
"@vitest/coverage-v8": "^0.34.2",
|
||||
"@vitest/coverage-v8": "^0.34.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
"tsup": "^7.2.0",
|
||||
"turbo": "^1.10.13",
|
||||
"typescript": "^5.2.2",
|
||||
"vitest": "^0.34.2"
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
|
||||
@@ -2,5 +2,4 @@ import { createTsupConfig } from '../../tsup.config.js';
|
||||
|
||||
export default createTsupConfig({
|
||||
minify: 'terser',
|
||||
keepNames: false,
|
||||
});
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
"description": "{{description}}",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "tsup",
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"build:docs": "tsc -p tsconfig.docs.json",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
|
||||
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "yarn build && yarn lint",
|
||||
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "pnpm run build && pnpm run lint",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/{{name}}/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
@@ -62,11 +62,11 @@
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
"tsup": "^7.2.0",
|
||||
"typescript": "^5.1.6",
|
||||
"typescript": "^5.2.2",
|
||||
"vitest": "^0.34.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.16.0"
|
||||
"node": ">=18.17.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"build": "vite build",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
|
||||
"prepack": "yarn build && yarn lint",
|
||||
"prepack": "pnpm run build && pnpm run lint",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/ui/*'",
|
||||
"release": "cliff-jumper",
|
||||
"storybook": "storybook dev -p 6006",
|
||||
@@ -52,7 +52,7 @@
|
||||
"homepage": "https://discord.js.org",
|
||||
"dependencies": {
|
||||
"@react-icons/all-files": "^4.1.0",
|
||||
"ariakit": "^2.0.0-next.44",
|
||||
"ariakit": "2.0.0-next.44",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
},
|
||||
@@ -62,7 +62,7 @@
|
||||
"@storybook/addon-essentials": "^7.3.2",
|
||||
"@storybook/addon-interactions": "^7.3.2",
|
||||
"@storybook/addon-links": "^7.3.2",
|
||||
"@storybook/addon-styling": "^1.3.6",
|
||||
"@storybook/addon-styling": "^1.3.7",
|
||||
"@storybook/blocks": "^7.3.2",
|
||||
"@storybook/react": "^7.3.2",
|
||||
"@storybook/react-vite": "^7.3.2",
|
||||
@@ -70,13 +70,13 @@
|
||||
"@types/node": "16.18.44",
|
||||
"@types/react": "^18.2.21",
|
||||
"@types/react-dom": "^18.2.7",
|
||||
"@unocss/eslint-plugin": "^0.55.2",
|
||||
"@unocss/reset": "^0.55.2",
|
||||
"@unocss/eslint-plugin": "^0.55.3",
|
||||
"@unocss/reset": "^0.55.3",
|
||||
"@vitejs/plugin-react": "^4.0.4",
|
||||
"@vitest/coverage-c8": "^0.33.0",
|
||||
"chromatic": "^6.24.0",
|
||||
"@vitest/coverage-v8": "^0.34.3",
|
||||
"chromatic": "^6.24.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
@@ -84,10 +84,10 @@
|
||||
"storybook": "^7.3.2",
|
||||
"turbo": "^1.10.13",
|
||||
"typescript": "^5.2.2",
|
||||
"unocss": "^0.55.2",
|
||||
"unocss": "^0.55.3",
|
||||
"vite": "^4.4.9",
|
||||
"vite-plugin-dts": "^3.5.2",
|
||||
"vitest": "^0.34.2"
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
|
||||
@@ -3,12 +3,9 @@
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"baseUrl": ".",
|
||||
"noEmit": true,
|
||||
"allowJs": false,
|
||||
"incremental": true,
|
||||
"skipLibCheck": true,
|
||||
"paths": {
|
||||
"~/*": ["./src/*"]
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
"version": "1.0.1",
|
||||
"description": "Utilities shared across Discord.js packages",
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"build:docs": "tsc -p tsconfig.docs.json",
|
||||
"test": "vitest run && tsd",
|
||||
"lint": "prettier --check . && TIMING=1 eslint --format=pretty src",
|
||||
"format": "prettier --write . && TIMING=1 eslint --fix --format=pretty src",
|
||||
"fmt": "yarn format",
|
||||
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "yarn lint && yarn test && yarn build",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
|
||||
"fmt": "pnpm run format",
|
||||
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "pnpm run lint && pnpm run test && pnpm run build",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/util/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
@@ -64,9 +64,9 @@
|
||||
"@favware/cliff-jumper": "^2.1.1",
|
||||
"@microsoft/api-extractor": "^7.36.4",
|
||||
"@types/node": "16.18.44",
|
||||
"@vitest/coverage-v8": "^0.34.2",
|
||||
"@vitest/coverage-v8": "^0.34.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"prettier": "^3.0.2",
|
||||
@@ -74,7 +74,7 @@
|
||||
"tsup": "^7.2.0",
|
||||
"turbo": "^1.10.13",
|
||||
"typescript": "^5.2.2",
|
||||
"vitest": "^0.34.2"
|
||||
"vitest": "^0.34.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
"version": "0.16.0",
|
||||
"description": "Implementation of the Discord Voice API for Node.js",
|
||||
"scripts": {
|
||||
"build": "tsup && node scripts/postbuild.mjs",
|
||||
"build": "tsc --noEmit && tsup && node scripts/postbuild.mjs",
|
||||
"build:docs": "tsc -p tsconfig.docs.json",
|
||||
"test": "jest --coverage",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
|
||||
"fmt": "yarn format",
|
||||
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "yarn lint && yarn test && yarn build",
|
||||
"fmt": "pnpm run format",
|
||||
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "pnpm run lint && pnpm run test && pnpm run build",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/voice/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
@@ -78,7 +78,7 @@
|
||||
"@types/node": "16.18.44",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild-plugin-version-injector": "^1.2.0",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"jest": "^29.6.4",
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
"description": "Wrapper around Discord's gateway",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "tsup",
|
||||
"build": "tsc --noEmit && tsup",
|
||||
"build:docs": "tsc -p tsconfig.docs.json",
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
|
||||
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "yarn build && yarn lint",
|
||||
"docs": "pnpm run build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
|
||||
"prepack": "pnpm run build && pnpm run lint",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/ws/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
@@ -86,10 +86,10 @@
|
||||
"@favware/cliff-jumper": "^2.1.1",
|
||||
"@microsoft/api-extractor": "^7.36.4",
|
||||
"@types/node": "18.17.9",
|
||||
"@vitest/coverage-v8": "^0.34.2",
|
||||
"@vitest/coverage-v8": "^0.34.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"esbuild-plugin-version-injector": "^1.2.0",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint": "^8.48.0",
|
||||
"eslint-config-neon": "^0.1.56",
|
||||
"eslint-formatter-pretty": "^5.0.0",
|
||||
"mock-socket": "^9.2.1",
|
||||
@@ -98,7 +98,7 @@
|
||||
"turbo": "^1.10.13",
|
||||
"typescript": "^5.2.2",
|
||||
"undici": "5.23.0",
|
||||
"vitest": "^0.34.2",
|
||||
"vitest": "^0.34.3",
|
||||
"zlib-sync": "^0.1.8"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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
|
||||
+++ b/lib/rules/extensions.js
|
||||
@@ -3,7 +3,8 @@
|
||||
@@ -54,8 +54,8 @@ index 3bd6529d40ae428e6efbda0fd6d48de10e7ea110..3d94d9f6ac3d3b47460585816c79ac39
|
||||
(0, _importType.isScoped)(importPath);
|
||||
|
||||
- if (!extension || !importPath.endsWith('.' + String(extension))) {
|
||||
+ const validExtensions = getValidExtensionFor(context, importPath, extension);
|
||||
+ if (!extension || !validExtensions.some((extension) => importPath.endsWith('.' + String(extension)))) {
|
||||
+ const validExtensions = getValidExtensionFor(context, importPath, extension);
|
||||
+ if (!extension || !validExtensions.some((extension) => importPath.endsWith('.' + String(extension)))) {
|
||||
// ignore type-only imports and exports
|
||||
- if (node.importKind === 'type' || node.exportKind === 'type') {return;}
|
||||
+ if (!props.checkTypeImports && (node.importKind === 'type' || node.exportKind === 'type')) {return;}
|
||||
23958
pnpm-lock.yaml
generated
Normal file
23958
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
3
pnpm-workspace.yaml
Normal file
3
pnpm-workspace.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
packages:
|
||||
- 'apps/*'
|
||||
- 'packages/*'
|
||||
@@ -9,34 +9,41 @@
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noImplicitOverride": true,
|
||||
"noImplicitReturns": true,
|
||||
"noPropertyAccessFromIndexSignature": false,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"strict": true,
|
||||
"useUnknownInCatchVariables": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
|
||||
// Modules
|
||||
"allowArbitraryExtensions": false,
|
||||
"allowImportingTsExtensions": false,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"moduleResolution": "Bundler",
|
||||
"resolveJsonModule": true,
|
||||
"resolvePackageJsonExports": true,
|
||||
"resolvePackageJsonImports": true,
|
||||
|
||||
// Emit
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"importHelpers": true,
|
||||
"inlineSources": true,
|
||||
"importHelpers": false,
|
||||
"newLine": "lf",
|
||||
"noEmitHelpers": true,
|
||||
"outDir": "dist",
|
||||
"removeComments": false,
|
||||
"sourceMap": true,
|
||||
"esModuleInterop": true,
|
||||
|
||||
// Interop Constraints
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"isolatedModules": true,
|
||||
|
||||
// Language and Environment
|
||||
"experimentalDecorators": true,
|
||||
"lib": ["ESNext"],
|
||||
"target": "ES2021",
|
||||
"target": "ES2022",
|
||||
"useDefineForClassFields": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,14 @@ export function createTsupConfig({
|
||||
target = 'es2022',
|
||||
skipNodeModulesBundle = true,
|
||||
clean = true,
|
||||
shims = true,
|
||||
shims = format.includes('cjs'),
|
||||
cjsInterop = format.includes('cjs'),
|
||||
minify = false,
|
||||
terserOptions = {
|
||||
mangle: false,
|
||||
keep_classnames: true,
|
||||
keep_fnames: true,
|
||||
},
|
||||
splitting = false,
|
||||
keepNames = true,
|
||||
dts = true,
|
||||
@@ -29,7 +35,9 @@ export function createTsupConfig({
|
||||
target,
|
||||
clean,
|
||||
shims,
|
||||
cjsInterop,
|
||||
minify,
|
||||
terserOptions,
|
||||
splitting,
|
||||
keepNames,
|
||||
dts,
|
||||
|
||||
16
turbo.json
16
turbo.json
@@ -5,7 +5,6 @@
|
||||
".gitignore",
|
||||
".lintstagedrc.json",
|
||||
".prettierrc.json",
|
||||
".yarnrc.yml",
|
||||
"api-extractor.json",
|
||||
"codecov.yml",
|
||||
"eslint.config.js",
|
||||
@@ -18,12 +17,17 @@
|
||||
"turbo.json",
|
||||
"unocss.config.ts",
|
||||
"vitest.config.ts",
|
||||
"yarn.lock"
|
||||
"pnpm-lock.yaml",
|
||||
"pnpm-workspace.yaml"
|
||||
],
|
||||
"pipeline": {
|
||||
"build": {
|
||||
"dependsOn": ["^build"],
|
||||
"inputs": [
|
||||
"bin/**/*.ts",
|
||||
"bin/**/*.js",
|
||||
"bin/**/*.mjs",
|
||||
"bin/**/*.cjs",
|
||||
"src/**/*.ts",
|
||||
"src/**/*.tsx",
|
||||
"src/**/*.js",
|
||||
@@ -106,7 +110,7 @@
|
||||
"tsconfig.eslint.json",
|
||||
"tsconfig.json"
|
||||
],
|
||||
"outputs": [".contentlayer/**/*", ".next/**/*"],
|
||||
"outputs": [".contentlayer/**/*", ".next/**/*", "!.next/cache/**/*"],
|
||||
"outputMode": "full"
|
||||
},
|
||||
"@discordjs/guide#build:prod": {
|
||||
@@ -127,7 +131,7 @@
|
||||
"tsconfig.eslint.json",
|
||||
"tsconfig.json"
|
||||
],
|
||||
"outputs": [".contentlayer/**/*", ".next/**/*"],
|
||||
"outputs": [".contentlayer/**/*", ".next/**/*", "!.next/cache/**/*"],
|
||||
"outputMode": "full"
|
||||
},
|
||||
"@discordjs/website#build:local": {
|
||||
@@ -152,7 +156,7 @@
|
||||
"tsconfig.eslint.json",
|
||||
"tsconfig.json"
|
||||
],
|
||||
"outputs": [".next/**/*"],
|
||||
"outputs": [".next/**/*", "!.next/cache/**/*"],
|
||||
"outputMode": "full"
|
||||
},
|
||||
"@discordjs/website#build:prod": {
|
||||
@@ -173,7 +177,7 @@
|
||||
"tsconfig.eslint.json",
|
||||
"tsconfig.json"
|
||||
],
|
||||
"outputs": [".next/**/*"],
|
||||
"outputs": [".next/**/*", "!.next/cache/**/*"],
|
||||
"outputMode": "full"
|
||||
},
|
||||
"@discordjs/guide#generate:contentlayer": {
|
||||
|
||||
Reference in New Issue
Block a user