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

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

View File

@ -21,7 +21,8 @@
"build:types": "tsc --noEmit false --emitDeclarationOnly || true",
"lint": "eslint src",
"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",
"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')
})