-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QUESTION] Alternative for $npm_package_* to pass multiple parameters to node #305
Comments
hi, same issue. |
Same issue. I used to retrieve data from |
You can put these values in a {
"config": {
"nodeParams": "--experimental-specifier-resolution=node --harmony -r source-map-support/register",
"author": {
"name": "Wile E. Coyote"
}
},
"scripts": {
"dostuff": "node $npm_package_config_nodeParams myscript.js",
"whoami": "echo $npm_package_config_author_name"
}
} Passing the entirety of |
Thanks - this mechanism also provided access to parameters from the .npmrc file(s). What is the recommended forward and backward compatible way of getting access to those again? Also, this information is not easy to find. See npm/cli#2452 (comment) |
Motivation ("The Why")
In my
package.json
, I have several scripts that callnode
with the same parameters over and over. To simplify that invocation, I've created a package.json variable, and am invoking the scripts like this:This is quite common for calling compiled TypeScript code, but no longer works in v7 due to RFC21. However, I can't find what the recommended alternative is.
I picked up this idea from somewhere on StackOverflow, so I'm probably not the only one impacted by the change.
The text was updated successfully, but these errors were encountered: