lein-npm
lein-npm copied to clipboard
How to add `npm prune` in a hook before installing?
Hello guys
With this plugin npm install is invoked when calling lein deps. How can I add a npm prune before npm install? Is there a hook for that I can add in the project.clj file?
Mmmm, not that I am aware of. Can you run npm prune on its own? Is there a reason to not keep the commands separate?
never mind this one, i solved this within package.json:
"scripts": {
"preinstall": "npm prune",
},
but unfortunately lein-npm does not honour existing package.json's when running lein deps ...
Can you use :nodejs {:scripts {:preinstall "npm prune"}} in your project.clj instead?
The purpose of lein-npm is to produce a package.json so it makes sense to not use it. From the README:
You can execute npm commands that require the presence of a package.json file using the lein npm command.
Does that help?
Yeah, I could. I just do not want to move this to project.clj because we are using pm2 for deployment and it requires package.json to exist permanently.
Would #35 help? I'd appreciate your input.
i am afraid i cannot help because i do not understand clojure :/