1.10.6 • Published 4 years ago

rollup-all v1.10.6

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Rollup-all

Build Status Coverage Status semantic-release npm version npm

Overview

Rollup-all is an out of the box package for building all your shiny Javascript/Typescript library source codes in one parsing, allowing you to generate commonjs, es module, and browser builds at once. It is very configurable and runs asynchronously.

It allows you to configure the build process, letting you define what should be included and excluded in the build, if sourcemap should be generated, if minified versions of the build should be generated, if asset and type definition files should be copied over, and lots more...

It comes with all needed configurations already done for you, including support for typescript projects. It uses Rollup's JavaScript API to automate the build process.

Getting Started

npm install --save-dev rollup-all

Next, add the build script to your package.json file

{
  "scripts": {
    "build": "rollup-all"
  }
}

Advanced Configuration

In case you need to do some other configurations, such as passing extra babel presets, babel plugins, rollup plugins, and build config, then you can create a rollup.config.js file at the root of your project. Like shown below:

const { config } = require('rollup-all');
module.exports = config(options);

The above code is the way to configure the build process. The good thing is that it is self documented, because it is a typescript project, and has typings generated.

Below is a brief documentation of the options object.

The Options Object

The options object takes two objects, config and babelConfig.

  1. Babel Config

Babel config object takes presets array and plugins array. These are added to the already existing presets and plugins used internally.

By default, The following presets are added automatically:

  1. @babel/preset-env
  2. @babel/preset-typescript

The following babel plugins are added automatically:

  1. @babel/plugin-proposal-class-properties
  2. @babel/plugin-proposal-nullish-coalescing-operator
  3. @babel/plugin-proposal-object-rest-spread
  4. @babel/plugin-transform-runtime
  5. @babel/runtime

  6. Config

The config object is where you configure build specific options, and also where you extend the rollup plugins. it accepts a plugins array, that are added to the already used plugins. Below is a list of already added plugins

  1. rollup-plugin-babel
  2. @rollup/plugin-commonjs
  3. @rollup/plugin-node-resolve
  4. rollup-plugin-terser
  5. @rollup/plugin-json

The config option takes other configuration options, such as sourcemap option, interop, uglify, assets array, distConfig options (where you can configure options specifically for browser builds, such as externals). etc. Note that distConfig.enabled options is set to false by default.

Contributing

We welcome your own contributions, ranging from code refactoring, documentation improvements, new feature implementations, bugs/issues reporting, etc. Thanks in advance!!!