From 74b89a46292330ba949652680c30b0280249db74 Mon Sep 17 00:00:00 2001 From: dario-piotrowicz Date: Sat, 12 Feb 2022 15:39:14 +0000 Subject: [PATCH] feat(ng-dev/format): add staged files back (#405) change the staged command so that after formatting it also adds formatted files back to the staging area (unless --check is used of course) PR Close #405 --- ng-dev/format/cli.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ng-dev/format/cli.ts b/ng-dev/format/cli.ts index bf8c0bd93..5ec054a3a 100644 --- a/ng-dev/format/cli.ts +++ b/ng-dev/format/cli.ts @@ -51,6 +51,9 @@ export function buildFormatParser(localYargs: yargs.Argv) { const executionCmd = check ? checkFiles : formatFiles; const allStagedFiles = GitClient.get().allStagedFiles(); process.exitCode = await executionCmd(allStagedFiles); + if (!check && process.exitCode === 0) { + GitClient.get().runGraceful(['add', ...allStagedFiles]); + } }, ) .command(