-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve npm package size #2172
Comments
If I understand correctly, this would exclude build, demo, docs, test, and third_party/closure, for a total savings of about 13.6MB. $ du -sh build/ demo/ docs/ test/ third_party/closure/
236K build/
560K demo/
2.1M docs/
3.2M test/
7.5M third_party/closure/ There are a few other small things that could be excluded, like .github, which we failed to add to .npmignore when we created it, and some markdown docs (outside of README.md, which should stay). Those markdown docs are probably not worth excluding one-by-one, and you can't do *.md without losing README.md. You could possibly omit the externs (224K), but that would prevent other closure-based projects from referring to prebuilt, npm-installed copies of Shaka Player in their own compilation steps. So I'd prefer not to do that. Did I miss anything? Excluding these things would prevent users of shaka-player through npm from being able to modify and rebuild it without separately cloning the sources from github. This seems pretty reasonable to me, though. If you're reading this, and this change would break your workflow, please speak up! If nobody objects, I'd be happy to take a PR for this. Thanks for suggesting it! |
I don't think it should/needs to be possible to rebuild the project from the package. At least I've never done that for my packages... For the externs - maybe there is a legitimate reason to keep them but I'm not familiar with it. I've tried the change ony end (excluding |
👋 Hello @joeyparrish! To avoid removing every .md file one-by-one (and having to add new exceptions in the future), we could exclude all markdown files using Considering all the directories mentioned before, the final # exclude core
!core
# github
.git
.gitattributes
.gitignore
.github
# python
*.pyc
# directories
coverage/
build/
demo/
docs/
test/
third_party/closure/
# markdown
*.md
!README.md Note that this also includes the removal of repeating patterns. For example, This achieves a 26% decrease in the size of Finally, as this issue was opened over a year ago, I wanted to make sure it was discussed here before opening a pull request. Are there any other files or directories that should also be excluded? |
That looks good to me, with one exception: third_party/closure/ doesn't exist any more in v3.0+. I just checked the current size of dist/, and if we're excluding demo/, I see some outputs in dist/ that could also be dropped:
Uncompressed, those occupy another 1.6MB. One more question: If we don't need to be able to rebuild the source from the NPM package, do we still need the uncompiled sources in the package? Do people use the NPM version of Shaka Player and load it in uncompiled mode? |
Oh, and we can also drop karma.conf.js, which is related to the tests we're excluding. |
My apologies, I was checking on my local npm installation which is still in 2.5.20!
Although I haven't done this myself, I'm not sure if I can speak for everyone as I'm not familiar with the process - I would suggest that we avoid excluding them for now.
Considering the mentioned changes, the final .npmignore would look as follows: # exclude core
!core
# github
.git
.gitattributes
.gitignore
.github
# python
*.pyc
# directories
coverage/
build/
demo/
docs/
# tests
test/
karma.conf.js
# dist
dist/demo.*
dist/receiver.*
# markdown
*.md
!README.md @joeyparrish, please let me know what would the best course of action be regarding the uncompiled sources - I will be checking back on this issue to see if I can follow it with a pull request of the proposed changes. |
Sounds good. A PR would be appreciated. Thanks! |
Have you read the FAQ and checked for duplicate open issues?
Yes
Is your feature request related to a problem? Please describe.
npm install shaka-player
adds 22+Mb undernode_modules
. This is the entire content of the git repository plus the compiled JS files.I note that there is a
.npmignore
which is only omiting a few compilation artefacts.Describe the solution you'd like
Modify
.npmignore
to only include relevantdist
files (e.g. demos aren't presumably needed) and the sources needed for the.map
files (lib
,ui
); this will reduce the disk size to about 8Mb.Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: