dimanche 19 avril 2015

Can I chain npm configuration entries?

Use of the npm config section is simple, and cool, but I've run into one restriction with it: a config entry does not get expanded, so one cannot chain them, nor even access non-config values s.a. package version within the config.


Sample:



{
"name": "myproj",
"version": "0.1.2",

"//": "Here, '$npm_package_version' is not expanded",
"config": {
"target": "dist/myproj-$npm_package_version.js"
},

"scripts": {
"echo": "echo $npm_package_config_target",
}
}


This gives:


dist/myproj-$npm_package_version.js


instead of:


dist/myproj-0.1.2.js


Is there anything I can do about it? Chaining values like this is a useful feature - I'm surprised nom doesn't do it. Is there a reason not to?


References:



Aucun commentaire:

Enregistrer un commentaire