diff --git a/frontend/add-sigint.sh b/frontend/add-sigint.sh new file mode 100755 index 0000000..0ba4eea --- /dev/null +++ b/frontend/add-sigint.sh @@ -0,0 +1,8 @@ +#!/usr/bin/bash + +echo "function shutdownGracefully() { + process.exit(0); +} + +process.on('SIGINT', shutdownGracefully); +process.on('SIGTERM', shutdownGracefully);" >> ./build/index.js diff --git a/frontend/package.json b/frontend/package.json index f0327bf..7c74348 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -4,7 +4,8 @@ "private": true, "scripts": { "dev": "vite dev", - "build": "vite build", + "build": "vite build && yarn add-sigint", + "add-sigint": "./add-sigint.sh", "preview": "vite preview", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",