From 5844f2ea8914616513f26c950c274a7e8f60e487 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Wed, 13 Jul 2022 15:56:49 -0400 Subject: [PATCH] fix: allow project graph loading with angular + nx workspaces --- libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts | 5 +++-- libs/vscode/nx-workspace/src/lib/nx-workspace.ts | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts b/libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts index ed8488a2af..9634995857 100644 --- a/libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts +++ b/libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts @@ -25,7 +25,8 @@ export type NxWorkspaceConfiguration = ProjectsConfigurations & */ export async function getNxWorkspaceConfig( basedir: string, - format: 'nx' | 'angularCli' + format: 'nx' | 'angularCli', + isNxWorkspace: boolean ): Promise<{ workspaceConfiguration: NxWorkspaceConfiguration; configPath: string; @@ -56,7 +57,7 @@ export async function getNxWorkspaceConfig( let projectGraph: ProjectGraph | null = null; try { - if (format === 'angularCli') { + if (!isNxWorkspace) { throw 'No project graph support'; } diff --git a/libs/vscode/nx-workspace/src/lib/nx-workspace.ts b/libs/vscode/nx-workspace/src/lib/nx-workspace.ts index 6a589c5add..71554082fd 100644 --- a/libs/vscode/nx-workspace/src/lib/nx-workspace.ts +++ b/libs/vscode/nx-workspace/src/lib/nx-workspace.ts @@ -1,5 +1,6 @@ import type { NxJsonConfiguration, ProjectsConfigurations } from '@nrwl/devkit'; import { + checkIsNxWorkspace, clearJsonCache, fileExists, getOutputChannel, @@ -85,9 +86,11 @@ async function _workspace(): Promise { const isAngularWorkspace = await fileExists( join(workspacePath, 'angular.json') ); + const isNxWorkspace = await checkIsNxWorkspace(workspacePath); const config = await getNxWorkspaceConfig( workspacePath, - isAngularWorkspace ? 'angularCli' : 'nx' + isAngularWorkspace ? 'angularCli' : 'nx', + isNxWorkspace ); const isLerna = await fileExists(join(workspacePath, 'lerna.json'));