refactor(dev-infra): use the exec() helper from utils/shelljs whenever possible (#37444)

There is an `exec()` helper provided by `utils/shelljs.ts`, which is a
wrapper around ShellJS' `exec()` with some default options (currently
`silent: true`). The intention is to avoid having to pass these options
to every invocation of the `exec()` function.

This commit updates all code inside `dev-infra/` to use this helper
whenever possible).

NOTE: For simplicity, the `utils/shelljs` helper does not support some
      of the less common call signatures of the original `exec()`
      helper, so in some cases we still need to use the original.

PR Close #37444
This commit is contained in:
George Kalpakas
2020-06-05 11:03:32 +03:00
committed by atscott
parent e31208beb1
commit d4c0962c7b
6 changed files with 12 additions and 18 deletions

View File

@ -6,8 +6,8 @@
* found in the LICENSE file at https://angular.io/license
*/
import {exec} from 'shelljs';
import {getRepoBaseDir} from './config';
import {exec} from './shelljs';
/**
* A list of all files currently in the repo which have been modified since the provided sha.
@ -33,8 +33,5 @@ export function allFiles() {
function gitOutputAsArray(cmd: string) {
return exec(cmd, {cwd: getRepoBaseDir(), silent: true})
.split('\n')
.map(x => x.trim())
.filter(x => !!x);
return exec(cmd, {cwd: getRepoBaseDir()}).split('\n').map(x => x.trim()).filter(x => !!x);
}