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 { getNxPackageJsonWorkspacesPlugin } from '../../../plugins/package-json-workspaces';
|
||||
import { CreateProjectJsonProjectsPlugin } from '../../plugins/project-json/build-nodes/project-json';
|
||||
import { NxJsonConfiguration, TargetDefaults } from '../../config/nx-json';
|
||||
import { ProjectGraphExternalNode } from '../../config/project-graph';
|
||||
import {
|
||||
@ -90,12 +88,6 @@ export function buildProjectsConfigurationsFromProjectPathsAndPlugins(
|
||||
const projectRootMap: Map<string, ProjectConfiguration> = new Map();
|
||||
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.
|
||||
for (const plugin of plugins) {
|
||||
const [pattern, createNodes] = plugin.createNodes ?? [];
|
||||
|
||||
@ -16,14 +16,17 @@ import {
|
||||
ProjectGraphExternalNode,
|
||||
} from '../../config/project-graph';
|
||||
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 {
|
||||
loadNxPlugins,
|
||||
loadNxPluginsSync,
|
||||
NxPlugin,
|
||||
NxPluginV2,
|
||||
} 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`
|
||||
@ -229,12 +232,10 @@ export function retrieveProjectConfigurationsWithoutPluginInference(
|
||||
root,
|
||||
projectGlobPatterns,
|
||||
(configs: string[]) => {
|
||||
const { projects } = createProjectConfigurations(
|
||||
root,
|
||||
nxJson,
|
||||
configs,
|
||||
[]
|
||||
);
|
||||
const { projects } = createProjectConfigurations(root, nxJson, configs, [
|
||||
getNxPackageJsonWorkspacesPlugin(root),
|
||||
CreateProjectJsonProjectsPlugin,
|
||||
]);
|
||||
return {
|
||||
projectNodes: projects,
|
||||
externalNodes: {},
|
||||
|
||||
@ -41,6 +41,8 @@ import {
|
||||
NxAngularJsonPlugin,
|
||||
shouldMergeAngularProjects,
|
||||
} 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}
|
||||
@ -225,6 +227,10 @@ export function loadNxPluginsSync(
|
||||
jsPlugin.name = 'nx-js-graph-plugin';
|
||||
result.push(jsPlugin as NxPlugin);
|
||||
|
||||
if (shouldMergeAngularProjects(root, false)) {
|
||||
result.push(NxAngularJsonPlugin);
|
||||
}
|
||||
|
||||
plugins ??= [];
|
||||
for (const plugin of plugins) {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -265,6 +277,12 @@ export async function loadNxPlugins(
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user