Skip to content

Commit 3f7fa9d

Browse files
Add scripts for building
1 parent c89565d commit 3f7fa9d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
88
"prebuild": "del /q dist",
9-
"build": "esbuild 'src/index.ts' --banner:js='/* global handler */' --bundle --minify --sourcemap --platform=node --target=es2020 --outfile=dist/index.js && esbuild 'src/**/*.ts' --bundle --minify --sourcemap --platform=node --target=es2020 --outdir=dist",
10-
"postbuild": "cd dist && 7z a -tzip index.zip *"
9+
"create-package": "node -e \"require('fs').writeFileSync('temp/package.json', JSON.stringify({ name: 'temp', version: '1.0.0', dependencies: {} }))\"",
10+
"build:index": "esbuild src/index.ts --banner:js=\"/* global handler */\" --bundle --minify --sourcemap --platform=node --target=es2020 --outdir=dist",
11+
"build:src": "esbuild \"src/**/*.ts\" --bundle --minify --sourcemap --platform=node --target=es2020 --outdir=dist",
12+
"build:dependencies": "mkdir temp && node -e \"const fs = require('fs'); const pkg = require('./package.json'); fs.writeFileSync('temp/package.json', JSON.stringify({ name: 'temp', version: '1.0.0', dependencies: pkg.dependencies }, null, 2));\" && cd temp && npm install --omit=dev",
13+
"build": "npm run build:index && npm run build:src && npm run build:dependencies",
14+
"postbuild": "cd dist && 7z a -tzip index.zip * && cd ../temp && 7z a -tzip ../dist/dependencies-layer.zip node_modules/* && cd .. && rmdir /s /q temp"
1115
},
1216
"repository": {
1317
"type": "git",
@@ -38,7 +42,6 @@
3842
"@types/aws-lambda": "^8.10.145",
3943
"@types/node": "^22.7.4",
4044
"@types/uuid": "^10.0.0",
41-
"esbuild": "^0.24.0",
4245
"typescript": "^5.6.2"
4346
},
4447
"dependencies": {

0 commit comments

Comments
 (0)