mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
build: tsup for better cjs / esm support
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
import { createUnbuildConfig } from '../../build.config';
|
||||
|
||||
export default createUnbuildConfig({
|
||||
entries: [
|
||||
{ builder: 'rollup', input: 'src/index' },
|
||||
{ builder: 'rollup', input: 'src/formatTag/index' },
|
||||
],
|
||||
preserveModules: false,
|
||||
minify: true,
|
||||
emitCJS: false,
|
||||
});
|
||||
@@ -5,7 +5,7 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "unbuild",
|
||||
"build": "tsup",
|
||||
"lint": "prettier --check . && TIMING=1 eslint src __tests__ --ext mjs,js,ts",
|
||||
"format": "prettier --write . && TIMING=1 eslint src __tests__ --ext mjs,js,ts --fix",
|
||||
"fmt": "yarn format"
|
||||
@@ -48,9 +48,8 @@
|
||||
"eslint": "^8.23.0",
|
||||
"eslint-config-neon": "^0.1.23",
|
||||
"prettier": "^2.7.1",
|
||||
"rollup-plugin-typescript2": "^0.33.0",
|
||||
"tsup": "^6.2.3",
|
||||
"typescript": "^4.8.2",
|
||||
"unbuild": "^0.8.9",
|
||||
"vitest": "^0.22.1"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
7
packages/actions/tsup.config.js
Normal file
7
packages/actions/tsup.config.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { createTsupConfig } from '../../tsup.config.js';
|
||||
|
||||
export default createTsupConfig({
|
||||
entry: ['src/index.ts', 'src/formatTag/index.ts'],
|
||||
format: ['esm'],
|
||||
minify: true,
|
||||
});
|
||||
@@ -4,12 +4,13 @@
|
||||
"description": "Utilities for api-extractor",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"build": "tsup",
|
||||
"lint": "prettier --check . && TIMING=1 eslint src --ext mjs,js,ts",
|
||||
"format": "prettier --write . && TIMING=1 eslint src --ext mjs,js,ts --fix",
|
||||
"fmt": "yarn format"
|
||||
},
|
||||
"main": "./dist/index.mjs",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"directories": {
|
||||
"lib": "src"
|
||||
@@ -38,9 +39,8 @@
|
||||
"eslint": "^8.23.0",
|
||||
"eslint-config-neon": "^0.1.23",
|
||||
"prettier": "^2.7.1",
|
||||
"rollup-plugin-typescript2": "^0.33.0",
|
||||
"typescript": "^4.8.2",
|
||||
"unbuild": "^0.8.9"
|
||||
"tsup": "^6.2.3",
|
||||
"typescript": "^4.8.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.9.0"
|
||||
|
||||
5
packages/api-extractor-utils/tsup.config.js
Normal file
5
packages/api-extractor-utils/tsup.config.js
Normal file
@@ -0,0 +1,5 @@
|
||||
import { createTsupConfig } from '../../tsup.config.js';
|
||||
|
||||
export default createTsupConfig({
|
||||
minify: true,
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
import { createUnbuildConfig } from '../../build.config';
|
||||
|
||||
export default createUnbuildConfig();
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "A set of builders that you can use when creating your bot",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "unbuild",
|
||||
"build": "tsup",
|
||||
"lint": "prettier --check . && TIMING=1 eslint src __tests__ --ext mjs,js,ts",
|
||||
"format": "prettier --write . && TIMING=1 eslint src __tests__ --ext mjs,js,ts --fix",
|
||||
"fmt": "yarn format",
|
||||
@@ -13,12 +13,12 @@
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/builders/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs",
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"directories": {
|
||||
@@ -70,9 +70,8 @@
|
||||
"eslint": "^8.23.0",
|
||||
"eslint-config-neon": "^0.1.23",
|
||||
"prettier": "^2.7.1",
|
||||
"rollup-plugin-typescript2": "^0.33.0",
|
||||
"tsup": "^6.2.3",
|
||||
"typescript": "^4.8.2",
|
||||
"unbuild": "^0.8.9",
|
||||
"vitest": "^0.22.1"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
3
packages/builders/tsup.config.js
Normal file
3
packages/builders/tsup.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import { createTsupConfig } from '../../tsup.config.js';
|
||||
|
||||
export default createTsupConfig();
|
||||
@@ -1,3 +0,0 @@
|
||||
import { createUnbuildConfig } from '../../build.config';
|
||||
|
||||
export default createUnbuildConfig();
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "Utility data structure used in discord.js",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "unbuild",
|
||||
"build": "tsup",
|
||||
"lint": "prettier --check . && TIMING=1 eslint src __tests__ --ext mjs,js,ts",
|
||||
"format": "prettier --write . && TIMING=1 eslint src __tests__ --ext mjs,js,ts --fix",
|
||||
"fmt": "yarn format",
|
||||
@@ -13,12 +13,12 @@
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/collection/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs",
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"directories": {
|
||||
@@ -59,9 +59,8 @@
|
||||
"eslint": "^8.23.0",
|
||||
"eslint-config-neon": "^0.1.23",
|
||||
"prettier": "^2.7.1",
|
||||
"rollup-plugin-typescript2": "^0.33.0",
|
||||
"tsup": "^6.2.3",
|
||||
"typescript": "^4.8.2",
|
||||
"unbuild": "^0.8.9",
|
||||
"vitest": "^0.22.1"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
3
packages/collection/tsup.config.js
Normal file
3
packages/collection/tsup.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import { createTsupConfig } from '../../tsup.config.js';
|
||||
|
||||
export default createTsupConfig();
|
||||
@@ -1,9 +0,0 @@
|
||||
import { createUnbuildConfig } from '../../build.config';
|
||||
|
||||
export default createUnbuildConfig({
|
||||
entries: [
|
||||
{ builder: 'rollup', input: 'src/index' },
|
||||
{ builder: 'rollup', input: 'src/cli' },
|
||||
],
|
||||
minify: true,
|
||||
});
|
||||
@@ -3,7 +3,7 @@
|
||||
"version": "0.12.1",
|
||||
"description": "The docs.json generator for discord.js and its related projects",
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"build": "tsup",
|
||||
"lint": "prettier --check . && TIMING=1 eslint src --ext mjs,js,ts",
|
||||
"format": "prettier --write . && TIMING=1 eslint src --ext mjs,js,ts --fix",
|
||||
"fmt": "yarn format",
|
||||
@@ -11,7 +11,7 @@
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/docgen/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
"bin": "./dist/cli.cjs",
|
||||
"bin": "./dist/cli.js",
|
||||
"directories": {
|
||||
"lib": "src"
|
||||
},
|
||||
@@ -45,7 +45,7 @@
|
||||
"commander": "^9.4.0",
|
||||
"jsdoc-to-markdown": "^7.1.1",
|
||||
"tslib": "^2.4.0",
|
||||
"typedoc": "^0.23.11"
|
||||
"typedoc": "^0.23.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@favware/cliff-jumper": "^1.8.7",
|
||||
@@ -54,9 +54,8 @@
|
||||
"eslint": "^8.23.0",
|
||||
"eslint-config-neon": "^0.1.23",
|
||||
"prettier": "^2.7.1",
|
||||
"rollup-plugin-typescript2": "^0.33.0",
|
||||
"typescript": "^4.8.2",
|
||||
"unbuild": "^0.8.9"
|
||||
"tsup": "^6.2.3",
|
||||
"typescript": "^4.8.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.9.0"
|
||||
|
||||
7
packages/docgen/tsup.config.js
Normal file
7
packages/docgen/tsup.config.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { createTsupConfig } from '../../tsup.config.js';
|
||||
|
||||
export default createTsupConfig({
|
||||
entry: ['src/index.ts', 'src/cli.ts'],
|
||||
minify: true,
|
||||
dts: false,
|
||||
});
|
||||
@@ -15,4 +15,4 @@ RUN yarn workspaces focus
|
||||
COPY ./packages/proxy-container ./
|
||||
RUN yarn build && yarn workspaces focus --production
|
||||
|
||||
CMD ["node", "--enable-source-maps", "./dist/index.mjs"]
|
||||
CMD ["node", "--enable-source-maps", "./dist/index.js"]
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import { createUnbuildConfig } from '../../build.config';
|
||||
|
||||
export default createUnbuildConfig({ emitCJS: false, cjsBridge: false });
|
||||
@@ -3,15 +3,15 @@
|
||||
"version": "1.0.0",
|
||||
"description": "Lightweight HTTP proxy for Discord's API, brought to you as a container 📦",
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"build": "tsup",
|
||||
"lint": "prettier --check . && TIMING=1 eslint src --ext mjs,js,ts",
|
||||
"format": "prettier --write . && TIMING=1 eslint src --ext mjs,js,ts --fix",
|
||||
"fmt": "yarn format",
|
||||
"prepack": "yarn lint && yarn test && yarn build",
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/proxy-container/*'"
|
||||
},
|
||||
"main": "./dist/index.mjs",
|
||||
"type": "module",
|
||||
"module": "./dist/index.js",
|
||||
"directories": {
|
||||
"lib": "src"
|
||||
},
|
||||
@@ -53,9 +53,8 @@
|
||||
"eslint": "^8.23.0",
|
||||
"eslint-config-neon": "^0.1.23",
|
||||
"prettier": "^2.7.1",
|
||||
"rollup-plugin-typescript2": "^0.33.0",
|
||||
"typescript": "^4.8.2",
|
||||
"unbuild": "^0.8.9"
|
||||
"tsup": "^6.2.3",
|
||||
"typescript": "^4.8.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.9.0"
|
||||
|
||||
6
packages/proxy-container/tsup.config.js
Normal file
6
packages/proxy-container/tsup.config.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import { createTsupConfig } from '../../tsup.config.js';
|
||||
|
||||
export default createTsupConfig({
|
||||
format: ['esm'],
|
||||
minify: true,
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
import { createUnbuildConfig } from '../../build.config';
|
||||
|
||||
export default createUnbuildConfig();
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "Tools for running an HTTP proxy for Discord's API",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "unbuild",
|
||||
"build": "tsup",
|
||||
"lint": "prettier --check . && TIMING=1 eslint src __tests__ --ext mjs,js,ts",
|
||||
"format": "prettier --write . && TIMING=1 eslint src __tests__ --ext mjs,js,ts --fix",
|
||||
"fmt": "yarn format",
|
||||
@@ -13,12 +13,12 @@
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/proxy/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"typings": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs",
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"directories": {
|
||||
@@ -69,10 +69,9 @@
|
||||
"eslint": "^8.23.0",
|
||||
"eslint-config-neon": "^0.1.23",
|
||||
"prettier": "^2.7.1",
|
||||
"rollup-plugin-typescript2": "^0.33.0",
|
||||
"supertest": "^6.2.4",
|
||||
"tsup": "^6.2.3",
|
||||
"typescript": "^4.8.2",
|
||||
"unbuild": "^0.8.9",
|
||||
"vitest": "^0.22.1"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
3
packages/proxy/tsup.config.js
Normal file
3
packages/proxy/tsup.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import { createTsupConfig } from '../../tsup.config.js';
|
||||
|
||||
export default createTsupConfig();
|
||||
@@ -1,3 +0,0 @@
|
||||
import { createUnbuildConfig } from '../../build.config';
|
||||
|
||||
export default createUnbuildConfig();
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "The REST API for discord.js",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "unbuild",
|
||||
"build": "tsup",
|
||||
"lint": "prettier --check . && TIMING=1 eslint src __tests__ --ext mjs,js,ts",
|
||||
"format": "prettier --write . && TIMING=1 eslint src __tests__ --ext mjs,js,ts --fix",
|
||||
"fmt": "yarn format",
|
||||
@@ -13,12 +13,12 @@
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/rest/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"typings": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs",
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"directories": {
|
||||
@@ -70,9 +70,8 @@
|
||||
"eslint": "^8.23.0",
|
||||
"eslint-config-neon": "^0.1.23",
|
||||
"prettier": "^2.7.1",
|
||||
"rollup-plugin-typescript2": "^0.33.0",
|
||||
"tsup": "^6.2.3",
|
||||
"typescript": "^4.8.2",
|
||||
"unbuild": "^0.8.9",
|
||||
"vitest": "^0.22.1"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
3
packages/rest/tsup.config.js
Normal file
3
packages/rest/tsup.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import { createTsupConfig } from '../../tsup.config.js';
|
||||
|
||||
export default createTsupConfig();
|
||||
@@ -1,3 +0,0 @@
|
||||
import { createUnbuildConfig } from '../../build.config';
|
||||
|
||||
export default createUnbuildConfig({ minify: true });
|
||||
@@ -4,17 +4,17 @@
|
||||
"description": "A set of scripts that we use for our workflows",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"build": "tsup",
|
||||
"lint": "prettier --check . && TIMING=1 eslint src --ext mjs,js,ts",
|
||||
"format": "prettier --write . && TIMING=1 eslint src --ext mjs,js,ts --fix",
|
||||
"fmt": "yarn format"
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs",
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"directories": {
|
||||
@@ -55,9 +55,8 @@
|
||||
"eslint": "^8.23.0",
|
||||
"eslint-config-neon": "^0.1.23",
|
||||
"prettier": "^2.7.1",
|
||||
"rollup-plugin-typescript2": "^0.33.0",
|
||||
"tsup": "^6.2.3",
|
||||
"typescript": "^4.8.2",
|
||||
"unbuild": "^0.8.9",
|
||||
"vitest": "^0.22.1"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
5
packages/scripts/tsup.config.js
Normal file
5
packages/scripts/tsup.config.js
Normal file
@@ -0,0 +1,5 @@
|
||||
import { createTsupConfig } from '../../tsup.config.js';
|
||||
|
||||
export default createTsupConfig({
|
||||
minify: true,
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
import { createUnbuildConfig } from '../../build.config';
|
||||
|
||||
export default createUnbuildConfig();
|
||||
@@ -3,7 +3,7 @@
|
||||
"version": "0.12.0",
|
||||
"description": "Implementation of the Discord Voice API for node.js",
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"build": "tsup",
|
||||
"test": "jest --coverage",
|
||||
"lint": "prettier --check . && TIMING=1 eslint src __tests__ --ext mjs,js,ts",
|
||||
"format": "prettier --write . && TIMING=1 eslint src __tests__ --ext mjs,js,ts --fix",
|
||||
@@ -13,12 +13,12 @@
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/voice/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"typings": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs",
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"directories": {
|
||||
@@ -65,7 +65,7 @@
|
||||
"@discordjs/docgen": "workspace:^",
|
||||
"@favware/cliff-jumper": "^1.8.7",
|
||||
"@microsoft/api-extractor": "^7.29.5",
|
||||
"@types/jest": "^28.1.8",
|
||||
"@types/jest": "^29.0.0",
|
||||
"@types/node": "^16.11.56",
|
||||
"downlevel-dts": "^0.10.1",
|
||||
"eslint": "^8.23.0",
|
||||
@@ -74,10 +74,9 @@
|
||||
"jest-websocket-mock": "^2.4.0",
|
||||
"mock-socket": "^9.1.5",
|
||||
"prettier": "^2.7.1",
|
||||
"rollup-plugin-typescript2": "^0.33.0",
|
||||
"tsup": "^6.2.3",
|
||||
"tweetnacl": "^1.0.3",
|
||||
"typescript": "^4.8.2",
|
||||
"unbuild": "^0.8.9"
|
||||
"typescript": "^4.8.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.9.0"
|
||||
|
||||
3
packages/voice/tsup.config.js
Normal file
3
packages/voice/tsup.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import { createTsupConfig } from '../../tsup.config.js';
|
||||
|
||||
export default createTsupConfig();
|
||||
@@ -40,7 +40,7 @@
|
||||
"homepage": "https://discord.js.org",
|
||||
"dependencies": {
|
||||
"@discordjs/api-extractor-utils": "workspace:^",
|
||||
"@emotion/react": "^11.10.0",
|
||||
"@emotion/react": "^11.10.4",
|
||||
"@emotion/server": "^11.10.0",
|
||||
"@mantine/core": "^5.2.4",
|
||||
"@mantine/hooks": "^5.2.4",
|
||||
@@ -72,9 +72,9 @@
|
||||
"@types/node": "^16.11.56",
|
||||
"@types/react-dom": "^18.0.6",
|
||||
"@types/react-syntax-highlighter": "^15.5.5",
|
||||
"@unocss/cli": "^0.45.13",
|
||||
"@unocss/preset-web-fonts": "^0.45.13",
|
||||
"@unocss/reset": "^0.45.13",
|
||||
"@unocss/cli": "^0.45.14",
|
||||
"@unocss/preset-web-fonts": "^0.45.14",
|
||||
"@unocss/reset": "^0.45.14",
|
||||
"@vitejs/plugin-react": "^2.0.1",
|
||||
"@vitest/coverage-c8": "^0.22.1",
|
||||
"concurrently": "^7.3.0",
|
||||
@@ -83,8 +83,8 @@
|
||||
"happy-dom": "^6.0.4",
|
||||
"prettier": "^2.7.1",
|
||||
"typescript": "^4.8.2",
|
||||
"unocss": "^0.45.13",
|
||||
"vercel": "^28.2.0",
|
||||
"unocss": "^0.45.14",
|
||||
"vercel": "^28.2.2",
|
||||
"vitest": "^0.22.1"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -177,7 +177,7 @@ test('spawn, connect, send a message, session info, and destroy', async () => {
|
||||
|
||||
await manager.connect();
|
||||
expect(mockConstructor).toHaveBeenCalledWith(
|
||||
expect.stringContaining('worker.cjs'),
|
||||
expect.stringContaining('worker.js'),
|
||||
expect.objectContaining({ workerData: expect.objectContaining({ shardIds: [0, 1] }) }),
|
||||
);
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { createUnbuildConfig } from '../../build.config';
|
||||
|
||||
export default createUnbuildConfig({
|
||||
entries: [
|
||||
{ builder: 'rollup', input: 'src/index' },
|
||||
{ builder: 'rollup', input: 'src/strategies/sharding/worker' },
|
||||
],
|
||||
externals: ['zlib-sync'],
|
||||
});
|
||||
@@ -4,7 +4,7 @@
|
||||
"description": "Wrapper around Discord's gateway",
|
||||
"scripts": {
|
||||
"test": "vitest run",
|
||||
"build": "unbuild",
|
||||
"build": "tsup",
|
||||
"lint": "prettier --check . && TIMING=1 eslint src __tests__ --ext mjs,js,ts",
|
||||
"format": "prettier --write . && TIMING=1 eslint src __tests__ --ext mjs,js,ts --fix",
|
||||
"docs": "downlevel-dts dist docs/dist --to=3.7 && docgen -i src/index.ts -c docs/index.json -o docs/docs.json --typescript && api-extractor run --local",
|
||||
@@ -12,12 +12,12 @@
|
||||
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/ws/*'",
|
||||
"release": "cliff-jumper"
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"typings": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs",
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"directories": {
|
||||
@@ -72,9 +72,8 @@
|
||||
"eslint-config-neon": "^0.1.23",
|
||||
"mock-socket": "^9.1.5",
|
||||
"prettier": "^2.7.1",
|
||||
"rollup-plugin-typescript2": "^0.33.0",
|
||||
"tsup": "^6.2.3",
|
||||
"typescript": "^4.8.2",
|
||||
"unbuild": "^0.8.9",
|
||||
"undici": "^5.10.0",
|
||||
"vitest": "^0.22.1",
|
||||
"zlib-sync": "^0.1.7"
|
||||
|
||||
@@ -92,7 +92,7 @@ export class WorkerShardingStrategy implements IShardingStrategy {
|
||||
shardIds: slice,
|
||||
};
|
||||
|
||||
const worker = new Worker(join(__dirname, 'worker.cjs'), { workerData });
|
||||
const worker = new Worker(join(__dirname, 'worker.js'), { workerData });
|
||||
await once(worker, 'online');
|
||||
worker
|
||||
.on('error', (err) => {
|
||||
|
||||
9
packages/ws/tsup.config.js
Normal file
9
packages/ws/tsup.config.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import { createTsupConfig } from '../../tsup.config.js';
|
||||
|
||||
export default createTsupConfig({
|
||||
entry: {
|
||||
index: 'src/index.ts',
|
||||
worker: 'src/strategies/sharding/worker.ts',
|
||||
},
|
||||
external: ['zlib-sync'],
|
||||
});
|
||||
Reference in New Issue
Block a user