diff --git a/workspaces/config/lib/index.js b/workspaces/config/lib/index.js index 1ddf267839195..6520e5616ff41 100644 --- a/workspaces/config/lib/index.js +++ b/workspaces/config/lib/index.js @@ -482,8 +482,9 @@ class Config { if (problem.action === 'delete') { this.delete(problem.key, problem.where) } else if (problem.action === 'rename') { - const old = this.get(problem.from, problem.where) - this.set(problem.to, old, problem.where) + const raw = this.data.get(problem.where).raw?.[problem.from] + const calculated = this.get(problem.from, problem.where) + this.set(problem.to, raw || calculated, problem.where) this.delete(problem.from, problem.where) } } diff --git a/workspaces/config/tap-snapshots/test/index.js.test.cjs b/workspaces/config/tap-snapshots/test/index.js.test.cjs index 6680fd2377960..eccdbee3abced 100644 --- a/workspaces/config/tap-snapshots/test/index.js.test.cjs +++ b/workspaces/config/tap-snapshots/test/index.js.test.cjs @@ -25,6 +25,18 @@ exports[`test/index.js TAP credentials management def_auth > other registry 1`] Object {} ` +exports[`test/index.js TAP credentials management def_authEnv > default registry 1`] = ` +Object { + "auth": "\${PATH}", + "password": "", + "username": "<\\u0004�", +} +` + +exports[`test/index.js TAP credentials management def_authEnv > other registry 1`] = ` +Object {} +` + exports[`test/index.js TAP credentials management def_passNoUser > default registry 1`] = ` Object { "email": "i@izs.me", diff --git a/workspaces/config/test/index.js b/workspaces/config/test/index.js index d7d55c2366237..99c1c3647ef77 100644 --- a/workspaces/config/test/index.js +++ b/workspaces/config/test/index.js @@ -701,6 +701,9 @@ email = i@izs.me '.npmrc': `_auth = ${Buffer.from('hello:world').toString('base64')} always-auth = true`, }, + def_authEnv: { + '.npmrc': '_auth = ${PATH}', + }, none_authToken: { '.npmrc': '_authToken = 0bad1de4' }, none_lcAuthToken: { '.npmrc': '_authtoken = 0bad1de4' }, none_emptyConfig: { '.npmrc': '' },