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 0a4c2e5de17..6a1c6fb685f 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -32,12 +32,12 @@ }, "homepage": "https://github.com/pnpm/pnpm/blob/main/packages/config#readme", "dependencies": { + "@pnpm/npm-conf": "1.0.1", "@pnpm/constants": "workspace:6.1.0", "@pnpm/error": "workspace:3.0.1", "@pnpm/pnpmfile": "workspace:2.0.2", "@pnpm/read-project-manifest": "workspace:3.0.2", "@pnpm/types": "workspace:8.0.1", - "@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 545a1a46eea..836ceb81235 100644 --- a/packages/config/src/index.ts +++ b/packages/config/src/index.ts @@ -2,11 +2,11 @@ import path from 'path' import fs from 'fs' import { LAYOUT_VERSION } from '@pnpm/constants' import PnpmError from '@pnpm/error' +import loadNpmConf from '@pnpm/npm-conf' +import npmTypes from '@pnpm/npm-conf/lib/types' 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 normalizeRegistryUrl from 'normalize-registry-url' import fromPairs from 'ramda/src/fromPairs' import realpathMissing from 'realpath-missing' diff --git a/packages/config/test/globalBinDir.test.ts b/packages/config/test/globalBinDir.test.ts index 9434b7b1fb7..98312ac9ee6 100644 --- a/packages/config/test/globalBinDir.test.ts +++ b/packages/config/test/globalBinDir.test.ts @@ -10,8 +10,8 @@ import getConfig from '@pnpm/config' const globalBinDir = path.join(homedir(), '.local', 'pnpm') 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 8a62cd2caa1..5975c5631ea 100644 --- a/packages/config/test/index.ts +++ b/packages/config/test/index.ts @@ -4,8 +4,8 @@ import path from 'path' import PATH from 'path-name' 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' @@ -36,6 +36,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 ec1dbc86d4e..0f7b764206e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -341,13 +341,13 @@ importers: '@pnpm/config': workspace:15.1.2 '@pnpm/constants': workspace:6.1.0 '@pnpm/error': workspace:3.0.1 + '@pnpm/npm-conf': 1.0.1 '@pnpm/pnpmfile': workspace:2.0.2 '@pnpm/prepare': workspace:* '@pnpm/read-project-manifest': workspace:3.0.2 '@pnpm/types': workspace:8.0.1 '@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 @@ -360,10 +360,10 @@ importers: dependencies: '@pnpm/constants': link:../constants '@pnpm/error': link:../error + '@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 @@ -5069,6 +5069,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/2.0.0-1: resolution: {integrity: sha512-eUeRVUxnr9xP50ESMuRDrWYN/AQmaV2g/Wvs3ckHBx7XFJw8ljix66L7R1S1FoUqxNn0BeyPeIE9ANwn/syIAQ==} engines: {node: '>=12.17'} @@ -6037,6 +6044,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 24999631175..21dec3b6b89 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; }