Skip to content

Commit 4eb139c

Browse files
authored
fix: bundle build for container (#8)
1 parent 3fc1aff commit 4eb139c

File tree

4 files changed

+274
-11
lines changed

4 files changed

+274
-11
lines changed

contrib/build.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/** eslint-env node */
2+
import esbuild from 'esbuild';
3+
import path from 'path';
4+
5+
esbuild
6+
.build({
7+
entryPoints: [path.join(__dirname, '..', 'src', 'index.ts')],
8+
outfile: path.join(__dirname, '..', 'dist', 'index.js'),
9+
platform: 'node',
10+
bundle: true,
11+
minify: process.env.node_env === 'production',
12+
external: [],
13+
sourcemap: true,
14+
tsconfig: path.join(__dirname, '..', 'tsconfig.json'),
15+
})
16+
.catch(() => {
17+
process.exit(1);
18+
});

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
"oauth-mock-server": "./dist/index.js"
2222
},
2323
"scripts": {
24-
"build": "tsup src/index.ts --dts --format cjs,esm",
24+
"build": "tsx contrib/build.ts",
2525
"clean": "rm -rf dist/ node_modules/",
2626
"lint": "eslint --max-warnings 0 .",
2727
"lint:format": "prettier --check .",
28-
"start": "pnpm run build --watch",
28+
"start": "pnpm tsup src/index.ts --dts --format cjs,esm --watch",
2929
"test": "vitest run --coverage",
3030
"test:watch": "vitest",
3131
"typecheck": "tsc --noEmit",
@@ -43,6 +43,7 @@
4343
"@geprog/semantic-release-config": "1.0.0",
4444
"@types/jsonwebtoken": "8.5.8",
4545
"c8": "7.11.3",
46+
"esbuild": "0.15.7",
4647
"eslint": "8.8.0",
4748
"prettier": "2.5.1",
4849
"semantic-release": "19.0.2",

0 commit comments

Comments
 (0)