Skip to content

Commit

Permalink
fix: don't crash on a .npmrc with missing env var
Browse files Browse the repository at this point in the history
close #5093
  • Loading branch information
zkochan committed Jul 31, 2022
1 parent 44544b4 commit 51d2a94
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .changeset/three-mugs-hide.md
@@ -0,0 +1,6 @@
---
"@pnpm/config": patch
"pnpm": patch
---

Don't crash when a config file contains a setting with an env variable that doesn't exist [#5093](https://github.com/pnpm/pnpm/issues/5093).
2 changes: 1 addition & 1 deletion packages/config/package.json
Expand Up @@ -36,7 +36,7 @@
"@pnpm/error": "workspace:*",
"@pnpm/git-utils": "workspace:*",
"@pnpm/matcher": "workspace:*",
"@pnpm/npm-conf": "1.0.5",
"@pnpm/npm-conf": "2.0.0",
"@pnpm/pnpmfile": "workspace:*",
"@pnpm/read-project-manifest": "workspace:*",
"@pnpm/types": "workspace:*",
Expand Down
3 changes: 1 addition & 2 deletions packages/config/src/index.ts
Expand Up @@ -144,7 +144,6 @@ export default async (
const env = opts.env ?? process.env
const packageManager = opts.packageManager ?? { name: 'pnpm', version: 'undefined' }
const cliOptions = opts.cliOptions ?? {}
const warnings = new Array<string>()

if (cliOptions['hoist'] === false) {
if (cliOptions['shamefully-hoist'] === true) {
Expand Down Expand Up @@ -176,7 +175,7 @@ export default async (
cliOptions['prefix'] = cliOptions.dir // the npm config system still expects `prefix`
}
const rcOptionsTypes = { ...types, ...opts.rcOptionsTypes }
const npmConfig = loadNpmConf(cliOptions, rcOptionsTypes, {
const { config: npmConfig, warnings } = loadNpmConf(cliOptions, rcOptionsTypes, {
'auto-install-peers': false,
bail: true,
color: 'auto',
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 51d2a94

Please sign in to comment.