Skip to content

Commit

Permalink
[core] Extend yarn size:why
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Oct 11, 2020
1 parent 66f3a23 commit fb4931a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 654 deletions.
3 changes: 0 additions & 3 deletions .dependabot/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ update_configs:
- match:
# should be grouped with `react`
dependency_name: 'react-test-renderer'
- match:
# breaks `yarn size:why`
dependency_name: 'size-limit'
- match:
# https://github.com/mui-org/material-ui/pull/17168#issuecomment-524861427
dependency_name: 'tslint'
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"prettier": "node ./scripts/prettier.js",
"prettier:all": "node ./scripts/prettier.js write",
"size:snapshot": "node scripts/sizeSnapshot/create",
"size:why": "size-limit --why packages/material-ui/build/index.js",
"size:why": "node scripts/sizeSnapshot/why",
"start": "yarn docs:dev",
"test": "yarn lint && yarn typescript && yarn test:coverage",
"test:coverage": "cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=text mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}' 'scripts/**/*.test.{js,ts,tsx}' 'test/utils/**/*.test.{js,ts,tsx}'",
Expand Down Expand Up @@ -143,14 +143,14 @@
"rollup-plugin-size-snapshot": "^0.12.0",
"rollup-plugin-terser": "^7.0.0",
"sinon": "^9.0.0",
"size-limit": "^0.21.0",
"tslint": "5.14.0",
"typescript": "^4.0.2",
"unist-util-visit": "^2.0.2",
"url-loader": "^4.1.0",
"vrtest-mui": "^0.3.4",
"webpack": "^4.41.0",
"webpack-cli": "^3.3.9",
"webpack-bundle-analyzer": "^3.9.0",
"yargs": "^16.0.3",
"yarn-deduplicate": "^3.0.0"
},
Expand Down
22 changes: 22 additions & 0 deletions scripts/sizeSnapshot/why.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const fse = require('fs-extra');
const path = require('path');
const { promisify } = require('util');
const webpackCallbackBased = require('webpack');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const createWebpackConfig = require('./webpack.config');

const webpack = promisify(webpackCallbackBased);

async function run() {
await fse.mkdirp(path.join(__dirname, 'build'));

const config = await createWebpackConfig(webpack);
config.plugins.push(new BundleAnalyzerPlugin());

await webpack(config);
}

run().catch((error) => {
console.error(error);
process.exit(1);
});
Loading

0 comments on commit fb4931a

Please sign in to comment.