@samitouri / QOS-React / commits / 0e9aa2e9a9

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

Paul O’Shannessy committed Jul 21, 2016 at 15:57 UTC 0e9aa2e9a9cda4ca2148981721f83e3a9fd4ef34
1 file changed +9
scripts/release-manager/cli.js
+9
@@ -19,6 +19,9 @@ const vorpal = new Vorpal();
19 // TODO: Make this an argument to the script
20 const PATH_TO_REPO = path.resolve('../../../react');
21
22 +// Quick dry run opt-in. This allows quick debugging of execInRepo without
23 +// actually running the command, ensuring no accidental publishing.
24 +const DRY_RUN = false;
25
26
27 // HELPERS
@@ -33,6 +36,12 @@ function writeTo(file, data) {
36
37 // Wrapper around exec so we don't have to worry about paths
38 function execInRepo(command) {
39 + vorpal.log(chalk.gray(`Executing ${chalk.underline(command)}`));
40 +
41 + if (DRY_RUN) {
42 + return '';
43 + }
44 +
45 return execSync(command, {
46 cwd: PATH_TO_REPO,
47 encoding: 'utf8',