1
0
mirror of https://github.com/storybookjs/storybook.git synced 2025-03-26 05:02:32 +08:00

21 lines
684 B
TypeScript
Raw Normal View History

2022-08-12 15:06:36 +10:00
import { AbortController } from 'node-abort-controller';
import path from 'path';
import { exec } from './exec';
const codeDir = path.resolve(__dirname, '../../code');
export async function servePackages({ dryRun, debug }: { dryRun?: boolean; debug?: boolean }) {
const controller = new AbortController();
exec(
'CI=true yarn local-registry --open',
{ cwd: codeDir },
{ dryRun, debug, signal: controller.signal as AbortSignal }
).catch((err) => {
// If aborted, we want to make sure the rejection is handled.
if (!err.killed) throw err;
});
await exec('yarn wait-on http://localhost:6001', { cwd: codeDir }, { dryRun, debug });
2022-08-12 15:06:36 +10:00
return controller;
}