re: What interesting things I can do with npm? VIEW POST


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.


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.


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.

Thanks for the insights. I really appreciate it!

code of conduct - report abuse