outmoded / hapi-contrib

Discussion forum for project contributors
Other
78 stars 25 forks source link

Exclude non lib files form packages #90

Closed hueniverse closed 8 years ago

hueniverse commented 8 years ago

I think it time to change our .npmignore policy and reduce package sizes. Thoughts?

geek commented 8 years ago

Agreed... we should ignore everything except lib and package.json.

Marsup commented 8 years ago

Already doing it on joi, that was ~10x improvement in size. Someone said on gitter that keeping API.md would be helpful when you're offline, that's not much of a sacrifice to keep.

arb commented 8 years ago

I like what you did with joi to keep .gitignore in sync with .npmignore using the npmignore tool.

hueniverse commented 8 years ago

I don't think we should keep any docs with the npm package. If people want the docs they should grab the docs. The hapi doc is 154K.

mark-bradshaw commented 8 years ago

Great idea. I've implemented this on yar and accept.

geek commented 8 years ago

The .npmignore file can be made to be very simple:

https://github.com/hapijs/reptile/blob/master/.npmignore

*
!lib/
arb commented 8 years ago

I like @geek's suggestion. That's nice and clean.

nlf commented 8 years ago

i like @geek's solution too, nice and portable

cjihrig commented 8 years ago

@geek is my hero

nlf commented 8 years ago

@geek is a hero to us all

Marsup commented 8 years ago

That doesn't work for me on joi, only index is included. But that does:

*
!lib/**
arb commented 8 years ago

I can confirm @Marsup. I tried this on another module and the only file under "lib" that was included was "index.js".

You can test this locally with tar -tf $(npm pack) && rm *.tgz that'll list the files when npm tars up your module.

devinivy commented 8 years ago

Should the license travel with the code for good measure?

cjihrig commented 8 years ago

There are some files that are never ignored, including the license. See https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package.

ldesplat commented 8 years ago

Despite what the documentation says what I run npm pack with marsup's .npmignore the README.md file is never included but LICENSE is. Do any of you have the same issue? And will it properly show up in npmjs.org?

Marsup commented 8 years ago

The readme is there for me, which version of npm ?

skeggse commented 8 years ago

I thought the readme gets tossed into the package.json, no?

On Mon, Jun 13, 2016, 9:21 AM Nicolas Morel notifications@github.com wrote:

The readme is there for me, which version of npm ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hapijs/contrib/issues/90#issuecomment-225632140, or mute the thread https://github.com/notifications/unsubscribe/ABSVf40TDXmUWOazFddDM0OJ1knycezjks5qLYNvgaJpZM4IvWal .

ldesplat commented 8 years ago

node v6.2.1 npm 3.9.3 Trying to update to 3.9.5

Definitely not included in the package.json in npm pack at least.

Marsup commented 8 years ago

Works with 3.8.6. Definitely a bug with npm.

ldesplat commented 8 years ago

You are right: https://github.com/npm/npm/issues/12876 which then links all the way back to a 2014 issue :)

So, be careful, if you're publishing with node 6 and npm 3.9.3 (or 3.9.5) for that matter. As soon as you exclude .npmignore or you use the wildcard match, it will exclude the README :(

ldesplat commented 8 years ago

This worked for me in node 6... unfortunately includes the .npmignore file but oh well.

*
!lib/**
!.npmignore