[rrm] Add logging to execInRepo, dry-run option

This commit is contained in:
Paul O’Shannessy
2017-01-06 13:47:16 +00:00
committed by Dan Abramov
parent a9035c1e4e
commit a68ca21469
+9
View File
@@ -19,6 +19,9 @@ const vorpal = new Vorpal();
// TODO: Make this an argument to the script
const PATH_TO_REPO = path.resolve('../../../react');
// Quick dry run opt-in. This allows quick debugging of execInRepo without
// actually running the command, ensuring no accidental publishing.
const DRY_RUN = false;
// HELPERS
@@ -33,6 +36,12 @@ function writeTo(file, data) {
// Wrapper around exec so we don't have to worry about paths
function execInRepo(command) {
vorpal.log(chalk.gray(`Executing ${chalk.underline(command)}`));
if (DRY_RUN) {
return '';
}
return execSync(command, {
cwd: PATH_TO_REPO,
encoding: 'utf8',