Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bundlesize

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bundlesize - npm Package Compare versions

Comparing version 0.13.2 to 0.14.0

src/shortener.js

6

package.json
{
"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": {

18

README.md

@@ -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 {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc