fix(devkit): use Workspace in devkit for backwards compatibility (#18246)

This commit is contained in:
Emily Xiong 2023-07-21 16:54:30 -04:00 committed by GitHub
parent 8407d7aedf
commit 2e6592c533
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 13 deletions

View File

@ -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';

View File

@ -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?$/);
/**

View File

@ -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 {

View File

@ -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,

View File

@ -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,
});

View File

@ -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';

View File

@ -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,