Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbin.js
More file actions
Latest commit
36 lines (30 loc) · 938 Bytes
/
Copy pathbin.js
File metadata and controls
36 lines (30 loc) · 938 Bytes
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
#! /usr/bin/env node
constargs=require('minimist')(process.argv)
const{ resolve, dirname }=require('path')
constfs=require('fs')
constConfig=require('./config')
constUpload=require('./upload')
constlogger=require('./logger')
conststatsFilePath=resolve(args['stats'])
constoutputPath=args['output-path']||dirname(statsFilePath)
letstats
try{
logger(`retrieving stats from ${statsFilePath}`)
stats=JSON.parse(fs.readFileSync(statsFilePath,'utf8'))
}catch(err){
logger('there was a problem reading your stats file.')
console.error(err)
process.exit(1)
}
constconfig=newConfig({upload: true,fail_build: true})
constupload=newUpload(config)
upload.process(stats,outputPath)
.then(()=>{
logger('stats uploaded successfully')
process.exit(0)
})
.catch((err)=>{
logger('there was a problem uploading your stats.')
console.error(err)
process.exit(1)
})