fix(core): load core plugins as part of loading plugins (#18826)
This commit is contained in:
parent
aa9526fe73
commit
cf1175f2ae
@ -1,7 +1,5 @@
|
|||||||
import { basename } from 'node:path';
|
import { basename } from 'node:path';
|
||||||
|
|
||||||
import { getNxPackageJsonWorkspacesPlugin } from '../../../plugins/package-json-workspaces';
|
|
||||||
import { CreateProjectJsonProjectsPlugin } from '../../plugins/project-json/build-nodes/project-json';
|
|
||||||
import { NxJsonConfiguration, TargetDefaults } from '../../config/nx-json';
|
import { NxJsonConfiguration, TargetDefaults } from '../../config/nx-json';
|
||||||
import { ProjectGraphExternalNode } from '../../config/project-graph';
|
import { ProjectGraphExternalNode } from '../../config/project-graph';
|
||||||
import {
|
import {
|
||||||
@ -90,12 +88,6 @@ export function buildProjectsConfigurationsFromProjectPathsAndPlugins(
|
|||||||
const projectRootMap: Map<string, ProjectConfiguration> = new Map();
|
const projectRootMap: Map<string, ProjectConfiguration> = new Map();
|
||||||
const externalNodes: Record<string, ProjectGraphExternalNode> = {};
|
const externalNodes: Record<string, ProjectGraphExternalNode> = {};
|
||||||
|
|
||||||
// We push the nx core node builder onto the end, s.t. it overwrites any user specified behavior
|
|
||||||
plugins.push(
|
|
||||||
getNxPackageJsonWorkspacesPlugin(root),
|
|
||||||
CreateProjectJsonProjectsPlugin
|
|
||||||
);
|
|
||||||
|
|
||||||
// We iterate over plugins first - this ensures that plugins specified first take precedence.
|
// We iterate over plugins first - this ensures that plugins specified first take precedence.
|
||||||
for (const plugin of plugins) {
|
for (const plugin of plugins) {
|
||||||
const [pattern, createNodes] = plugin.createNodes ?? [];
|
const [pattern, createNodes] = plugin.createNodes ?? [];
|
||||||
|
|||||||
@ -16,14 +16,17 @@ import {
|
|||||||
ProjectGraphExternalNode,
|
ProjectGraphExternalNode,
|
||||||
} from '../../config/project-graph';
|
} from '../../config/project-graph';
|
||||||
import type { NxWorkspaceFiles } from '../../native';
|
import type { NxWorkspaceFiles } from '../../native';
|
||||||
import { getGlobPatternsFromPackageManagerWorkspaces } from '../../../plugins/package-json-workspaces';
|
import {
|
||||||
|
getGlobPatternsFromPackageManagerWorkspaces,
|
||||||
|
getNxPackageJsonWorkspacesPlugin,
|
||||||
|
} from '../../../plugins/package-json-workspaces';
|
||||||
import { buildProjectsConfigurationsFromProjectPathsAndPlugins } from './project-configuration-utils';
|
import { buildProjectsConfigurationsFromProjectPathsAndPlugins } from './project-configuration-utils';
|
||||||
import {
|
import {
|
||||||
loadNxPlugins,
|
loadNxPlugins,
|
||||||
loadNxPluginsSync,
|
loadNxPluginsSync,
|
||||||
NxPlugin,
|
|
||||||
NxPluginV2,
|
NxPluginV2,
|
||||||
} from '../../utils/nx-plugin';
|
} from '../../utils/nx-plugin';
|
||||||
|
import { CreateProjectJsonProjectsPlugin } from '../../plugins/project-json/build-nodes/project-json';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
|
* Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
|
||||||
@ -229,12 +232,10 @@ export function retrieveProjectConfigurationsWithoutPluginInference(
|
|||||||
root,
|
root,
|
||||||
projectGlobPatterns,
|
projectGlobPatterns,
|
||||||
(configs: string[]) => {
|
(configs: string[]) => {
|
||||||
const { projects } = createProjectConfigurations(
|
const { projects } = createProjectConfigurations(root, nxJson, configs, [
|
||||||
root,
|
getNxPackageJsonWorkspacesPlugin(root),
|
||||||
nxJson,
|
CreateProjectJsonProjectsPlugin,
|
||||||
configs,
|
]);
|
||||||
[]
|
|
||||||
);
|
|
||||||
return {
|
return {
|
||||||
projectNodes: projects,
|
projectNodes: projects,
|
||||||
externalNodes: {},
|
externalNodes: {},
|
||||||
|
|||||||
@ -41,6 +41,8 @@ import {
|
|||||||
NxAngularJsonPlugin,
|
NxAngularJsonPlugin,
|
||||||
shouldMergeAngularProjects,
|
shouldMergeAngularProjects,
|
||||||
} from '../adapter/angular-json';
|
} from '../adapter/angular-json';
|
||||||
|
import { getNxPackageJsonWorkspacesPlugin } from '../../plugins/package-json-workspaces';
|
||||||
|
import { CreateProjectJsonProjectsPlugin } from '../plugins/project-json/build-nodes/project-json';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Context for {@link CreateNodesFunction}
|
* Context for {@link CreateNodesFunction}
|
||||||
@ -225,6 +227,10 @@ export function loadNxPluginsSync(
|
|||||||
jsPlugin.name = 'nx-js-graph-plugin';
|
jsPlugin.name = 'nx-js-graph-plugin';
|
||||||
result.push(jsPlugin as NxPlugin);
|
result.push(jsPlugin as NxPlugin);
|
||||||
|
|
||||||
|
if (shouldMergeAngularProjects(root, false)) {
|
||||||
|
result.push(NxAngularJsonPlugin);
|
||||||
|
}
|
||||||
|
|
||||||
plugins ??= [];
|
plugins ??= [];
|
||||||
for (const plugin of plugins) {
|
for (const plugin of plugins) {
|
||||||
try {
|
try {
|
||||||
@ -239,6 +245,12 @@ export function loadNxPluginsSync(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We push the nx core node plugins onto the end, s.t. it overwrites any other plugins
|
||||||
|
result.push(
|
||||||
|
getNxPackageJsonWorkspacesPlugin(root),
|
||||||
|
CreateProjectJsonProjectsPlugin
|
||||||
|
);
|
||||||
|
|
||||||
return result.map(ensurePluginIsV2);
|
return result.map(ensurePluginIsV2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,6 +277,12 @@ export async function loadNxPlugins(
|
|||||||
result.push(await loadNxPluginAsync(plugin, paths, root));
|
result.push(await loadNxPluginAsync(plugin, paths, root));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We push the nx core node plugins onto the end, s.t. it overwrites any other plugins
|
||||||
|
result.push(
|
||||||
|
getNxPackageJsonWorkspacesPlugin(root),
|
||||||
|
CreateProjectJsonProjectsPlugin
|
||||||
|
);
|
||||||
|
|
||||||
return result.map(ensurePluginIsV2);
|
return result.map(ensurePluginIsV2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user