Skip to content

Commit

Permalink
fix(core): ignore .nx changes when checking for uncommitted changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKless committed Apr 16, 2024
1 parent efeb963 commit dedb502
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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);
}
Expand Down
7 changes: 2 additions & 5 deletions packages/nx/src/project-graph/project-graph-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ import {
ProcessDependenciesError,
ProcessProjectGraphError,
} from './build-project-graph';
import {
ConfigurationSourceMaps,
CreateNodesError,
MergeNodesError,
} from './utils/project-configuration-utils';
import { CreateNodesError, MergeNodesError } from './error-types';
import { ConfigurationSourceMaps } from './utils/project-configuration-utils';

export class ProjectGraphError extends Error {
readonly #errors: Array<
Expand Down

0 comments on commit dedb502

Please sign in to comment.