Skip to content

Commit

Permalink
fix: import nx from the correct location when cwd is different than t…
Browse files Browse the repository at this point in the history
…he workspace root (#2109)
  • Loading branch information
leosvelperez authored Apr 29, 2024
1 parent 92e7763 commit 744c8be
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ async function executeInitGenerator(dependency: string, workspacePath: string) {
cwd: workspacePath,
displayCommand: command,
encapsulatedNx: false,
workspacePath,
})
);
tasks.executeTask(task);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export class NxCommandsTreeProvider extends AbstractTreeProvider<NxCommandsTreeI
cwd: workspacePath,
displayCommand: prefixedCommand,
encapsulatedNx: isEncapsulatedNx,
workspacePath,
})
);
tasks.executeTask(task);
Expand Down
1 change: 1 addition & 0 deletions libs/vscode/tasks/src/lib/cli-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class CliTask extends Task {
? join(workspacePath, definition.cwd)
: workspacePath,
encapsulatedNx: isEncapsulatedNx,
workspacePath,
},
packageManagerCommands
)
Expand Down
1 change: 1 addition & 0 deletions libs/vscode/tasks/src/lib/nx-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class NxTask extends Task {
displayCommand,
cwd: cwd ? join(workspacePath, cwd) : workspacePath,
encapsulatedNx: isEncapsulatedNx,
workspacePath,
})
);
return task;
Expand Down
3 changes: 2 additions & 1 deletion libs/vscode/utils/src/lib/shell-execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface ShellConfig {
cwd: string;
displayCommand: string;
encapsulatedNx: boolean;
workspacePath: string;
}

export async function getShellExecutionForConfig(
Expand All @@ -24,7 +25,7 @@ export async function getShellExecutionForConfig(
} else {
const { detectPackageManager, getPackageManagerCommand } =
await importNxPackagePath<typeof import('nx/src/utils/package-manager')>(
config.cwd,
config.workspacePath,
'src/utils/package-manager'
);
const pmc =
Expand Down

0 comments on commit 744c8be

Please sign in to comment.