Skip to content

Commit

Permalink
chore: watch-mode improvements, storybookjs/addon-kit#49
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Jan 7, 2024
1 parent 18e78b9 commit 8db5c7b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 20 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"@storybook/react-vite": "^7.4.0",
"@storybook/theming": "^7.4.2",
"@storybook/types": "^7.4.2",
"@types/node": "^20.10.6",
"@types/react": "^18.2.21",
"@vitejs/plugin-react": "^4.0.4",
"boxen": "^5.0.1",
Expand Down
53 changes: 33 additions & 20 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from 'tsup';
import { exec } from 'node:child_process';

export default defineConfig((options) => ({
entry: ['src/index.ts', 'src/preview.ts', 'src/manager.ts'],
Expand All @@ -15,4 +16,16 @@ export default defineConfig((options) => ({
esbuildOptions(options) {
options.conditions = ['module'];
},
async onSuccess() {
if (!options.watch) return;

const subprocess = exec('pnpm run storybook --no-open');
subprocess.stdout?.on('data', (data) =>
console.log(`[storybook]: ${data}`)
);

return function cleanup() {
subprocess.kill();
};
},
}));

0 comments on commit 8db5c7b

Please sign in to comment.