feat!: pnpx asks if a package should be installed (#3283)

close #3249
This commit is contained in:
Zoltan Kochan
2021-03-27 12:03:26 +02:00
committed by GitHub
parent 5f7ac62322
commit aa2fcfa9a6
4 changed files with 25 additions and 18 deletions

View File

@@ -0,0 +1,9 @@
---
"pnpm": major
---
pnpx does not automatically install packages. A prompt asks the user if a package should be installed, if it is not present.
`pnpx --yes` tells pnpx to install any missing package.
`pnpx --no` makes pnpx fail if the called packages is not installed.

View File

@@ -66,7 +66,7 @@
"@types/semver": "^7.3.4",
"@types/update-notifier": "^5.0.0",
"@types/which": "^2.0.0",
"@zkochan/libnpx": "11.0.3",
"@zkochan/libnpx": "13.0.1",
"@zkochan/retry": "^0.2.0",
"@zkochan/rimraf": "^1.0.0",
"anonymous-npm-registry-client": "0.1.2",

View File

@@ -121,7 +121,7 @@ test('adding new dep does not fail if node_modules was created with --public-hoi
})
test('pnpx works', () => {
const result = execPnpxSync(['hello-world-js-bin'])
const result = execPnpxSync(['--yes', 'hello-world-js-bin'])
expect(result.status).toBe(0)
expect(result.stdout.toString()).toMatch(/Hello world!/)

30
pnpm-lock.yaml generated
View File

@@ -2318,7 +2318,7 @@ importers:
'@types/semver': ^7.3.4
'@types/update-notifier': ^5.0.0
'@types/which': ^2.0.0
'@zkochan/libnpx': 11.0.3
'@zkochan/libnpx': 13.0.1
'@zkochan/retry': ^0.2.0
'@zkochan/rimraf': ^1.0.0
anonymous-npm-registry-client: 0.1.2
@@ -2409,7 +2409,7 @@ importers:
'@types/semver': 7.3.4
'@types/update-notifier': 5.0.0
'@types/which': 2.0.0
'@zkochan/libnpx': 11.0.3
'@zkochan/libnpx': 13.0.1
'@zkochan/retry': 0.2.0
'@zkochan/rimraf': 1.0.0
anonymous-npm-registry-client: 0.1.2
@@ -4978,12 +4978,13 @@ packages:
dependencies:
argparse: 2.0.1
/@zkochan/libnpx/11.0.3:
resolution: {integrity: sha512-pkwTuA8Cd301zhg0Gz35nJ2sxKhGr5lFKFI6UT9ISEedGSYzxATsFlCF41+i/0kZcnZTG1nNlR5XknkZBGryuw==}
engines: {node: '>=8.15'}
/@zkochan/libnpx/13.0.1:
resolution: {integrity: sha512-csFWr7oHFCoHsysci1WA07SD9LWfz3OWicmOGBLumCMZj9x44ifvlLV5V7WGgxbGm/UdLb3itgX4DjD1KE50sg==}
engines: {node: '>=10.13'}
dependencies:
'@zkochan/npm-package-arg': 1.0.2
'@zkochan/npm-package-arg': 2.0.1
dotenv: 8.2.0
enquirer: 2.3.6
rimraf: 3.0.2
safe-buffer: 5.2.1
which: 2.0.2
@@ -5011,22 +5012,13 @@ packages:
which: 2.0.2
dev: false
/@zkochan/npm-package-arg/1.0.2:
resolution: {integrity: sha512-9hHFHZTOexP/oge2GMQzPlhdi9IJ+Zgnobh7sNfSdIZepULMM/lNQE4hmkFDC2zk8+OBibtfHbUPulNZI18TQA==}
dependencies:
hosted-git-info: 2.8.8
semver: 6.3.0
validate-npm-package-name: 3.0.0
dev: true
/@zkochan/npm-package-arg/2.0.1:
resolution: {integrity: sha512-VvK3/jS9m/quSU970L5sZSvX9wmmhXnEu/GfffCz0/ZcMAUs471FFz2UJu56T/8N8hcKPODYuKHz8wL5xZZY3w==}
engines: {node: '>=10.13'}
dependencies:
hosted-git-info: 4.0.1
hosted-git-info: 4.0.2
semver: 7.3.5
validate-npm-package-name: 3.0.0
dev: false
/@zkochan/retry/0.2.0:
resolution: {integrity: sha512-WhB+2B/ZPlW2Xy/kMJBrMbqecWXcbDDgn0K0wKBAgO2OlBTz1iLJrRWduo+DGGn0Akvz1Lu4Xvls7dJojximWw==}
@@ -8364,6 +8356,12 @@ packages:
dependencies:
lru-cache: 6.0.0
/hosted-git-info/4.0.2:
resolution: {integrity: sha512-c9OGXbZ3guC/xOlCg1Ci/VgWlwsqDv1yMQL1CWqXDL0hDjXuNcq0zuR4xqPSuasI3kqFDhqSyTjREz5gzq0fXg==}
engines: {node: '>=10'}
dependencies:
lru-cache: 6.0.0
/html-encoding-sniffer/1.0.2:
resolution: {integrity: sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==}
dependencies: