UNPKG

yeoman-generator

Version:

Rails-inspired generator system that provides scaffolding for your apps

50 lines (49 loc) 1.79 kB
import { execa, execaCommand, execaCommandSync, execaSync, } from 'execa'; export class SpawnCommandMixin { /** * Normalize a command across OS and spawn it (asynchronously). * * @param command program to execute * @param opt execa options options * @see https://github.com/sindresorhus/execa#execacommandcommand-options */ spawnCommand(command, opt) { opt = { cwd: this.destinationRoot(), ...opt }; return execaCommand(command, opt); } /** * Normalize a command across OS and spawn it (asynchronously). * * @param command program to execute * @param args list of arguments to pass to the program * @param opt execa options options * @see https://github.com/sindresorhus/execa#execafile-arguments-options */ spawn(command, args, opt) { opt = { cwd: this.destinationRoot(), ...opt }; return execa(command, args, opt); } /** * Normalize a command across OS and spawn it (synchronously). * * @param command program to execute * @param opt execa options options * @see https://github.com/sindresorhus/execa#execacommandsynccommand-options */ spawnCommandSync(command, opt) { opt = { cwd: this.destinationRoot(), ...opt }; return execaCommandSync(command, opt); } /** * Normalize a command across OS and spawn it (synchronously). * * @param command program to execute * @param args list of arguments to pass to the program * @param opt execa options options * @see https://github.com/sindresorhus/execa#execafile-arguments-options */ spawnSync(command, args, opt) { opt = { cwd: this.destinationRoot(), ...opt }; return execaSync(command, args, opt); } }