forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parallelizes the build script across multiple processes (facebook#15716)
* Write size info to separate file per bundle `bundle-sizes.json` contains the combined size information for every build. This makes it easier to store and process, but it prevents us from parallelizing the build script, because each process would need to write to the same file. So I've updated the Rollup script to output individual files per build. A downstream CI job consolidates them into a single file. I have not parallelized the Rollup script yet. I'll do that next. * Parallelize the build script Uses CircleCI's `parallelism` config option to spin up multiple build processes.
- Loading branch information
Showing
6 changed files
with
97 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
.DS_STORE | ||
node_modules | ||
scripts/flow/*/.flowconfig | ||
scripts/rollup/results.json | ||
*~ | ||
*.pyc | ||
.grunt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
// Script that combines bundle size information for each build into a single | ||
// JSON file for easier storage and processing. | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const BUILD_DIR = path.join(__dirname, '../../build'); | ||
|
||
const filenames = fs.readdirSync(path.join(BUILD_DIR, 'sizes')); | ||
|
||
let bundleSizes = []; | ||
for (let i = 0; i < filenames.length; i++) { | ||
const filename = filenames[i]; | ||
if (filename.endsWith('.size.json')) { | ||
const json = fs.readFileSync(path.join(BUILD_DIR, 'sizes', filename)); | ||
bundleSizes.push(JSON.parse(json)); | ||
} | ||
} | ||
|
||
const outputFilename = path.join(BUILD_DIR, 'bundle-sizes.json'); | ||
const outputContents = JSON.stringify({bundleSizes}, null, 2); | ||
|
||
fs.writeFileSync(outputFilename, outputContents); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters