diff --git a/packages/nx/src/project-graph/build-dependencies/index.ts b/packages/nx/src/project-graph/build-dependencies/index.ts deleted file mode 100644 index cf80df0c0ce8e..0000000000000 --- a/packages/nx/src/project-graph/build-dependencies/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './implicit-project-dependencies'; diff --git a/packages/nx/src/project-graph/build-project-graph.ts b/packages/nx/src/project-graph/build-project-graph.ts index a6657d5c4adf4..d33db7ad05398 100644 --- a/packages/nx/src/project-graph/build-project-graph.ts +++ b/packages/nx/src/project-graph/build-project-graph.ts @@ -10,7 +10,7 @@ import { shouldRecomputeWholeGraph, writeCache, } from './nx-deps-cache'; -import { buildImplicitProjectDependencies } from './build-dependencies'; +import { applyImplicitDependencies } from './utils/implicit-project-dependencies'; import { normalizeProjectNodes } from './utils/normalize-project-nodes'; import { isNxPluginV1, isNxPluginV2, loadNxPlugins } from '../utils/nx-plugin'; import { getRootTsConfigPath } from '../plugins/js/utils/typescript'; @@ -167,7 +167,7 @@ async function buildProjectGraphUsingContext( } } - buildImplicitProjectDependencies(ctx, updatedBuilder); + applyImplicitDependencies(ctx.projectsConfigurations, updatedBuilder); const finalGraph = updatedBuilder.getUpdatedProjectGraph(); diff --git a/packages/nx/src/project-graph/build-dependencies/implict-project-dependencies.spec.ts b/packages/nx/src/project-graph/utils/implicit-project-dependencies.spec.ts similarity index 58% rename from packages/nx/src/project-graph/build-dependencies/implict-project-dependencies.spec.ts rename to packages/nx/src/project-graph/utils/implicit-project-dependencies.spec.ts index 1b2dd62b992b7..baafea5b774e0 100644 --- a/packages/nx/src/project-graph/build-dependencies/implict-project-dependencies.spec.ts +++ b/packages/nx/src/project-graph/utils/implicit-project-dependencies.spec.ts @@ -1,6 +1,5 @@ -import { ProjectGraphProcessorContext } from '../../config/project-graph'; import { ProjectGraphBuilder } from '../project-graph-builder'; -import { buildImplicitProjectDependencies } from './implicit-project-dependencies'; +import { applyImplicitDependencies } from './implicit-project-dependencies'; jest.mock('fs', () => { const memFs = require('memfs').fs; @@ -13,7 +12,7 @@ jest.mock('nx/src/utils/workspace-root', () => ({ workspaceRoot: '/root', })); -describe('explicit project dependencies', () => { +describe('implicit project dependencies', () => { it(`should add implicit deps`, () => { const builder = new ProjectGraphBuilder(); builder.addNode({ @@ -25,17 +24,13 @@ describe('explicit project dependencies', () => { data: {}, } as any); - buildImplicitProjectDependencies( + applyImplicitDependencies( { - filesToProcess: {}, - fileMap: {}, - projectsConfigurations: { - version: 2, - projects: { - proj1: { root: '', implicitDependencies: ['proj2'] }, - }, + version: 2, + projects: { + proj1: { root: '', implicitDependencies: ['proj2'] }, }, - } as Partial as ProjectGraphProcessorContext, + }, builder ); @@ -60,17 +55,13 @@ describe('explicit project dependencies', () => { } as any); builder.addImplicitDependency('proj1', 'proj2'); - buildImplicitProjectDependencies( + applyImplicitDependencies( { - filesToProcess: {}, - fileMap: {}, - projectsConfigurations: { - version: 2, - projects: { - proj1: { root: '', implicitDependencies: ['!proj2'] }, - }, + version: 2, + projects: { + proj1: { root: '', implicitDependencies: ['!proj2'] }, }, - } as Partial as ProjectGraphProcessorContext, + }, builder ); diff --git a/packages/nx/src/project-graph/build-dependencies/implicit-project-dependencies.ts b/packages/nx/src/project-graph/utils/implicit-project-dependencies.ts similarity index 58% rename from packages/nx/src/project-graph/build-dependencies/implicit-project-dependencies.ts rename to packages/nx/src/project-graph/utils/implicit-project-dependencies.ts index 371189c68f4e0..53d3e131ea7d5 100644 --- a/packages/nx/src/project-graph/build-dependencies/implicit-project-dependencies.ts +++ b/packages/nx/src/project-graph/utils/implicit-project-dependencies.ts @@ -1,12 +1,12 @@ -import { ProjectGraphProcessorContext } from '../../config/project-graph'; +import { ProjectsConfigurations } from '../../config/workspace-json-project-json'; import { ProjectGraphBuilder } from '../project-graph-builder'; -export function buildImplicitProjectDependencies( - ctx: ProjectGraphProcessorContext, +export function applyImplicitDependencies( + projectsConfigurations: ProjectsConfigurations, builder: ProjectGraphBuilder ) { - Object.keys(ctx.projectsConfigurations.projects).forEach((source) => { - const p = ctx.projectsConfigurations.projects[source]; + Object.keys(projectsConfigurations.projects).forEach((source) => { + const p = projectsConfigurations.projects[source]; if (p.implicitDependencies && p.implicitDependencies.length > 0) { p.implicitDependencies.forEach((target) => { if (target.startsWith('!')) {