bundlesize
Advanced tools
Comparing version 0.13.2 to 0.14.0
{ | ||
"name": "bundlesize", | ||
"version": "0.13.2", | ||
"version": "0.14.0", | ||
"description": "Keep your library size in check", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/siddharthkp/bundlesize.git" | ||
}, | ||
"main": "index.js", | ||
@@ -6,0 +10,0 @@ "bin": { |
@@ -35,2 +35,8 @@ <p align="center"> | ||
Or you can use `npx` with [NPM 5.2+](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b). | ||
```bash | ||
npx bundlesize | ||
``` | ||
#### configuration | ||
@@ -50,3 +56,3 @@ | ||
"path": "./dist.js", | ||
"maxSize": "3 Kb" | ||
"maxSize": "3 kB" | ||
} | ||
@@ -65,7 +71,7 @@ ] | ||
"path": "./dist/vendor-*.js", | ||
"maxSize": "3 Kb" | ||
"maxSize": "3 kB" | ||
}, | ||
{ | ||
"path": "./dist/chunk-*.js", | ||
"maxSize": "3 Kb" | ||
"maxSize": "3 kB" | ||
} | ||
@@ -84,3 +90,3 @@ ] | ||
Currently works for [Travis CI](https://travis-ci.org), [CircleCI](https://circleci.com/), [Wercker](wercker.com), and [Drone](http://readme.drone.io/). | ||
Currently works for [Travis CI](https://travis-ci.org), [CircleCI](https://circleci.com/), [Wercker](http://www.wercker.com), and [Drone](http://readme.drone.io/). | ||
@@ -145,1 +151,5 @@ - [Authorize `bundlesize` for status access](https://github.com/login/oauth/authorize?scope=repo%3Astatus&client_id=6756cb03a8d6528aca5a), copy the token provided. | ||
MIT © [siddharthkp](https://github.com/siddharthkp) | ||
#### sponsor | ||
[![Sponsor](https://app.codesponsor.io/embed/LhLT2c31ydJzdLUuSR9f8mCA/siddharthkp/bundlesize.svg)](https://app.codesponsor.io/link/LhLT2c31ydJzdLUuSR9f8mCA/siddharthkp/bundlesize) |
@@ -7,2 +7,3 @@ const bytes = require('bytes') | ||
const debug = require('./debug') | ||
const shortener = require('./shortener') | ||
@@ -54,8 +55,21 @@ const compare = (files, masterValues = {}) => { | ||
/* prepare the build page */ | ||
const params = encodeURIComponent( | ||
JSON.stringify({ files, repo, branch, commit_message, sha }) | ||
) | ||
const url = `https://bundlesize-store.now.sh/build?info=${params}` | ||
debug('url', url) | ||
const params = encodeURIComponent(JSON.stringify({ files, repo, branch, commit_message, sha })) | ||
let url = `https://bundlesize-store.now.sh/build?info=${params}` | ||
debug('url before shortening', url) | ||
shortener | ||
.shorten(url) | ||
.then(res => { | ||
url = res.data.id | ||
debug('url after shortening', url) | ||
setBuildStatus({ url, files, globalMessage, fail, event, branch }) | ||
}) | ||
.catch(error => { | ||
debug('error while shortening', error) | ||
setBuildStatus({ url, files, globalMessage, fail, event, branch }) | ||
}) | ||
} | ||
const setBuildStatus = ({ url, files, globalMessage, fail, event, branch }) => { | ||
if (fail) build.fail(globalMessage || 'bundle size > maxSize', url) | ||
@@ -62,0 +76,0 @@ else { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
13285
13
247
151
1