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 bda37f0 commit 1b60ef5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 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
20 changes: 4 additions & 16 deletions packages/nx/src/project-graph/project-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import { stripIndents } from '../utils/strip-indents';
import { workspaceRoot } from '../utils/workspace-root';
import {
CreateDependenciesError,
ProcessDependenciesError,
ProcessProjectGraphError,
buildProjectGraphUsingProjectFileMap,
} from './build-project-graph';
import {
Expand All @@ -23,24 +21,14 @@ import {
writeCache,
} from './nx-deps-cache';

import { ProjectConfigurationsError } from './error-types';
import { loadNxPlugins } from './plugins/internal-api';
import { ProjectGraphError } from './project-graph-error';
import { ConfigurationResult } from './utils/project-configuration-utils';
import {
retrieveProjectConfigurations,
retrieveWorkspaceFiles,
} from './utils/retrieve-workspace-files';
import {
ConfigurationResult,
ConfigurationSourceMaps,
} from './utils/project-configuration-utils';
import {
CreateNodesError,
MergeNodesError,
ProjectConfigurationsError,
ProjectsWithNoNameError,
ProjectsWithConflictingNamesError,
} from './error-types';
import { DaemonProjectGraphError } from '../daemon/daemon-project-graph-error';
import { loadNxPlugins, LoadedNxPlugin } from './plugins/internal-api';
import { ProjectGraphError } from './project-graph-error';

/**
* Synchronously reads the latest cached copy of the workspace's ProjectGraph.
Expand Down

0 comments on commit 1b60ef5

Please sign in to comment.