Skip to content
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

Reduce npm package size. #214

Merged
merged 2 commits into from May 14, 2017
Merged

Reduce npm package size. #214

merged 2 commits into from May 14, 2017

Conversation

rblopes
Copy link
Contributor

@rblopes rblopes commented May 13, 2017

Hi, @samme, @photonstorm.

I'm sending this PR as a proposal to make some adjustements to the Phaser CE package. It is not a big change (just only an additional file), but it changes the contents distributed through npm. I'd like to ask you to review this change carefully. I am able to update this PR, if requested.

The problem is that phaser-ce package is too big, much because it includes contents not relevant for a npm package. Right now, running npm pack . against the master branch will create a TAR+GZIP archive which sits at around 36MB of size, ~94MB uncompressed ─ Think of npm pack as a "dry-run mode" of npm publish.

My proposal is to remove, among other things:

  • The resources folder, which contains miscellaneous files;

  • The Grunt tasks, because it is unusual to keep those files in a distribution package;

  • The documentation folder, because it is more convenient to read it either using a repository clone or the GitHub page.

With these changes applied, the package size should be reduced to around ~6.9MB, and ~33MB uncompressed, around 1/3 of the original size but still a little big because of all source maps and a few duplicate files under build/custom, which you should check later.

One question I have is about the filters/ folder, which contains some useful content. I opted to keep those files in the package, but I wonder how users are consuming those files. Perhaps those files should be published as a separate package.


References:

  1. npm-pack
  2. npm-developers § Keeping files out of your package

@samme
Copy link
Collaborator

samme commented May 13, 2017

/resources and /docs can definitely be excluded.

/src and /tasks are needed (together) only for custom builds.

I used to include filter files as needed from bower-installed phaser, which was convenient.

@rblopes
Copy link
Contributor Author

rblopes commented May 13, 2017

Ok, updated to keep Grunt tasks in the package.

@samme samme merged commit 43ad7d1 into phaserjs:master May 14, 2017
@rblopes rblopes deleted the reduce-npm-package branch May 16, 2017 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants