Skip to content

Commit 035462d

Browse files
committed
feat: separate cli and nodeAPI
1 parent 41251ff commit 035462d

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

cli.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#! /usr/bin/env node
2+
var rc = require('./index')
3+
4+
console.log(JSON.stringify(rc(process.argv[2]), false, 2))

index.js

-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#! /usr/bin/env node
21
var cc = require('./lib/utils')
32
var join = require('path').join
43
var deepExtend = require('deep-extend')
@@ -52,9 +51,3 @@ module.exports = function (name, defaults, argv, parse) {
5251
configFiles.length ? {configs: configFiles, config: configFiles[configFiles.length - 1]} : undefined,
5352
]))
5453
}
55-
56-
if(!module.parent) {
57-
console.log(
58-
JSON.stringify(module.exports(process.argv[2]), false, 2)
59-
)
60-
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"unix",
1919
"defaults"
2020
],
21-
"bin": "./index.js",
21+
"bin": "./cli.js",
2222
"author": "Dominic Tarr <dominic.tarr@gmail.com> (dominictarr.com)",
2323
"dependencies": {
2424
"deep-extend": "~0.4.0",

0 commit comments

Comments
 (0)