Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

combohandler

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

combohandler - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

bin/cli.js

25

HISTORY.md
Combo Handler History
=====================
0.3.0 (2013-04-22)
------------------
* Removed `app.js` and `config.sample.js`. They served us well.
* Changed Travis script to also run code coverage, which is also now checked
against reasonable threshholds.
* Changed default `lib/server` to consume all available config for each route
in addition to the `rootPath`.
* Added CLI executable `combohandler` to replace the old `app.js`, among many,
many other things.
* Added new multi-process implementation built on top of `node` v0.8.x+ core
`cluster` module.
* Added oodles and oodles of tests.
* Added `mkdirp`, `nopt`, and `rimraf` dependencies.
* Updated `request` and `should` dependency versions.
* Updated package.json config with defaults for `port` and `server` options.
0.2.2 (2013-04-21)

@@ -5,0 +30,0 @@ ------------------

4

lib/server.js
var combo = require('./combohandler'),
merge = require('./utils').merge,
express = require('express');

@@ -43,3 +44,4 @@

for (route in roots) {
app.get(route, combo.combine({rootPath: roots[route]}), combo.respond);
// pass along all of config, overwriting rootPath
app.get(route, combo.combine(merge(config, {rootPath: roots[route]})), combo.respond);
}

@@ -46,0 +48,0 @@

{
"name" : "combohandler",
"description": "Simple Yahoo!-style combo handler.",
"version" : "0.2.2",
"version" : "0.3.0",
"keywords" : [

@@ -27,2 +27,4 @@ "combo", "combohandler", "combohandle", "combine", "cdn", "css", "yui"

"dependencies": {
"mkdirp" : "0.3.x",
"nopt" : "2.x",
"express": "3.2.x",

@@ -35,4 +37,5 @@ "URIjs" : "1.10.1"

"mocha" : "1.9.0",
"request": "~2.9",
"should" : "1.2.0"
"request": "2.x",
"rimraf": "~2.1.4",
"should" : "1.2.x"
},

@@ -42,7 +45,15 @@

"bin": "./bin/cli.js",
"directories": {"lib": "./lib"},
"config": {
"port": "8000",
"server": "./lib/server"
},
"scripts": {
"test": "istanbul test --print both ./node_modules/mocha/bin/_mocha"
"test": "istanbul test --print both ./node_modules/mocha/bin/_mocha",
"posttest": "istanbul check-coverage --statements 80 --functions 80 --branches 70 --lines 80"
}
}

@@ -161,19 +161,108 @@ Combo Handler

### Running the included standalone server
### From the command line
If you clone or download the GitHub repo, you can rename `config.sample.js` to
`config.js`, edit it to your liking, and then simply run `app.js` to start a
standalone server in development mode on port 8000.
If installed globally via `npm -g install`, the CLI executable `combohandler` is provided.
If you're operating from a local clone, `npm link` in the repository root and you're off to the races.
To start the default single-process server, it's as simple as
git clone git://github.com/rgrove/combohandler.git
cd combohandler
mv config.sample.js config.js
./app.js
```bash
combohandler
# combohandler now running until you hit Ctrl+C
```
Of course, the default output leaves something to be desired: that is to say, any output.
#### Root Configuration
At the very least, you need to provide some route-to-rootPath mappings for your CLI combohandler.
When passed in the `--rootsFile` option, the JSON file contents should follow this pattern:
```json
{
"roots": {
"/yui3": "/local/path/to/yui3"
}
}
```
When passed as individual `--root` parameters, the equivalent to the JSON above looks like this:
```bash
combohandler --root /yui3:/local/path/to/yui3 [...]
```
To run the standalone server in production mode, set the `NODE_ENV` variable to
`production` before running it:
NODE_ENV=production ./app.js
```bash
NODE_ENV=production combohandler --root /yui3:/path/to/yui3
```
#### CLI Usage
```txt
Usage: combohandler [options]
General Options:
-h, --help Output this text
-v, --version Prints combohandler's version
Combine Options:
-p, --port Port to listen on. [8000]
-a, --server Script that exports an Express app [combohandler/lib/server]
-r, --root String matching the pattern '{route}:{rootPath}'.
You may pass any number of unique --root configs.
-f, --rootsFile Path to JSON routes config, *exclusive* of --root.
-b, --basePath Path to prepend when rewriting relative url()s. ['']
-m, --maxAge 'Cache-Control' and 'Expires' value, in seconds. [31536000]
Set this to `0` to expire immediately, `null` to omit these
headers entirely.
Cluster Options:
--cluster Enable clustering of server across multiple processes.
-d, --pids Directory where pidfiles are stored. [$PREFIX/var/run]
-n, --workers Number of worker processes. [os.cpus.length, max 8]
-t, --timeout Timeout (in ms) for process startup/shutdown. [5000]
--restart Restart a running master's worker processes. (SIGUSR2)
--shutdown Shutdown gracefully, allows connections to close. (SIGTERM)
--status Logs status of master and workers.
--stop Stop server abruptly, not waiting for connections. (SIGKILL)
```
The `--port` and `--server` options may also be set via npm package config settings:
npm -g config set combohandler:port 2702
npm -g config set combohandler:server /path/to/server.js
Unlike the `--server` option, a path specified in this manner *must* be absolute.
### Clustered!
With the advent of `node` v0.8.x, the core `cluster` module is now usable, and `combohandler` now regains the capability it once had. Huzzah! said the villagers.
To run a clustered combohandler from the CLI, just add the `--cluster` flag:
```bash
combohandler --cluster --root /yui3:/path/to/yui3
```
To clusterize combohandler from a module dependency, `combohandler/lib/cluster` is your friend:
```js
var comboCluster = require('combohandler/lib/cluster');
var app = comboCluster({
pids: '/path/to/piddir',
server: './myserver.js',
roots: {
'/yui3': '/local/path/to/yui3'
}
});
app.listen(2702);
```
Optional Middleware
-------------------
### Rewriting URLs in CSS files

@@ -259,2 +348,3 @@

Using as a YUI 3 combo handler

@@ -261,0 +351,0 @@ ------------------------------

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc