Speed up npm ci
~55% by creating separate package.json for storybook stories
#10612
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactor. I found
npm ci
has been super slow to get through, and often hanging when running in our testing deploys. I tried removing tesseract/some other dependencies, but it seemed to make little difference. It turned out that storybook was taking a decent chunk of time when npm installing, so tried splitting it out into a separate package.json , andnpm ci
became quite a bit faster! I set the npm commands to auto-install the new package.json though, so there should be no breaking changes in anyone's flow. Thenpm run storybook
command will work as before.Only potentially breaking change is that when storybook is built, it'll build in stories/storybook-static instead of the root-level storybook-static/.
Technical
Some metrics of fresh installs:
Before, with storybook:
time npm ci --no-audit
took 7m12s, 6m12, avg 6m42node_modules
is 474 MBnpm list | wc -l
is 58After, without storybook:
time npm ci --no-audit
took 3m45s, 2m21, avg 3m03 (55% reduced)node_modules
is 300 MB (36% reduced)npm list | wc -l
is 53Testing
Screenshot
Up and running!
Stakeholders
@jimchamp