yeoman-generator
Version:
Rails-inspired generator system that provides scaffolding for your apps
38 lines (37 loc) • 1.12 kB
JavaScript
import { execa, execaSync, execaCommand, execaCommandSync, } from 'execa';
export class SpawnCommandMixin {
spawnCommand(command, args, opt) {
if (Array.isArray(args) || (opt && args === undefined)) {
return this.spawn(command, args, opt);
}
return execaCommand(command, {
stdio: 'inherit',
cwd: this.destinationRoot(),
...args,
});
}
spawn(command, args, opt) {
return execa(command, args, {
stdio: 'inherit',
cwd: this.destinationRoot(),
...opt,
});
}
spawnCommandSync(command, args, opt) {
if (Array.isArray(args) || (opt && args === undefined)) {
return this.spawnSync(command, args, opt);
}
return execaCommandSync(command, {
stdio: 'inherit',
cwd: this.destinationRoot(),
...args,
});
}
spawnSync(command, args, opt) {
return execaSync(command, args, {
stdio: 'inherit',
cwd: this.destinationRoot(),
...opt,
});
}
}