Skip to content

Commit 4e8172d

Browse files
authored
Merge pull request #52 from micro-analytics/refactor-cli
Refactor cli to not exec npm start
2 parents ddcf371 + d6c618d commit 4e8172d

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

cli.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ const pkg = require('./package.json');
66

77
updateNotifier({ pkg }).notify();
88

9-
exec('npm start -- ' + process.argv.join(' '), {
10-
async: true,
11-
cwd: __dirname
12-
})
9+
const supportsAsyncAwait = parseInt(process.version.slice(1).split('.').join('')) > 760
10+
11+
const microAnalytics = supportsAsyncAwait ? './src/index' : './dist/index'
12+
13+
require(microAnalytics)

package.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,26 @@
77
},
88
"files": [
99
"dist",
10+
"src",
1011
"cli.js",
11-
"adapter-tests"
12+
"adapter-tests/unit-tests.js"
1213
],
1314
"engineStrict": true,
1415
"engines": {
1516
"node": ">=6.0.0"
1617
},
1718
"scripts": {
18-
"start": "node dist/index.js",
19+
"start": "./cli.js",
1920
"build": "./node_modules/.bin/async-to-gen src --out-dir dist",
2021
"prepublish": "npm run build",
2122
"dev": "NODE_ENV=development nodemon --config package.json --exec async-node src/index.js",
2223
"test": "jest"
2324
},
25+
"jest": {
26+
"collectCoverageFrom": [
27+
"src/**/*.js"
28+
]
29+
},
2430
"author": "Max Stoiber <[email protected]> (http://mxstbr.com/)",
2531
"license": "MIT",
2632
"repository": "https://github.com/mxstbr/micro-analytics",
@@ -44,13 +50,5 @@
4450
"jest": "^19.0.2",
4551
"nodemon": "^1.11.0",
4652
"request-promise": "^4.1.1"
47-
},
48-
"execMap": {
49-
"js": "micro"
50-
},
51-
"jest": {
52-
"collectCoverageFrom": [
53-
"src/**/*.js"
54-
]
5553
}
5654
}

0 commit comments

Comments
 (0)