fix: running exec/run/dlx with --use-node-version

ref #3595
This commit is contained in:
Zoltan Kochan
2022-07-16 17:17:52 +03:00
parent 13210db3c3
commit 0e9fa30ac5
5 changed files with 27 additions and 4 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/plugin-commands-script-runners": patch
"pnpm": patch
---
It should be possible to run exec/run/dlx with the `--use-node-version` option.

View File

@@ -1,6 +1,8 @@
import renderHelp from 'render-help'
import { docsUrl } from '@pnpm/cli-utils'
import { types } from '@pnpm/config'
import PnpmError from '@pnpm/error'
import pick from 'ramda/src/pick.js'
import * as dlx from './dlx'
export const commandNames = ['create']
@@ -21,11 +23,17 @@ export async function handler (_opts: dlx.DlxCommandOptions, params: string[]) {
}
export function rcOptionsTypes () {
return {}
return {
...pick([
'use-node-version',
], types),
}
}
export function cliOptionsTypes () {
return {}
return {
...rcOptionsTypes(),
}
}
export function help () {

View File

@@ -2,7 +2,7 @@ import fs from 'fs'
import path from 'path'
import { docsUrl } from '@pnpm/cli-utils'
import { OUTPUT_OPTIONS } from '@pnpm/common-cli-options-help'
import { Config } from '@pnpm/config'
import { Config, types } from '@pnpm/config'
import PnpmError from '@pnpm/error'
import { add } from '@pnpm/plugin-commands-installation'
import { fromDir as readPkgFromDir } from '@pnpm/read-package-json'
@@ -10,16 +10,22 @@ import packageBins from '@pnpm/package-bins'
import storePath from '@pnpm/store-path'
import execa from 'execa'
import omit from 'ramda/src/omit.js'
import pick from 'ramda/src/pick.js'
import renderHelp from 'render-help'
import { makeEnv } from './makeEnv'
export const commandNames = ['dlx']
export function rcOptionsTypes () {
return {}
return {
...pick([
'use-node-version',
], types),
}
}
export const cliOptionsTypes = () => ({
...rcOptionsTypes(),
package: [String, Array],
})

View File

@@ -29,6 +29,7 @@ export function rcOptionsTypes () {
...pick([
'bail',
'sort',
'use-node-version',
'unsafe-perm',
'workspace-concurrency',
], types),

View File

@@ -50,6 +50,7 @@ export function rcOptionsTypes () {
return {
...pick([
'npm-path',
'use-node-version',
], allTypes),
}
}
@@ -60,6 +61,7 @@ export function cliOptionsTypes () {
'bail',
'sort',
'unsafe-perm',
'use-node-version',
'workspace-concurrency',
'scripts-prepend-node-path',
], allTypes),