feat(dev-infra): Add support for formatting all staged files (#38402)
Adds an ng-dev formatter option to format all of the staged files. This will can be used to format only the staged files during the pre-commit hook. PR Close #38402
This commit is contained in:

committed by
Andrew Kushnir

parent
a6292faa97
commit
28534d83ee
@ -27,6 +27,18 @@ export function allChangedFilesSince(sha = 'HEAD') {
|
||||
return Array.from(new Set([...diffFiles, ...untrackedFiles]));
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of all staged files which have been modified.
|
||||
*
|
||||
* Only added, created and modified files are listed as others (deleted, renamed, etc) aren't
|
||||
* changed or available as content to act upon.
|
||||
*/
|
||||
export function allStagedFiles() {
|
||||
return gitOutputAsArray(`git diff --staged --name-only --diff-filter=ACM`);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function allFiles() {
|
||||
return gitOutputAsArray(`git ls-files`);
|
||||
}
|
||||
|
Reference in New Issue
Block a user