Skip to content

Commit

Permalink
[docs] Track the bundle size
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Jan 12, 2018
1 parent 33d0954 commit a4481ff
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
11 changes: 7 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,22 @@ jobs:
- run:
name: Can we generate the build?
command: yarn build
- run:
name: Can we build the docs?
command: yarn docs:build
- run:
name: Is the size acceptable?
command: yarn size
test_browser:
<<: *defaults
steps:
- *restore_repo
- run:
name: Can we generate the api of the docs?
command: yarn docs:api
- run:
name: Should not have any git not staged
command: git diff --exit-code
test_browser:
<<: *defaults
steps:
- *restore_repo
- run:
name: Tests real browsers
command: yarn test:karma
Expand Down
11 changes: 9 additions & 2 deletions .size-limit
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
[
{
"description": "The initial cost people pay for using one component",
"path": "test/size/overhead.js",
"limit": "25.6 KB"
},
{
"description": "The size of the whole library.",
"path": "build/index.js",
"limit": "95.6 KB"
},
{
"path": "test/size/overhead.js",
"limit": "25.6 KB"
"description": "The main bundle of the documentation",
"path": ".next/app.js",
"limit": "156 KB"
}
]
3 changes: 1 addition & 2 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const pkg = require('./package.json');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const { findPages } = require('./docs/src/modules/utils/find');

const ENABLE_STATS = false;
process.env.MATERIAL_UI_VERSION = pkg.version;

module.exports = {
Expand All @@ -16,7 +15,7 @@ module.exports = {
}),
]);

if (ENABLE_STATS) {
if (process.env.DOCS_STATS_ENABLED) {
plugins.push(
// For all options see https://github.com/th0r/webpack-bundle-analyzer#as-plugin
new BundleAnalyzerPlugin({
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"docs:start": "next start",
"docs:export": "next export -o docs/export",
"docs:deploy": "yarn docs:build && yarn docs:export && firebase deploy",
"docs:size-why": "DOCS_STATS_ENABLED=true yarn docs:build",
"prebuild": "rimraf build",
"build:es2015": "cross-env NODE_ENV=production babel ./src --ignore *.spec.js --out-dir ./build",
"build:es2015modules": "cross-env NODE_ENV=production BABEL_ENV=modules babel ./src/index.js --out-file ./build/index.es.js",
Expand Down

0 comments on commit a4481ff

Please sign in to comment.