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