node-ff
Version:
A CLI for creating NodeJs projects
22 lines (16 loc) • 508 B
text/typescript
import { execSync } from 'child_process';
import { IExecSync, IExecDTO } from './interface';
class ExecSync implements IExecSync {
exec({ commands }: IExecDTO): void {
if (typeof commands === 'object') {
this.execObj({ commands });
} else {
execSync(commands);
}
}
private execObj({ commands }: IExecDTO): void {
const commandsArray = commands as Array<string>;
commandsArray.forEach((element) => execSync(element));
}
}
export { ExecSync };