0.0.8 • Published 8 years ago

build-bin v0.0.8

Weekly downloads
34
License
MIT
Repository
github
Last release
8 years ago

build-bin

Build Status

A zero-configuration plugin system for building assets for production release

Installing

build-bin is available as an npm package.

Usage

Add build-bin to the package.json as follows:

{
  "name": "project",
  "private": true,
  "scripts": {
    "build": "build"
  },
  "devDependencies": {
    "build-bin": "^0.0.2"
  }
}

Then add plugins for each desired build workflow. Existing plugins are listed below.

From the command line, run:

npm run build

Plugins

  • build-html compiles and minifies an HTML entry point.
  • build-esnext compiles, concatenates, and minifies ES.next modules.
  • build-gzip gzips all static assets after compilation.
  • build-cloudfoundry configures a static frontend for deployment on Cloud Foundry.
  • build-heroku configures a static frontend for deployment on Heroku.

Writing Plugins

Plugins must have a name that starts with build- and declare a stage in package.json. Valid stages include compile, compress, and config. All plugins from the compile stage are run first, followed by plugins in the compress stage, and finally, followed by plugins in the config stage.

{
  "name": "build-esnext",
  "stage": "compile",
  "main": "src/index.js"
}

Plugins must export a function or async function and must write into the dist directory.

import {fs} from 'node-promise-es6';

export default async function() {
  await fs.writeFile('dist.js', 'console.log("Hello World!");');
}

Development

Getting Started

The application requires the following external dependencies:

  • Node.js

The rest of the dependencies are handled through:

npm install

Run tests with:

npm test