terminate `storybook` on `SIGINT` (#375)
This commit is contained in:
parent
e586de1890
commit
f652512454
|
@ -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"
|
||||||
},
|
},
|
||||||
|
|
|
@ -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')
|
||||||
|
})
|
Loading…
Reference in New Issue