Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow project graph loading with angular + nx workspaces #1306

Merged
merged 1 commit into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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