Skip to content

Executes a command whenever the bundle is created.

License

Notifications You must be signed in to change notification settings

thlorenz/commandify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Executes a command whenever the bundle is created.

Resources

License

Stars

Watchers

Forks

Packages

No packages published