Skip to content

Commit

Permalink
fix: allow project graph loading with angular + nx workspaces (#1306)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cammisuli authored Jul 13, 2022
1 parent 8b7149b commit d89ff6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions libs/vscode/nx-workspace/src/lib/get-nx-workspace-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -56,7 +57,7 @@ export async function getNxWorkspaceConfig(

let projectGraph: ProjectGraph | null = null;
try {
if (format === 'angularCli') {
if (!isNxWorkspace) {
throw 'No project graph support';
}

Expand Down
5 changes: 4 additions & 1 deletion libs/vscode/nx-workspace/src/lib/nx-workspace.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { NxJsonConfiguration, ProjectsConfigurations } from '@nrwl/devkit';
import {
checkIsNxWorkspace,
clearJsonCache,
fileExists,
getOutputChannel,
Expand Down Expand Up @@ -85,9 +86,11 @@ async function _workspace(): Promise<NxWorkspace> {
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'));
Expand Down

0 comments on commit d89ff6d

Please sign in to comment.