Skip to content

Commit

Permalink
build: use esbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed Nov 8, 2024
1 parent f8106c1 commit 1429cfb
Show file tree
Hide file tree
Showing 9 changed files with 290 additions and 24 deletions.
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default tseslint.config(
},
json.configs.recommended,
{
files: ['**/tsconfig.json'],
files: ['**/tsconfig.json', '**/tsconfig.*.json'],
rules: {
'json/*': ['error', { allowComments: true }],
},
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"scripts": {
"build": "run-s clean compile",
"clean": "rimraf dist/",
"compile": "ncc build -o dist --target es2021",
"compile": "node tools/compile.js",
"lint": "run-s lint-es prettier",
"lint-es": "eslint .",
"lint-es:file": "eslint",
Expand Down Expand Up @@ -46,8 +46,8 @@
"@tsconfig/strictest": "2.0.5",
"@types/eslint-config-prettier": "6.11.3",
"@types/node": "20.17.5",
"@vercel/ncc": "0.38.2",
"conventional-changelog-conventionalcommits": "8.0.0",
"esbuild": "0.24.0",
"eslint": "9.13.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-json": "4.0.1",
Expand All @@ -59,7 +59,6 @@
"prettier-plugin-packagejson": "2.5.3",
"rimraf": "6.0.1",
"semantic-release": "24.2.0",
"ts-node": "10.9.2",
"typescript": "5.6.3",
"typescript-eslint": "8.13.0"
},
Expand Down
260 changes: 251 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/tsconfig.json

This file was deleted.

14 changes: 14 additions & 0 deletions tools/compile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { build } from 'esbuild';
import { env } from 'node:process';

await build({
entryPoints: ['./src/index.ts'],
bundle: true,
platform: 'node',
target: 'node20',
minify: !!env['CI'],
tsconfig: 'tsconfig.dist.json',
sourcemap: true,
// format: 'esm', // TODO: later PR
outdir: './dist/',
});
3 changes: 3 additions & 0 deletions tools/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
11 changes: 11 additions & 0 deletions tools/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": [
"@tsconfig/strictest/tsconfig.json",
"@tsconfig/node20/tsconfig.json"
],
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"noEmit": true
}
}
7 changes: 7 additions & 0 deletions tsconfig.dist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"types": ["node"]
},
"files": ["./src/index.ts"]
}
Loading

0 comments on commit 1429cfb

Please sign in to comment.