Skip to content

Commit

Permalink
feat: support yarn pnp (#1850)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKless authored Aug 2, 2023
1 parent 0bd8fa1 commit f5787a3
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ class NxToolWindowPanel(private val project: Project) : SimpleToolWindowPanel(tr
indent {
row {
text(
"<html>" +
"<h3>We couldn't find any projects in this workspace.</h3> Make sure that the proper dependencies are installed locally and refresh the workspace."
"<h3>We couldn't find any projects in this workspace.</h3> Make sure that the proper dependencies are installed locally and refresh the workspace."
)
}
row {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ class NxlsProcess(private val project: Project) {
addParameter(lsp.path)
addParameter("--stdio")

NodeCommandLineConfigurator.find(project.nodeInterpreter)
.configure(this, NodeCommandLineConfigurator.defaultOptions(project))
NodeCommandLineConfigurator.find(project.nodeInterpreter).configure(this)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export async function createProjectGraph(
cwd: workspacePath,
displayCommand: 'nx dep-graph --file ' + projectGraphOutput.relativePath,
encapsulatedNx: isEncapsulatedNx,
useNpx: true,
});

logger.log(`Generating graph with command: \`${command}\``);
Expand Down
4 changes: 2 additions & 2 deletions libs/shared/file-system/src/lib/cache-json.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'path';
import { PosixFS, ZipOpenFS } from '@yarnpkg/fslib';
import { getLibzipSync as libzip } from '@yarnpkg/libzip';
import { PosixFS } from '@yarnpkg/fslib';
import { ZipOpenFS, getLibzipSync as libzip } from '@yarnpkg/libzip';

import { parse as parseJson, ParseError } from 'jsonc-parser';

Expand Down
11 changes: 3 additions & 8 deletions libs/shared/utils/src/lib/get-nx-execution-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export function getNxExecutionCommand(config: {
cwd: string;
displayCommand: string;
encapsulatedNx: boolean;
useNpx?: boolean;
}): string {
let command = config.displayCommand;
if (config.encapsulatedNx) {
Expand All @@ -21,13 +20,9 @@ export function getNxExecutionCommand(config: {
command = command.replace(/^nx/, './nx');
}
} else {
if (config.useNpx) {
command = `npx ${command}`;
} else {
const packageManager = detectPackageManager(config.cwd);
const packageManagerCommand = getPackageManagerCommand(packageManager);
command = `${packageManagerCommand.exec} ${command}`;
}
const packageManager = detectPackageManager(config.cwd);
const packageManagerCommand = getPackageManagerCommand(packageManager);
command = `${packageManagerCommand.exec} ${command}`;
}

return command;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"@parcel/watcher": "2.2.0",
"@vscode/codicons": "^0.0.32",
"@vscode/webview-ui-toolkit": "^1.2.0",
"@yarnpkg/fslib": "2.6.1-rc.5",
"@yarnpkg/libzip": "2.2.3-rc.5",
"@yarnpkg/fslib": "^3.0.0-rc.48",
"@yarnpkg/libzip": "^3.0.0-rc.48",
"dotenv": "^16.0.3",
"fast-glob": "^3.2.11",
"find-cache-dir": "^3.3.2",
Expand Down
40 changes: 21 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10694,16 +10694,6 @@ __metadata:
languageName: node
linkType: hard

"@yarnpkg/fslib@npm:2.6.1-rc.5":
version: 2.6.1-rc.5
resolution: "@yarnpkg/fslib@npm:2.6.1-rc.5"
dependencies:
"@yarnpkg/libzip": ^2.2.3-rc.5
tslib: ^1.13.0
checksum: 3471b234f66b64ae4d01afca5b060c409817e9353fc4b5c26aab6b60fc6f0a2ee981485abc961646aaa538fc0cd8c63db1b688e637b7ac57a79f5c624727660d
languageName: node
linkType: hard

"@yarnpkg/fslib@npm:^2.7.1":
version: 2.7.1
resolution: "@yarnpkg/fslib@npm:2.7.1"
Expand All @@ -10714,13 +10704,12 @@ __metadata:
languageName: node
linkType: hard

"@yarnpkg/libzip@npm:2.2.3-rc.5":
version: 2.2.3-rc.5
resolution: "@yarnpkg/libzip@npm:2.2.3-rc.5"
"@yarnpkg/fslib@npm:^3.0.0-rc.48":
version: 3.0.0-rc.48
resolution: "@yarnpkg/fslib@npm:3.0.0-rc.48"
dependencies:
"@types/emscripten": ^1.38.0
tslib: ^1.13.0
checksum: 1ccf5f48a294c50388b14df9f0e694e46a17815b55e66fd0ee537a87e1482bc779ed3acb3550802b3e225477f193b339369b0bde20887bc16258c8774b5fe1aa
tslib: ^2.4.0
checksum: 658b8c1b688d875de06adf1a4be167641b3082445e310b9a1312deb71a7ef816f829675a571acad10725aed3ee5d0791d6c370a6565af05e1f4f38f470d457d2
languageName: node
linkType: hard

Expand All @@ -10734,7 +10723,7 @@ __metadata:
languageName: node
linkType: hard

"@yarnpkg/libzip@npm:^2.2.3-rc.5, @yarnpkg/libzip@npm:^2.2.4":
"@yarnpkg/libzip@npm:^2.2.4":
version: 2.2.4
resolution: "@yarnpkg/libzip@npm:2.2.4"
dependencies:
Expand All @@ -10744,6 +10733,19 @@ __metadata:
languageName: node
linkType: hard

"@yarnpkg/libzip@npm:^3.0.0-rc.48":
version: 3.0.0-rc.48
resolution: "@yarnpkg/libzip@npm:3.0.0-rc.48"
dependencies:
"@types/emscripten": ^1.39.6
"@yarnpkg/fslib": ^3.0.0-rc.48
tslib: ^2.4.0
peerDependencies:
"@yarnpkg/fslib": ^3.0.0-rc.48
checksum: 9e699e4315a92693de303d0c447a0b104e6171e5c4a583761f0a690bcc9917ba3c7cd051737eac94e1a52e7012fcad294db345ffd31261a5e74d2aad10ec35f6
languageName: node
linkType: hard

"@yarnpkg/lockfile@npm:1.1.0, @yarnpkg/lockfile@npm:^1.1.0":
version: 1.1.0
resolution: "@yarnpkg/lockfile@npm:1.1.0"
Expand Down Expand Up @@ -23673,8 +23675,8 @@ __metadata:
"@wdio/local-runner": ^7.27.0
"@wdio/mocha-framework": ^7.26.0
"@wdio/spec-reporter": ^7.26.0
"@yarnpkg/fslib": 2.6.1-rc.5
"@yarnpkg/libzip": 2.2.3-rc.5
"@yarnpkg/fslib": ^3.0.0-rc.48
"@yarnpkg/libzip": ^3.0.0-rc.48
"@yarnpkg/pnp": ^3.1.1-rc.12
cypress: 12.17.2
dotenv: ^16.0.3
Expand Down

0 comments on commit f5787a3

Please sign in to comment.