jproxy

Proxy while applying amazing transformations

jproxy

Proxy while applying amazing transformations

The Proxy Configuration must be a JSON object.

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).

  1. .jproxy.json
  2. "jproxy" property in package.json
  3. "jproxy" property in component.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:

  1. "proxy" property in .jepxo-ci.json
  2. "proxy" property in "jepso-ci" object in package.json
  3. "proxy" property in "jepso-ci" object in component.json

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 FilterConfigurations. 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
      }
    }
  ]
}

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 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

Exclude can again be a string, or an array of strings. It overrides include so if a path matches exclude it won't be filtered even if it matches include. By default, everything is excluded.

Options is a JSON object, it's meaning is specific to the individual filter. If omitted the filter will define defaults.