forked from normalize/autoinstall
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env node | ||
|
||
var autoinstall = require.resolve('..') | ||
|
||
var args = process.argv.slice(2) | ||
|
||
var options = [] | ||
args = args.filter(function (arg) { | ||
if (arg[0] === '-') { | ||
options.push(arg) | ||
return false | ||
} | ||
return true | ||
}) | ||
|
||
if (args.length > 1) { | ||
throw new Error('more than 1 argument supplied') | ||
} | ||
|
||
var path = require('path') | ||
var file = path.resolve(args[0]) | ||
|
||
options.push('-e', | ||
"require('" + autoinstall + "');" + | ||
"require('" + file + "');" | ||
) | ||
|
||
var spawn = require('child_process').spawn | ||
var proc = spawn('node', options, { | ||
customFds: [0, 1, 2] | ||
}) | ||
|
||
proc.on('exit', function (code) { | ||
process.exit(code) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,5 +18,6 @@ | |
}, | ||
"engines": { | ||
"node": ">= 0.11.13" | ||
} | ||
}, | ||
"bin": "bin/autoinstall" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
require('koa') | ||
console.log('koa passed!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters