Lerna: Use npmignore from project root directory

Created on 3 Aug 2016  路  2Comments  路  Source: lerna/lerna

I have a project where each of my lerna packages is being build as a standalone module into a build folder inside each of the packages.

Right now the only way I've found to have lerna/npm publish only what's inside the build folder of each of the packages is with a .npmignore file in each of the packages with this inside:

*

!build/**

It would be nice if an .npmignore file at the root of the project could set the standard ignores and then any .npmignore files in the packages could override so I don't have to duplicate this file in every package.

Most helpful comment

I've said this a few places, probably need to write a thing up about it.

I actually prefer forcing people to duplicate all of these types configs. I prefer when every single package inside a Lerna repo is a fully working npm package. Meaning you could cd into the package and run npm install, npm publish, npm run [script] and all the rest and have everything still work.

I prefer building tools that are easy to opt back out of, and Lerna very much fits that description right now. I don't want to end up in a place where people need to spend days untangling Lerna from their repos if they don't want to use it anymore. I consider that a feature.

In addition to that I think it makes Lerna easier to teach to people. There's nothing special about these packages, there's just a tool that orchestrates them.

So for your .npmignore files I would suggest putting them into each directory. I've done it and other projects do it:

All 2 comments

I've said this a few places, probably need to write a thing up about it.

I actually prefer forcing people to duplicate all of these types configs. I prefer when every single package inside a Lerna repo is a fully working npm package. Meaning you could cd into the package and run npm install, npm publish, npm run [script] and all the rest and have everything still work.

I prefer building tools that are easy to opt back out of, and Lerna very much fits that description right now. I don't want to end up in a place where people need to spend days untangling Lerna from their repos if they don't want to use it anymore. I consider that a feature.

In addition to that I think it makes Lerna easier to teach to people. There's nothing special about these packages, there's just a tool that orchestrates them.

So for your .npmignore files I would suggest putting them into each directory. I've done it and other projects do it:

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nicolasrenon picture nicolasrenon  路  3Comments

iTonyYo picture iTonyYo  路  3Comments

sveisvei picture sveisvei  路  3Comments

bennycode picture bennycode  路  3Comments

lazd picture lazd  路  3Comments