From 67fd82f2bcaad289411367d0134da0edb38173c1 Mon Sep 17 00:00:00 2001 From: maoznir Date: Wed, 15 Apr 2020 12:58:09 +0300 Subject: [PATCH 1/2] Add bundle size check using bundlewatch --- bundlewatch.config.js | 11 +++++++++++ package.json | 6 ++++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 bundlewatch.config.js diff --git a/bundlewatch.config.js b/bundlewatch.config.js new file mode 100644 index 0000000..3c54b68 --- /dev/null +++ b/bundlewatch.config.js @@ -0,0 +1,11 @@ +const bundlewatchConfig = { + files: [ + { + path: './dist/cloudinary-react.js', + maxSize: '41kb' + } + ], + defaultCompression: 'gzip', +}; + +module.exports = bundlewatchConfig; \ No newline at end of file diff --git a/package.json b/package.json index 7acd422..88e308a 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,9 @@ "test:all": "run-s compile dist test test-dist test-lib", "test-dist": "TEST_SUBJECT=dist node_modules/.bin/mocha --require @babel/register test/.setup.js --recursive test", "test-lib": "TEST_SUBJECT=lib node_modules/.bin/mocha --require @babel/register test/.setup.js --recursive test", - "compile": "node_modules/.bin/babel src --out-dir lib --copy-files ", - "dist": "node_modules/.bin/webpack && npm run build-storybook", + "prebuild": "node_modules/.bin/babel src --out-dir lib --copy-files ", + "build": "node_modules/.bin/webpack && npm run build-storybook && npm run bundlewatch", + "bundlewatch": "bundlewatch --config ./bundlewatch.config.js", "storybook": "start-storybook -p 6006", "build-storybook": "del-cli docs && build-storybook -c .storybook -o docs" }, @@ -39,6 +40,7 @@ "babelify": "^10.0.0", "browserify": "^16.2.3", "browserify-shim": "^3.8.14", + "bundlewatch": "^0.2.6", "chai": "^4.1.2", "chai-string": "^1.4.0", "del-cli": "^3.0.0", From 82fc521825eb2970109d79de88327492d82f5403 Mon Sep 17 00:00:00 2001 From: maoznir Date: Wed, 15 Apr 2020 13:01:21 +0300 Subject: [PATCH 2/2] Update travis build script --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c1c3b37..505b583 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,7 @@ node_js: - "node" - "lts/*" before_script: - - npm run compile - - npm run dist + - npm run build env: - TEST_SUBJECT=src - TEST_SUBJECT=lib