Skip to content

Commit de56286

Browse files
committed
Refactor cli to not exec npm start
This will make the output a bit nicer and after the reason refactoring for realtime it is not necessary to call micro.
1 parent ddcf371 commit de56286

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
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: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@
1515
"node": ">=6.0.0"
1616
},
1717
"scripts": {
18-
"start": "node dist/index.js",
18+
"start": "./cli.js",
1919
"build": "./node_modules/.bin/async-to-gen src --out-dir dist",
2020
"prepublish": "npm run build",
2121
"dev": "NODE_ENV=development nodemon --config package.json --exec async-node src/index.js",
2222
"test": "jest"
2323
},
24+
"jest": {
25+
"collectCoverageFrom": [
26+
"src/**/*.js"
27+
]
28+
},
2429
"author": "Max Stoiber <[email protected]> (http://mxstbr.com/)",
2530
"license": "MIT",
2631
"repository": "https://github.com/mxstbr/micro-analytics",
@@ -44,13 +49,5 @@
4449
"jest": "^19.0.2",
4550
"nodemon": "^1.11.0",
4651
"request-promise": "^4.1.1"
47-
},
48-
"execMap": {
49-
"js": "micro"
50-
},
51-
"jest": {
52-
"collectCoverageFrom": [
53-
"src/**/*.js"
54-
]
5552
}
5653
}

0 commit comments

Comments
 (0)