Skip to content

Commit

Permalink
fix(devkit): use Workspace in devkit for backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongemi committed Jul 21, 2023
1 parent 8407d7a commit 4484e56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 4 additions & 5 deletions packages/devkit/src/executors/read-target-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 4 additions & 3 deletions packages/devkit/src/utils/convert-nx-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down

0 comments on commit 4484e56

Please sign in to comment.