terminate `storybook` on `SIGINT` (#375)

This commit is contained in:
Felicio Mununga 2023-04-11 20:53:24 +02:00 committed by GitHub
parent e586de1890
commit f652512454
No known key found for this signature in database
GPG Key ID: 0EB8D75C775AB6F1
2 changed files with 19 additions and 1 deletions

View File

@ -21,7 +21,8 @@
"build:types": "tsc --noEmit false --emitDeclarationOnly || true", "build:types": "tsc --noEmit false --emitDeclarationOnly || true",
"lint": "eslint src", "lint": "eslint src",
"typecheck": "tsc", "typecheck": "tsc",
"storybook": "TAMAGUI_TARGET='web' storybook dev -p 3001", "storybook": "node ./scripts/storybook.js",
"storybook:dev": "TAMAGUI_TARGET='web' storybook dev -p 3001",
"storybook:build": "TAMAGUI_TARGET='web' storybook build", "storybook:build": "TAMAGUI_TARGET='web' storybook build",
"clean": "rimraf node_modules dist .turbo storybook-static" "clean": "rimraf node_modules dist .turbo storybook-static"
}, },

View File

@ -0,0 +1,17 @@
#!/usr/bin/node
// todo: remove after adding `"type": "module",` to `package.json`
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable @typescript-eslint/no-var-requires */
const child_process = require('node:child_process')
const process = require('node:process')
const subprocess = child_process.spawn('yarn', ['storybook:dev'], {
detached: true,
stdio: 'inherit',
})
process.once('SIGINT', () => {
process.kill(-subprocess.pid, 'SIGKILL')
})