Skip to content

Commit

Permalink
ci: Removing unnecessary files from npm distribution tarball
Browse files Browse the repository at this point in the history
  • Loading branch information
steilerDev committed Aug 10, 2023
1 parent 9d4616c commit a0fb08f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
build/
coverage/
src/
test/
eslint.config.json
jest.config.json
knip.config.jsonc
tsconfig.json
tsdoc.json
typedoc.json

5 comments on commit a0fb08f

@leipert
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@steilerDev There is also the alternative of files[]: https://docs.npmjs.com/cli/v6/configuring-npm/package-json#files in package.json which is an allow-list rather than a deny-list.

@steilerDev
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would that be preferable? 🤔

I'd put in files: [ 'bin/**/*' ], right?

@steilerDev
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that is cleaner - now part of 1.2.0-beta.3 - thanks for the feedback!

@leipert
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was just a suggestion, @steilerDev! In my experience it is very easy to accidentally add new folders/files that are not needed for the package. For example generated temp files or some other files that might even be git ignored.

in the best case it might just be package bloat, in the worst case you might leak passwords or tokens.

@steilerDev
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see the appeal - this is my first "real" node project - always looking for best practices :)

Please sign in to comment.