开发者社区> 镜像站> NPM> commandify
commandify
Executes a command whenever the bundle is created.
Last updated 7 years ago by thlorenz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install commandify 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.1.2                                ...           latest (7 years ago)

3 Versions

  • 0.1.2                                ...           7 years ago
  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (2)
Dependents (0)
None