-
-
Notifications
You must be signed in to change notification settings - Fork 931
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: pin Node.js to global package (#3780)
- Loading branch information
Showing
17 changed files
with
148 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@pnpm/manifest-utils": minor | ||
--- | ||
|
||
The path to Node.js executable is added to `dependenciesMeta` when `nodeExecPath` is specified in the`PackageSpecObject`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@pnpm/link-bins": minor | ||
--- | ||
|
||
Allow to specify the path to Node.js executable that should be called from the command shim. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@pnpm/plugin-commands-installation": minor | ||
--- | ||
|
||
Globally installed packages should always use the active version of Node.js. So if webpack is installed while Node.js 16 is active, webpack will be executed using Node.js 16 even if the active Node.js version is switched using `pnpm env`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { promises as fs } from 'fs' | ||
import path from 'path' | ||
import { add } from '@pnpm/plugin-commands-installation' | ||
import prepare from '@pnpm/prepare' | ||
import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' | ||
import tempy from 'tempy' | ||
|
||
const REGISTRY_URL = `http://localhost:${REGISTRY_MOCK_PORT}` | ||
const tmp = tempy.directory() | ||
|
||
const DEFAULT_OPTIONS = { | ||
argv: { | ||
original: [], | ||
}, | ||
bail: false, | ||
bin: 'node_modules/.bin', | ||
cacheDir: path.join(tmp, 'cache'), | ||
cliOptions: {}, | ||
include: { | ||
dependencies: true, | ||
devDependencies: true, | ||
optionalDependencies: true, | ||
}, | ||
lock: true, | ||
pnpmfile: '.pnpmfile.cjs', | ||
rawConfig: { registry: REGISTRY_URL }, | ||
rawLocalConfig: { registry: REGISTRY_URL }, | ||
registries: { | ||
default: REGISTRY_URL, | ||
}, | ||
sort: true, | ||
storeDir: path.join(tmp, 'store'), | ||
workspaceConcurrency: 1, | ||
} | ||
|
||
test('globally installed package is linked with active version of Node.js', async () => { | ||
prepare() | ||
await add.handler({ | ||
...DEFAULT_OPTIONS, | ||
dir: process.cwd(), | ||
global: true, | ||
linkWorkspacePackages: false, | ||
}, ['hello-world-js-bin']) | ||
|
||
const manifest = (await import(path.resolve('package.json'))) | ||
|
||
expect( | ||
manifest.dependenciesMeta['hello-world-js-bin']?.node | ||
).toBeTruthy() | ||
|
||
const shimContent = await fs.readFile('node_modules/.bin/hello-world-js-bin', 'utf-8') | ||
expect(shimContent).toContain(process.env.NODE) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.