Skip to content

Commit

Permalink
build: tsup for better cjs / esm support
Browse files Browse the repository at this point in the history
  • Loading branch information
iCrawl committed Sep 2, 2022
1 parent b7eb96d commit df46ab8
Show file tree
Hide file tree
Showing 40 changed files with 762 additions and 1,070 deletions.
92 changes: 0 additions & 92 deletions build.config.ts

This file was deleted.

5 changes: 2 additions & 3 deletions package.json
Expand Up @@ -41,13 +41,12 @@
"@commitlint/config-angular": "^17.1.0",
"@favware/cliff-jumper": "^1.8.7",
"@favware/npm-deprecate": "^1.0.5",
"@types/is-ci": "^3.0.0",
"conventional-changelog-cli": "^2.2.2",
"fast-glob": "^3.2.11",
"husky": "^8.0.1",
"is-ci": "^3.0.1",
"lint-staged": "^13.0.3",
"turbo": "^1.4.3",
"tsup": "^6.2.3",
"turbo": "^1.4.4",
"typescript": "^4.8.2"
},
"resolutions": {
Expand Down
11 changes: 0 additions & 11 deletions packages/actions/build.config.ts

This file was deleted.

5 changes: 2 additions & 3 deletions packages/actions/package.json
Expand Up @@ -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"
Expand Down Expand Up @@ -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": {
Expand Down
7 changes: 7 additions & 0 deletions packages/actions/tsup.config.js
@@ -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,
});
10 changes: 5 additions & 5 deletions packages/api-extractor-utils/package.json
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions packages/api-extractor-utils/tsup.config.js
@@ -0,0 +1,5 @@
import { createTsupConfig } from '../../tsup.config.js';

export default createTsupConfig({
minify: true,
});
3 changes: 0 additions & 3 deletions packages/builders/build.config.ts

This file was deleted.

9 changes: 4 additions & 5 deletions packages/builders/package.json
Expand Up @@ -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",
Expand All @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down
3 changes: 3 additions & 0 deletions packages/builders/tsup.config.js
@@ -0,0 +1,3 @@
import { createTsupConfig } from '../../tsup.config.js';

export default createTsupConfig();
3 changes: 0 additions & 3 deletions packages/collection/build.config.ts

This file was deleted.

9 changes: 4 additions & 5 deletions packages/collection/package.json
Expand Up @@ -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",
Expand All @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down
3 changes: 3 additions & 0 deletions packages/collection/tsup.config.js
@@ -0,0 +1,3 @@
import { createTsupConfig } from '../../tsup.config.js';

export default createTsupConfig();
9 changes: 0 additions & 9 deletions packages/docgen/build.config.ts

This file was deleted.

11 changes: 5 additions & 6 deletions packages/docgen/package.json
Expand Up @@ -3,15 +3,15 @@
"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",
"prepack": "yarn format && yarn build",
"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"
},
Expand Down Expand Up @@ -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",
Expand All @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions packages/docgen/tsup.config.js
@@ -0,0 +1,7 @@
import { createTsupConfig } from '../../tsup.config.js';

export default createTsupConfig({
entry: ['src/index.ts', 'src/cli.ts'],
minify: true,
dts: false,
});
2 changes: 1 addition & 1 deletion packages/proxy-container/Dockerfile
Expand Up @@ -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"]
3 changes: 0 additions & 3 deletions packages/proxy-container/build.config.ts

This file was deleted.

9 changes: 4 additions & 5 deletions packages/proxy-container/package.json
Expand Up @@ -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"
},
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions packages/proxy-container/tsup.config.js
@@ -0,0 +1,6 @@
import { createTsupConfig } from '../../tsup.config.js';

export default createTsupConfig({
format: ['esm'],
minify: true,
});
3 changes: 0 additions & 3 deletions packages/proxy/build.config.ts

This file was deleted.

1 comment on commit df46ab8

@vercel
Copy link

@vercel vercel bot commented on df46ab8 Sep 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.