Namespacing keys used by lein-npm in project files
RyanMcG opened this issue · 3 comments
From the README, it seems that lein-npm accesses several keys from the project file. These include:
:node-dependencies
:nodejs
and then:scripts
:npm-root
I propose looking in an alternative location, all under some map at :npm
in the leiningen project map.
:npm {:dependencies [...]
:scripts { ... }
:root :target-path}
We can deprecate the old search path, but still support it for backwards compatibility.
I'm making this an issue to get feedback from others (specifically @bodil).
Makes a lot of sense to me. I'd maybe even just throw out the backwards compat stuff, as long as it breaks with a helpful error message on how to upgrade. Seems like such a minor change it's not worth keeping edge cases around in the codebase for.
A few notes:
- I support this change.
- We tried to do a similar thing with lein-bower, by grouping settings under
:bower
. - However, lein-bower depends on lein-npm for dependency resolution, so I think because of the assumption that
:node-dependencies
would be at the top level,:bower-dependencies
also had to stay. - So I'd suggest either retain backwards-compatibility to allow lein-bower to gracefully catch up, or try to commit and release both roughly synchronously.
@arbscht I believe lein-bower uses resolve-node-deps
. I think I'll modify it so it uses lookup-key as a function (i.e. (lookup-key project)
instead of (project lookup-key)
). That will be backwards compatible and the new lookup function will be easy ((comp :dependencies :npm)
).
@bodil The issue with not being backwards compatible is that we use the same lookup function to lookup npm dependencies in jar and checkout dependencies and clients may not be able to control the project definitions of their dependencies..