Coder Social home page Coder Social logo

bundlechecker's Introduction

bundlechecker

Bundlecheker that built with rust and using napi.rs for node binding

Usage

const { checkBundlerSync } = require("@adityals/bundlechecker");

try {
  const { result, summary } = checkBundlerSync({
    configPath: "./package.json",
    compression: "brotli",
    silent: false,
  });
} catch (err) {
  console.error(err);
}

Config Example

{
  "name": "my_package",
  "bundlesize": [
    {
      "path": "../index.js",
      "maxSize": "50 kB"
    },
    {
      "path": "../notfound*.js",
      "maxSize": "10 kB"
    }
  ]
}

The important thing is provide the bundlesize key, you can attach to package.json or any JSON file.

Options

name description required default
configPath Where to look config file true null
compression Compression method true NoCompression
silent Wether to write to stdout or not false false

Result

If checkBundlerSync is succeed, it'll returns an object with 2 key result and summary

{
  result: {
    'index.js': {
      pass: true,
      actualFileSize: 0.93359375,
      sizeUnit: 'kB',
      compression: 'Brotli',
      budgetSize: 50
    },
    '../notfound*.js': {
      pass: false,
      actualFileSize: 0,
      sizeUnit: '',
      compression: '',
      budgetSize: 0,
      error: 'pattern ../notfound*.js is not getting any match'
    }
  },
  summary: { total: 2, success: 1, fail: 0, error: 1 }
}

I'm new to rust and hopefully this project will help me learn more.

bundlechecker's People

Contributors

adityalstkp avatar adjieguntoro-tokped avatar

Watchers

 avatar

bundlechecker's Issues

Fix CI

image

no support: windows
support: linux amd, mac amd, mac arm (apple silicon)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.