You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Hydro/build/utils.ts

26 lines
705 B
TypeScript

import { SpawnOptions } from 'child_process';
import spawn from 'cross-spawn';
import { globby } from 'globby';
export const cwd = process.cwd();
export function getWorkspaces() {
return globby(require('../package.json').workspaces, {
cwd,
deep: 0,
onlyDirectories: true,
expandDirectories: false,
});
}
export function spawnAsync(command, path) {
const args = command.split(/\s+/);
const options: SpawnOptions = { stdio: 'inherit' };
if (path) options.cwd = path;
const child = spawn(args[0], args.slice(1), options);
return new Promise((resolve, reject) => {
child.on('close', resolve);
child.on('error', reject);
});
}