From 97efb73eed388eb08742b1c2fb1c8905ec144a70 Mon Sep 17 00:00:00 2001 From: Max Kless Date: Mon, 15 Apr 2024 13:40:54 +0200 Subject: [PATCH] fix(core): ignore .nx changes when checking for uncommitted changes --- .../react/check-for-uncommitted-changes.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/nx/src/command-line/init/implementation/react/check-for-uncommitted-changes.ts b/packages/nx/src/command-line/init/implementation/react/check-for-uncommitted-changes.ts index 7f3bb1c6a81b51..170b146ba2bce1 100644 --- a/packages/nx/src/command-line/init/implementation/react/check-for-uncommitted-changes.ts +++ b/packages/nx/src/command-line/init/implementation/react/check-for-uncommitted-changes.ts @@ -1,12 +1,17 @@ import { execSync } from 'child_process'; export function checkForUncommittedChanges() { - const gitResult = execSync(`git status --porcelain`); - if (gitResult.length > 0) { + const gitResult = execSync('git status --porcelain').toString(); + + const filteredResults = gitResult + .split('\n') + .filter((line) => !line.includes('.nx') && line.trim().length > 0); + + if (filteredResults.length > 0) { console.log('❗️ Careful!'); console.log('You have uncommitted changes in your repository.'); console.log(''); - console.log(gitResult.toString()); + console.log(filteredResults.join('\n').toString()); console.log('Please commit your changes before running the migrator!'); process.exit(1); }