Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

Commit

Permalink
feat(bundlesize): Run bundlesize after bundlescript
Browse files Browse the repository at this point in the history
Run npx bundlesize in the end of frans-scripts bundle to output the size of the newly created
bundle. Also accepts normal settings from bundlesize in package.json.
  • Loading branch information
adambrgmn committed Jan 11, 2018
1 parent 60580da commit a9c0a00
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/scripts/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ const rimraf = promisify(require('rimraf'));
const { isNil, is, has, prop, propIs } = require('ramda');
const pSeries = require('p-series');
const runScript = require('../utils/run-script');
const { resolveBin, hasFile, fromRoot, reformatFlags } = require('../utils');
const {
resolveBin,
hasFile,
fromRoot,
reformatFlags,
hasPkgProp,
} = require('../utils');

function bundle(configPath) {
if (isNil(configPath) || !is(String, configPath)) {
Expand Down Expand Up @@ -69,6 +75,12 @@ function bundle(configPath) {
}
},
...tasks,
async () => {
const bundlesizeConfig = hasPkgProp('bundlesize')
? []
: ['--files', 'dist/*.js'];
await runScript('npx', ['bundlesize', ...bundlesizeConfig]);
},
]);
};
}
Expand Down

0 comments on commit a9c0a00

Please sign in to comment.