mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-20 05:02:37 +08:00
22 lines
456 B
TypeScript
22 lines
456 B
TypeScript
import { exec } from 'child_process';
|
|
|
|
export interface Package {
|
|
name: string;
|
|
version: string;
|
|
private: boolean;
|
|
location: string;
|
|
}
|
|
|
|
export const listOfPackages = (): Promise<Package[]> =>
|
|
new Promise((res, rej) => {
|
|
const command = `npx lerna list --json`;
|
|
exec(command, (e, result) => {
|
|
if (e) {
|
|
rej(e);
|
|
} else {
|
|
const data = JSON.parse(result.toString().trim());
|
|
res(data);
|
|
}
|
|
});
|
|
});
|