Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Add script to create gzipped file in development & report gzip size on weigh in #640

Merged
merged 5 commits into from
Apr 20, 2017

Conversation

kevinzwhuang
Copy link
Contributor

Description

Currently, react-apollo uses gzip-size to get the gzip size without writing a .gz file to disk. travis-weigh-in requires an actual file to work with, making it incompatible with gzip-size.

To solve this, this PR replaces gzip-size with a simple script that saves the compressed gzip and uses that file for file size calculation for both npm run filesize and travis-weigh-in scripts.

The compression strategy utilized by /scripts/gzip.js is identical to what's used in gzip-size, with both using zlib set to level 9. The main change is that gzip.js creates a .gz file.

Also, the added .gz file in /dist might be helpful for people wanting to use gzipped versions of react-apollo in development.

Summary of changes:

  • Add a simple gzip.js script to /scripts to create compressed gzips (used by compress:browser)
  • Add compress:browser script to package.json to handle creation of compressed index.js.gz for consumption by the filesize and travis-weigh-in scripts
  • Append npm run compress:browser to the end of compile:browser
  • Remove gzip-size as a devDependency

This PR addresses #574

@helfer
Copy link
Contributor

helfer commented Apr 20, 2017

This looks great. Thanks @kevinzwhuang !

@helfer helfer merged commit 52d153a into apollographql:master Apr 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants