fix: correctly detect the active Node.js version (#4780)

close #4203
This commit is contained in:
Zoltan Kochan
2022-05-23 11:34:51 +03:00
committed by GitHub
parent 24f936b3be
commit 05159665d4
8 changed files with 31 additions and 10 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/config": patch
---
Do not return a default value for the node-version setting.

View File

@@ -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).

View File

@@ -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",

View File

@@ -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'

View File

@@ -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) {

View File

@@ -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 () => {

12
pnpm-lock.yaml generated
View File

@@ -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==}

4
typings/local.d.ts vendored
View File

@@ -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;
}