commandify

0.1.2 • Public • Published

commandify build status

Executes a command whenever the bundle is created.

package.json

{
  "browserify": {
    "transform": [ "commandify" ]
  },
  "commandify": "make all",
  "dependencies": {
    "commandify": "~0.1.0"
  }
}

Or configure via JavaScript

commandify.cmd = 'make hello';
commandify.dir = __dirname + '/compile';
browserify()
  .require(require.resolve('./makeify/main.js'), { entry: true })
  .bundle()
  .pipe(...);

Or configure via command line

COMMANDIFY_CMD='make all' COMMANDIFY_DIR='./compile' browserify -t commandify main.js .... 

Installation

npm install commandify

API

commandify::cmd

The command to be executed (only needed if not defined via package.json config).

Source:

commandify::dir

The directory in which the command is to be executed (only needed if not defined via package.json config).

Source:

commandify(file) → {TransformStream}

browserify transform which executes a shell command exactly once for every time the bundle is created.

The command can be configured

inside package.json
{
"browserify": {
"transform": [ "commandify" ]
},
"commandify": "make all"
}

In this case the command is executed in the directory in which the package.json is defined.

via environment variables:
COMMANDIFY_CMD='make all' COMMANDIFY_DIR='./compile' browserify main.js ....
directly on commandify when bundle step is JavaScript
commandify.cmd = 'make hello';
commandify.dir = __dirname + '/compile';
browserify()
.require(require.resolve('./makeify/main.js'), { entry: true })
.bundle()
.pipe(....);
Parameters:
Name Type Description
file string

file whose content is to be transformed

Source:
Returns:

through stream

Type
TransformStream

generated with docme

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i commandify

Weekly Downloads

5

Version

0.1.2

License

MIT

Last publish

Collaborators

  • thlorenz