fix(devkit): use Workspace in devkit for backwards compatibility (#18246)
This commit is contained in:
parent
8407d7aedf
commit
2e6592c533
@ -6,7 +6,7 @@ import {
|
||||
import type { DependentBuildableProjectNode } from '@nx/js/src/utils/buildable-libs-utils';
|
||||
import { WebpackNxBuildCoordinationPlugin } from '@nx/webpack/src/plugins/webpack-nx-build-coordination-plugin';
|
||||
import { existsSync } from 'fs';
|
||||
import { readNxJson } from 'nx/src/config/nx-json';
|
||||
import { readNxJson } from 'nx/src/config/configuration';
|
||||
import { isNpmProject } from 'nx/src/project-graph/operators';
|
||||
import { getDependencyConfigs } from 'nx/src/tasks-runner/utils';
|
||||
import { from, Observable } from 'rxjs';
|
||||
|
||||
@ -13,7 +13,7 @@ import {
|
||||
findProjectForPath,
|
||||
} from 'nx/src/project-graph/utils/find-project-for-path';
|
||||
import { readProjectsConfigurationFromProjectGraph } from 'nx/src/project-graph/project-graph';
|
||||
import { readNxJson } from 'nx/src/config/nx-json';
|
||||
import { readNxJson } from 'nx/src/config/configuration';
|
||||
|
||||
export const CY_FILE_MATCHER = new RegExp(/\.cy\.[tj]sx?$/);
|
||||
/**
|
||||
|
||||
@ -13,7 +13,7 @@ import {
|
||||
Tree,
|
||||
workspaceRoot,
|
||||
} from '@nx/devkit';
|
||||
import { readNxJson } from 'nx/src/config/nx-json';
|
||||
import { readNxJson } from 'nx/src/config/configuration';
|
||||
import { readProjectsConfigurationFromProjectGraph } from 'nx/src/project-graph/project-graph';
|
||||
|
||||
interface FindTargetOptions {
|
||||
|
||||
@ -22,11 +22,10 @@ export function readTargetOptions<T = any>(
|
||||
|
||||
const ws = new Workspaces(context.root);
|
||||
const [nodeModule, executorName] = targetConfiguration.executor.split(':');
|
||||
const { schema } = getExecutorInformation(
|
||||
nodeModule,
|
||||
executorName,
|
||||
context.root
|
||||
);
|
||||
const { schema } = getExecutorInformation
|
||||
? getExecutorInformation(nodeModule, executorName, context.root)
|
||||
: // TODO(v18): remove readExecutor. This is to be backwards compatible with Nx 16.5 and below.
|
||||
(ws as any).readExecutor(nodeModule, executorName);
|
||||
|
||||
const defaultProject = ws.calculateDefaultProjectName(
|
||||
context.cwd,
|
||||
|
||||
@ -13,9 +13,10 @@ const { Workspaces, readNxJsonFromDisk } = requireNx();
|
||||
export function convertNxExecutor(executor: Executor) {
|
||||
const builderFunction = (options, builderContext) => {
|
||||
const workspaces = new Workspaces(builderContext.workspaceRoot);
|
||||
const nxJsonConfiguration = readNxJsonFromDisk(
|
||||
builderContext.workspaceRoot
|
||||
);
|
||||
const nxJsonConfiguration = readNxJsonFromDisk
|
||||
? readNxJsonFromDisk(builderContext.workspaceRoot)
|
||||
: // TODO(v18): remove readNxJson. This is to be backwards compatible with Nx 16.5 and below.
|
||||
(workspaces as any).readNxJson();
|
||||
const projectsConfigurations = workspaces.readProjectsConfigurations({
|
||||
_includeProjectsFromAngularJson: true,
|
||||
});
|
||||
|
||||
@ -9,7 +9,7 @@ import {
|
||||
createProjectRootMappings,
|
||||
ProjectRootMappings,
|
||||
} from 'nx/src/project-graph/utils/find-project-for-path';
|
||||
import { readNxJson } from 'nx/src/config/nx-json';
|
||||
import { readNxJson } from 'nx/src/config/configuration';
|
||||
import { TargetProjectLocator } from '@nx/js/src/internal';
|
||||
import { readProjectFileMapCache } from 'nx/src/project-graph/nx-deps-cache';
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { join } from 'path';
|
||||
import { readNxJson } from 'nx/src/config/nx-json';
|
||||
import { readNxJson } from 'nx/src/config/configuration';
|
||||
import {
|
||||
getTargetInputs,
|
||||
filterUsingGlobPatterns,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user