storybook/scripts/utils/list-packages.ts

17 lines
417 B
TypeScript
Raw Normal View History

2020-05-09 11:34:50 +02:00
import { exec } from 'child_process';
2020-05-18 14:58:55 +02:00
export const listOfPackages = (): Promise<
{ name: string; version: string; private: boolean; location: string }[]
> =>
2020-05-09 11:34:50 +02:00
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);
}
});
});