diff --git a/.changeset/thick-phones-sing.md b/.changeset/thick-phones-sing.md new file mode 100644 index 00000000000..661647eef09 --- /dev/null +++ b/.changeset/thick-phones-sing.md @@ -0,0 +1,5 @@ +--- +"@pnpm/config": patch +--- + +Do not return a default value for the node-version setting. diff --git a/.changeset/thin-chefs-sing.md b/.changeset/thin-chefs-sing.md new file mode 100644 index 00000000000..307af4b5046 --- /dev/null +++ b/.changeset/thin-chefs-sing.md @@ -0,0 +1,5 @@ +--- +"pnpm": patch +--- + +Correctly detect the active Node.js version, when the pnpm CLI is bundled to an executable [#4203](https://github.com/pnpm/pnpm/issues/4203). diff --git a/packages/config/package.json b/packages/config/package.json index 10463b9ca4f..1fa92473735 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -32,13 +32,13 @@ }, "homepage": "https://github.com/pnpm/pnpm/blob/main/packages/config#readme", "dependencies": { + "@pnpm/npm-conf": "1.0.1", "@pnpm/constants": "workspace:5.0.0", "@pnpm/error": "workspace:2.1.0", "@pnpm/global-bin-dir": "workspace:3.0.1", "@pnpm/pnpmfile": "workspace:1.2.6", "@pnpm/read-project-manifest": "workspace:2.0.13", "@pnpm/types": "workspace:7.10.0", - "@zkochan/npm-conf": "2.0.2", "camelcase": "^6.2.0", "can-write-to-dir": "^1.1.1", "is-subdir": "^1.1.1", diff --git a/packages/config/src/index.ts b/packages/config/src/index.ts index caa3b65e3c6..fe862a2c094 100644 --- a/packages/config/src/index.ts +++ b/packages/config/src/index.ts @@ -7,8 +7,8 @@ import globalBinDir from '@pnpm/global-bin-dir' import { requireHooks } from '@pnpm/pnpmfile' import { safeReadProjectManifestOnly } from '@pnpm/read-project-manifest' import camelcase from 'camelcase' -import loadNpmConf from '@zkochan/npm-conf' -import npmTypes from '@zkochan/npm-conf/lib/types' +import loadNpmConf from '@pnpm/npm-conf' +import npmTypes from '@pnpm/npm-conf/lib/types' import { sync as canWriteToDir } from 'can-write-to-dir' import normalizeRegistryUrl from 'normalize-registry-url' import fromPairs from 'ramda/src/fromPairs' diff --git a/packages/config/test/globalBinDir.test.ts b/packages/config/test/globalBinDir.test.ts index 841d5518438..7eb0be8d7fa 100644 --- a/packages/config/test/globalBinDir.test.ts +++ b/packages/config/test/globalBinDir.test.ts @@ -5,8 +5,8 @@ import getConfig from '@pnpm/config' const isWindows = process.platform === 'win32' -jest.mock('@zkochan/npm-conf/lib/conf', () => { - const originalModule = jest.requireActual('@zkochan/npm-conf/lib/conf') +jest.mock('@pnpm/npm-conf/lib/conf', () => { + const originalModule = jest.requireActual('@pnpm/npm-conf/lib/conf') class MockedConf extends originalModule { // eslint-disable-next-line @typescript-eslint/no-explicit-any constructor (base: any, types: any) { diff --git a/packages/config/test/index.ts b/packages/config/test/index.ts index 2dc8f838c52..3618b861e9a 100644 --- a/packages/config/test/index.ts +++ b/packages/config/test/index.ts @@ -3,8 +3,8 @@ import { promises as fs } from 'fs' import path from 'path' import getConfig from '@pnpm/config' import PnpmError from '@pnpm/error' +import loadNpmConf from '@pnpm/npm-conf' import prepare, { prepareEmpty } from '@pnpm/prepare' -import loadNpmConf from '@zkochan/npm-conf' import symlinkDir from 'symlink-dir' @@ -30,6 +30,9 @@ test('getConfig()', async () => { expect(config.fetchRetryFactor).toEqual(10) expect(config.fetchRetryMintimeout).toEqual(10000) expect(config.fetchRetryMaxtimeout).toEqual(60000) + // nodeVersion should not have a default value. + // When not specified, the package-is-installable package detects nodeVersion automatically. + expect(config.nodeVersion).toBeUndefined() }) test('throw error if --link-workspace-packages is used with --global', async () => { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f208aa51752..edd642a392e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -343,13 +343,13 @@ importers: '@pnpm/constants': workspace:5.0.0 '@pnpm/error': workspace:2.1.0 '@pnpm/global-bin-dir': workspace:3.0.1 + '@pnpm/npm-conf': 1.0.1 '@pnpm/pnpmfile': workspace:1.2.6 '@pnpm/prepare': workspace:* '@pnpm/read-project-manifest': workspace:2.0.13 '@pnpm/types': workspace:7.10.0 '@types/ramda': 0.27.39 '@types/which': ^2.0.0 - '@zkochan/npm-conf': 2.0.2 camelcase: ^6.2.0 can-write-to-dir: ^1.1.1 is-subdir: ^1.1.1 @@ -362,10 +362,10 @@ importers: '@pnpm/constants': link:../constants '@pnpm/error': link:../error '@pnpm/global-bin-dir': link:../global-bin-dir + '@pnpm/npm-conf': 1.0.1 '@pnpm/pnpmfile': link:../pnpmfile '@pnpm/read-project-manifest': link:../read-project-manifest '@pnpm/types': link:../types - '@zkochan/npm-conf': 2.0.2 camelcase: 6.3.0 can-write-to-dir: 1.1.1 is-subdir: 1.2.0 @@ -5034,6 +5034,13 @@ packages: dependencies: abbrev: 1.1.1 + /@pnpm/npm-conf/1.0.1: + resolution: {integrity: sha512-h5bZlJviHraLs0x12bn7gyewj4QIciNWjg5m9v9oTXw+dXHqeXf3wqpu66R919t2+59Bt268OUWyy/6gvZIstw==} + engines: {node: '>=14'} + dependencies: + config-chain: 1.1.13 + dev: false + /@pnpm/npm-lifecycle/1.0.4: resolution: {integrity: sha512-iEBd+wKi9dyo/vQuhxCPDiw33Liv2OCc5V4DpE01ij07vGshflP7p5GL8xkH16fBXxXAvPZ3wIs6wj4aNMt97A==} engines: {node: '>=12.17'} @@ -6044,6 +6051,7 @@ packages: engines: {node: '>=10'} dependencies: config-chain: 1.1.13 + dev: true /@zkochan/npm-package-arg/2.0.1: resolution: {integrity: sha512-VvK3/jS9m/quSU970L5sZSvX9wmmhXnEu/GfffCz0/ZcMAUs471FFz2UJu56T/8N8hcKPODYuKHz8wL5xZZY3w==} diff --git a/typings/local.d.ts b/typings/local.d.ts index 1f18c762a2a..5b61083f784 100644 --- a/typings/local.d.ts +++ b/typings/local.d.ts @@ -23,12 +23,12 @@ declare module '@zkochan/libnpx/index' { export = anything; } -declare module '@zkochan/npm-conf' { +declare module '@pnpm/npm-conf' { const anything: any; export = anything; } -declare module '@zkochan/npm-conf/lib/types' { +declare module '@pnpm/npm-conf/lib/types' { const anything: any; export = anything; }