DEV Community

Discussion on: What interesting things I can do with npm?

Collapse
 
gmartigny profile image
Guillaume Martigny

Don't want to be too much showy, but sub-packages are cool.

Basically, inside one repo, you have a main package that depend on smaller package. Check Pencil.js for a real-life example.
You don't have to use scoped packages, but I would recommend it.

Thanks to Lerna managing the whole thing is pretty easy.

Collapse
 
theoutlander profile image
Nick Karnik

I tried to like Lerna, but I can’t seem to. The sub packages approach is a lot cleaner. Although, I don’t recall what benefits lerna provides anymore given that npm supports linking and sub packages.

Collapse
 
gmartigny profile image
Guillaume Martigny

I used to use npm link, but when scope grows and dependency tree gets weirder, you can't continue to do everything by hand.
My favorite features from Lerna:

  • lerna bootstrap --hoist save space with hoist common dependencies.
  • lerna add whatever --scope=mySubPackage add a new dependency to a sub-package.
  • lerna publish Bump and publish all packages individually.
Thread Thread
 
theoutlander profile image
Nick Karnik • Edited

Thanks for the insights. I really appreciate it!