build: tsup for better cjs / esm support

This commit is contained in:
iCrawl
2022-09-02 18:08:16 +02:00
parent b7eb96d456
commit df46ab8061
40 changed files with 759 additions and 1067 deletions

View File

@@ -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"]

View File

@@ -1,3 +0,0 @@
import { createUnbuildConfig } from '../../build.config';
export default createUnbuildConfig({ emitCJS: false, cjsBridge: false });

View File

@@ -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"

View File

@@ -0,0 +1,6 @@
import { createTsupConfig } from '../../tsup.config.js';
export default createTsupConfig({
format: ['esm'],
minify: true,
});