jproxy
Proxy while applying amazing transformations
Usage
Command Line
Installation:
$ npm install jproxy -g
Usage:
$ jproxy
Configuration:
See "Proxy Configuration"
API
Installation:
$ npm install jproxy
Usage:
var jproxy = ;var express = ;var app = ; var config = browserify: true;//see "Proxy Configuration" for more infoapp; app;
Proxy Configuration
The Proxy Configuration must be a JSON object.
Where can I put the proxy configuration?
If you're using the API you pass it in: jproxy(dirname, config)
. If you're using the command line you can put it in one of three places.
If you're using the command line interface you can put it in any of the following locations (in this order of precedence).
.jproxy.json
"jproxy"
property inpackage.json
"jproxy"
property incomponent.json
If you're using this in jepso-ci you can put it in any of the 3 locations above, or you can put it in any of the 3 locations below. The ones below take precence:
"proxy"
property in.jepxo-ci.json
"proxy"
property in"jepso-ci"
object inpackage.json
"proxy"
property in"jepso-ci"
object incomponent.json
What does a configuration look like
Each property of the object must correspond to one of the possible jproxy filters. The value of such a proxy must be a FilterConfiguration
or array of FilterConfiguration
s. e.g.
"browserify": "include": "*.js" "exclude": "*mocha.js" "options" "transform": "coffeeify" "uglify-js": "include": "*.js" "exclude": "*.min.js" "options" "beautify": true "include": "*.min.js" "options" "beautify": false
Filter Configuration
The filter configuration is an object which defines when the filter is applied, and how it is applied.
The Filter Configuration consists of the following 3 properties.
- include
- exclude
- options
include
Include specifies which files to filter. It can be a string, or an array of strings. If the path contains a *
it is treated as "any character one or more times". If the path begins with a /
character, the whole path is required to match. If it begins with anything else it is assumed to just require the end of the path to match.
The filter may define a default include
pattern. If it doesn't, the default will simply be "*".
e.g.
Pattern | Value | Matches |
---|---|---|
"/build/build.js" | "/build/build.js" | TRUE |
"/build/build.js" | "/lib/build/build.js" | FALSE |
"build/build.js" | "/build/build.js" | TRUE |
"build/build.js" | "/lib/build/build.js" | TRUE |
"/build/build.js" | "/build/foo.js" | FALSE |
"/build/*.js" | "/lib/build/foo.js" | TRUE |