Coder Social home page Coder Social logo

paulsmithkc / package-build-stats Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pastelsky/package-build-stats

0.0 0.0 0.0 10.54 MB

This is the cloud function that powers the core of building, minifying and gzipping of packages in bundlephobia

License: MIT License

Shell 0.07% JavaScript 74.71% TypeScript 25.22%

package-build-stats's Introduction

This is the function that powers the core of building, minifying and gzipping of packages in bundlephobia.

Usage

const { getPackageStats } = require('package-build-stats')

Building packages from npm

Building the latest stable version
const results = await getPackageStats('moment')
Building a specific version / tag
const results = await getPackageStats('[email protected]')
Building local packages (beta)
const results = await getPackageStats('~/dev/my-npm-package') // must have a package.json

Passing options to the build

const results = await getBuiltPackageStats('moment', options)
Options
Option Values Default Description
client npm or yarn npm Which client to use to install package for building
limitConcurrency true or false false When using yarn as the client, use the network mutex to limit concurrency
networkConcurrency number false When using yarn as client, limit simultaneous installs to this number.
customImports Array<string> null By default, the default export is used for calculating sizes. Setting this option allows calculation of package stats based on more granular top-level exports.
minifier terser or esbuild terser ESbuild is faster, albeit with marginally larger file sizes
installTimeout number (ms) 30000 Timeout for package install

Listening to events

package-build-stats emits various lifecycle events when building a package. You can listen to these events by subscribing to the event emitter (based on mitt).

import { eventQueue } from 'package-build-stats'

// Listen to all events
eventQueue.on('*', callback)

// Listen to specific events
eventQueue.on('TASK_PACKAGE_BUILD', callback)

For a list of all events, see this.

Contributing

See contributing guide.

package-build-stats's People

Contributors

pastelsky avatar cgat avatar hackbrettxxx avatar trs avatar

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.