forked from panaverse/learn-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
46 lines (46 loc) · 3.6 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
"name": "flagged-respawn",
"description": "A tool for respawning node binaries when special flags are present.",
"version": "0.3.1",
"homepage": "https://github.com/tkellen/node-flagged-respawn",
"author": {
"name": "Tyler Kellen",
"url": "http://goingslowly.com/"
},
"repository": {
"type": "git",
"url": "git://github.com/tkellen/node-flagged-respawn.git"
},
"bugs": {
"url": "https://github.com/tkellen/node-flagged-respawn/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/tkellen/node-flagged-respawn/blob/master/LICENSE"
}
],
"scripts": {
"respawn": "node test/bin/respawner --harmony test",
"nospawn": "node test/bin/respawner test",
"test": "mocha -R spec test"
},
"main": "index.js",
"engines": {
"node": ">= 0.8.0"
},
"keywords": [
"respawn flags"
],
"devDependencies": {
"chai": "~1.9.1",
"mocha": "~1.21.4",
"v8flags": "~1.0.1"
},
"readme": "# flagged-respawn [![Build Status](https://secure.travis-ci.org/tkellen/node-flagged-respawn.png)](http://travis-ci.org/tkellen/node-flagged-respawn)\n> A tool for respawning node binaries when special flags are present.\n\n[![NPM](https://nodei.co/npm/flagged-respawn.png)](https://nodei.co/npm/flagged-respawn/)\n\n## What is it?\n\nSay you wrote a command line tool that runs arbitrary javascript (e.g. task runner, test framework, etc). For the sake of discussion, let's pretend it's a testing harness you've named `testify`.\n\nEverything is going splendidly until one day you decide to test some code that relies on a feature behind a v8 flag in node (`--harmony`, for example). Without much thought, you run `testify --harmony spec tests.js`.\n\nIt doesn't work. After digging around for a bit, you realize this produces a [`process.argv`](http://nodejs.org/docs/latest/api/process.html#process_process_argv) of:\n\n`['node', '/usr/local/bin/test', '--harmony', 'spec', 'tests.js']`\n\nCrap. The `--harmony` flag is in the wrong place! It should be applied to the **node** command, not our binary. What we actually wanted was this:\n\n`['node', '--harmony', '/usr/local/bin/test', 'spec', 'tests.js']`\n\nFlagged-respawn fixes this problem and handles all the edge cases respawning creates, such as:\n- Providing a method to determine if a respawn is needed.\n- Piping stderr/stdout from the child into the parent.\n- Making the parent process exit with the same code as the child.\n- If the child is killed, making the parent exit with the same signal.\n\nTo see it in action, clone this repository and run `npm install` / `npm run respawn` / `npm run nospawn`.\n\n## Sample Usage\n\n```js\n#!/usr/bin/env node\n\nconst flaggedRespawn = require('flagged-respawn');\n\n// get a list of all possible v8 flags for the running version of node\nconst v8flags = require('v8flags').fetch();\n\nflaggedRespawn(v8flags, process.argv, function (ready, child) {\n if (ready) {\n console.log('Running!');\n // your cli code here\n } else {\n console.log('Special flags found, respawning.');\n }\n if (process.pid !== child.pid) {\n console.log('Respawned to PID:', child.pid);\n }\n});\n\n```\n\n## Release History\n\n* 2014-09-12 - v0.3.1 - use `{ stdio: 'inherit' }` for spawn to maintain colors\n* 2014-09-11 - v0.3.0 - for real this time\n* 2014-09-11 - v0.2.0 - cleanup\n* 2014-09-04 - v0.1.1 - initial release\n",
"readmeFilename": "README.md",
"_id": "flagged-respawn@0.3.1",
"_shasum": "397700925df6e12452202a71e89d89545fbbbe9d",
"_resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-0.3.1.tgz",
"_from": "flagged-respawn@>=0.3.1 <0.4.0"
}