ajaxorg/cloud9 — pull request #1452 by mattpardee (2012-05-09 01:16:07+00:00)
Title: Feature/clinpm

**This is a WIP**

The server-side NPM extension uses the node Runner to run NPM modules. When the client is refreshed it assumes the running state of the node Runner means there is a file being run, and thus displays the "Run/Debug" button in its stopped state.

Ideally we will have the ability to spawn both regular run processes and NPM module processes from the same Runner. @fjakobs or @janjongboom I hope you can shed light on this possibility or the idea of adding a new runner to the mix.

That said:

This PR adds the ability to run NPM modules from the CLI. It searches the root node_modules directory, and if it finds the command entered in the `bin` field of the `package.json` file, it will execute the file in that path. Take this package.json file from `express`:

````javascript
{
"name": "express",
"description": "Sinatra inspired web development framework",
"version": "2.5.8",
"author": "TJ Holowaychuk ",
/* .... */
"repository": "git://github.com/visionmedia/express",
"main": "index",
"bin": { "express": "./bin/express" },
"scripts": {
"test": "make test",
"prepublish" : "npm prune"
},
"engines": { "node": ">= 0.4.1 < 0.7.0" }
}
````

If "express" is entered into the CLI, it is found in the package.json file and `./bin/express` is executed with the Node Runner. This puts the CLI into a state with "express" as the prompt, and any entry to the CLI is written to the process STDIN.

This PR also:

* Recreates the process output blocks after the client refreshes; if you Run/Debug a file, then refresh, that output block is recreated in the Output tab along with the spinner and output is placed into that section
* Fixes some issues with Console Hints (https://github.com/ajaxorg/cloud9infra/issues/1008)
* Fixes buffer issues caused by running many processes very quickly (via the test panel, for example)