From 6c3bad777dca2b60f406198c6601c3d23819443c Mon Sep 17 00:00:00 2001 From: Josh Johnson Date: Thu, 24 Jan 2019 23:21:00 +0000 Subject: [PATCH] Add bundlesize (#502) * Configure bundlesize * Update travis script * Remove node modules cache * Run bundlesize as after script * Remove duplicate coverage check * Remove test:size from test command --- .travis.yml | 6 +++--- README.md | 2 +- package.json | 14 +++++++++++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 93d7b08..6f0535e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,6 @@ before_install: install: - npm install script: - - npm run test:unit - - npm run coverage - - npm run test:e2e + - npm run test +after_script: + - npm run bundlesize \ No newline at end of file diff --git a/README.md b/README.md index 6a05036..381b9cd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Choices.js ![Build Status](https://travis-ci.org/jshjohnson/Choices.svg?branch=master) [![](https://data.jsdelivr.com/v1/package/npm/choices.js/badge?style=rounded)](https://www.jsdelivr.com/package/npm/choices.js) [![npm](https://img.shields.io/npm/v/choices.js.svg)](https://www.npmjs.com/package/choices.js) [![codebeat badge](https://codebeat.co/badges/55120150-5866-42d8-8010-6aaaff5d3fa1)](https://codebeat.co/projects/github-com-jshjohnson-choices-master) -A vanilla, lightweight (~20kb gzipped 🎉), configurable select box/text input plugin. Similar to Select2 and Selectize but without the jQuery dependency. +A vanilla, lightweight (~25kb gzipped 🎉), configurable select box/text input plugin. Similar to Select2 and Selectize but without the jQuery dependency. [Demo](https://joshuajohnson.co.uk/Choices/) diff --git a/package.json b/package.json index e91bb38..b02579c 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,13 @@ "build": "npm run js:build && npm run css:build", "lint": "eslint assets/**/*.js", "coverage": "nyc npm run test:unit", + "bundlesize": "bundlesize", "cypress:run": "$(npm bin)/cypress run", "cypress:open": "$(npm bin)/cypress open", + "test": "run-p test:unit test:e2e", "test:unit": "mocha --require ./config/jsdom.js --compilers js:babel-core/register \"./src/**/**/**/**/*.test.js\" --exit", "test:unit:watch": "npm run test:unit -- --watch --inspect=5556", "test:e2e": "run-p --race start cypress:run", - "test": "run-p test:unit test:e2e", "js:watch": "NODE_ENV=development node server.js", "js:build:minimised": "webpack --env.minimize --config webpack.config.prod.js", "js:build:unminimised": "webpack --config webpack.config.prod.js", @@ -60,6 +61,7 @@ "babel-loader": "^7.1.2", "babel-preset-env": "^1.6.1", "babel-preset-stage-2": "^6.24.1", + "bundlesize": "^0.17.1", "chai": "^4.1.0", "csso": "^1.8.2", "cypress": "^3.1.4", @@ -77,7 +79,7 @@ "jsdom": "^11.5.1", "mocha": "^3.4.2", "node-sass": "^4.9.3", - "nodemon": "^1.9.1", + "nodemon": "^1.18.9", "npm-run-all": "^4.1.3", "nyc": "^11.0.3", "opn": "^5.1.0", @@ -115,5 +117,11 @@ "exclude": [ "src/scripts/**/**/*.test.js" ] - } + }, + "bundlesize": [ + { + "path": "public/assets/scripts/choices.min.js", + "maxSize": "25 kB" + } + ] }