From f5787a32b384b4ab19d1c2e6774a92b28e2c7e3b Mon Sep 17 00:00:00 2001 From: MaxKless <34165455+MaxKless@users.noreply.github.com> Date: Wed, 2 Aug 2023 13:14:23 +0200 Subject: [PATCH] feat: support yarn pnp (#1850) --- .../nx_toolwindow/NxToolWindowPanel.kt | 3 +- .../kotlin/dev/nx/console/nxls/NxlsProcess.kt | 3 +- .../workspace/src/lib/create-project-graph.ts | 1 - libs/shared/file-system/src/lib/cache-json.ts | 4 +- .../utils/src/lib/get-nx-execution-command.ts | 11 ++--- package.json | 4 +- yarn.lock | 40 ++++++++++--------- 7 files changed, 30 insertions(+), 36 deletions(-) diff --git a/apps/intellij/src/main/kotlin/dev/nx/console/nx_toolwindow/NxToolWindowPanel.kt b/apps/intellij/src/main/kotlin/dev/nx/console/nx_toolwindow/NxToolWindowPanel.kt index 8095d6d818..2803ac2f69 100644 --- a/apps/intellij/src/main/kotlin/dev/nx/console/nx_toolwindow/NxToolWindowPanel.kt +++ b/apps/intellij/src/main/kotlin/dev/nx/console/nx_toolwindow/NxToolWindowPanel.kt @@ -63,8 +63,7 @@ class NxToolWindowPanel(private val project: Project) : SimpleToolWindowPanel(tr indent { row { text( - "" + - "

We couldn't find any projects in this workspace.

Make sure that the proper dependencies are installed locally and refresh the workspace." + "

We couldn't find any projects in this workspace.

Make sure that the proper dependencies are installed locally and refresh the workspace." ) } row { diff --git a/apps/intellij/src/main/kotlin/dev/nx/console/nxls/NxlsProcess.kt b/apps/intellij/src/main/kotlin/dev/nx/console/nxls/NxlsProcess.kt index 4db9d6cfb0..187bc54806 100644 --- a/apps/intellij/src/main/kotlin/dev/nx/console/nxls/NxlsProcess.kt +++ b/apps/intellij/src/main/kotlin/dev/nx/console/nxls/NxlsProcess.kt @@ -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) } } } diff --git a/libs/language-server/workspace/src/lib/create-project-graph.ts b/libs/language-server/workspace/src/lib/create-project-graph.ts index a73c381ad4..5afa423eb8 100644 --- a/libs/language-server/workspace/src/lib/create-project-graph.ts +++ b/libs/language-server/workspace/src/lib/create-project-graph.ts @@ -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}\``); diff --git a/libs/shared/file-system/src/lib/cache-json.ts b/libs/shared/file-system/src/lib/cache-json.ts index cc0bcb97b8..2133ac27b2 100644 --- a/libs/shared/file-system/src/lib/cache-json.ts +++ b/libs/shared/file-system/src/lib/cache-json.ts @@ -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'; diff --git a/libs/shared/utils/src/lib/get-nx-execution-command.ts b/libs/shared/utils/src/lib/get-nx-execution-command.ts index d5c5876a06..444ee94916 100644 --- a/libs/shared/utils/src/lib/get-nx-execution-command.ts +++ b/libs/shared/utils/src/lib/get-nx-execution-command.ts @@ -11,7 +11,6 @@ export function getNxExecutionCommand(config: { cwd: string; displayCommand: string; encapsulatedNx: boolean; - useNpx?: boolean; }): string { let command = config.displayCommand; if (config.encapsulatedNx) { @@ -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; diff --git a/package.json b/package.json index 582fd4518c..12a1c984c5 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/yarn.lock b/yarn.lock index 98ddf466bc..2c6886ced2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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 @@ -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: @@ -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" @@ -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