Reputation: 2197
Let's say I have this npm script:
"test": "npm config set email [email protected] && npm config get email"
After running npm run test
I don't see email updated.
Similarly if create bash script like so:
npm config set email [email protected]
npm config get email
and add it to npm script, it still works the same way.
This might be a bash issue, I'm a very new to bash. Is there a way to make it work - meaning to set the config values and use them in the script?
Upvotes: 0
Views: 577
Reputation: 5134
I think the issue is a bit more complicated. Consider this:
c:\cygwin64\home\qbolec\baro>npm config set email [email protected]
c:\cygwin64\home\qbolec\baro>npm run test
> [email protected] test c:\cygwin64\home\qbolec\baro
> echo 'before'&& grep '^email' /cygdrive/c/Users/qbolec/.npmrc&& npm config set email [email protected]&& echo 'after'&& grep '^email' /cygdrive/c/Users/qbolec/.npmrc&& echo 'get'&& npm config get email
'before'
[email protected]
[email protected]
'after'
[email protected]
[email protected]
'get'
[email protected]
c:\cygwin64\home\qbolec\baro>npm config get email
[email protected]
c:\cygwin64\home\qbolec\baro>cat package.json
{
"name": "baro",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo 'before'&& grep '^email' /cygdrive/c/Users/qbolec/.npmrc&& npm config set email [email protected]&& echo 'after'&& grep '^email' /cygdrive/c/Users/qbolec/.npmrc&& echo 'get'&& npm config get email"
},
"author": "Jakub Łopuszański <[email protected]>",
"license": "ISC"
}
It looks like the .npmrc file is actually changed by the npm config set
immediately, and the change is permanent, but not available for reading through npm config get
. However, I don't know how to overcome this.
Upvotes: 1