Closed kYem closed 3 years ago
Hi @kYem I can't seem to repro your problem. In fact if the original file has more than 1 double quote at the end of the token string, updating the credentials would fail. Can you share the version of the plugin you are using and maybe a bit more detailed repro steps? Thanks!
This happens consistently with initial .npmrc file
@test-registry:registry=https://europe-west2-npm.pkg.dev/test-registry/packages/
//europe-west2-npm.pkg.dev/test-registry/packages/:_authToken=""
//europe-west2-npm.pkg.dev/test-registry/packages/:always-auth=true
and then running
npx google-artifactregistry-auth .npmrc
produce:
@test-registry:registry=https://europe-west2-npm.pkg.dev/test-registry/packages/
//europe-west2-npm.pkg.dev/test-registry/packages/:_authToken="ya29.xxxxxxxxxxxxxx-mbIvg
"
//europe-west2-npm.pkg.dev/test-registry/packages/:always-auth=true
running it again
@test-registry:registry=https://europe-west2-npm.pkg.dev/test-registry/packages/
//europe-west2-npm.pkg.dev/test-registry/packages/:_authToken="ya29.a0aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaHddpMLFh-LVd765f-MopbnXCA2EWxdJQ
"
"
//europe-west2-npm.pkg.dev/test-registry/packages/:always-auth=true
System information:
Just to confirm but I'm able to use the generated token to access registry files, so it does work, but keeps producing this extra "
after each run
Running this in empty project with just
produce the same issue, even running the the local version
with .npmrc adding
Well just decided to debug myself and turns out that
getGcloudCredentials returns trailing \n
at the end of access token (zsh shell)
then in updateConfigFile
current file contents are:
Actual regex match does not include new line
with new contents after
newContents = contents.replace(regex,
$1"${creds}");
Ahh got it. For me I had application default credentials in my environment so getGcloudCredentials
never got called. Thanks for finding this! I'll put together a fix shortly.
v2.2.1 is now released. Please let me know if you see any other problems!
Seems to be working, thanks for the update.
.npmrc file content
After each run and extra
"
gets added