-
Notifications
You must be signed in to change notification settings - Fork 0
/
reset.js
40 lines (29 loc) · 1.17 KB
/
reset.js
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
37
38
39
40
#!/usr/bin/env node
const fs = require('fs')
const { resetDefaultBranch } = require('./src/resetDefaultBranch')
const { calculateDates } = require('./src/calculateDates')
function main() {
// handle args
let args = process.argv
let isVerbose = args.indexOf('--verbose') > -1 || args.indexOf('-v') > -1
if (isVerbose) { console.log('running in verbose mode') }
let shouldStopAfterCalc = args.indexOf('--calc') > -1 || args.indexOf('-c') > -1
if (isVerbose && shouldStopAfterCalc) { console.log('running in calc only mode') }
let abolishIcePixels = calculateDates(isVerbose)
fs.unlinkSync('pixels.txt')
fs.writeFile(
'pixels.txt',
abolishIcePixels,
function (err) {
if (err) throw err
})
if (isVerbose) { console.log('finished calculating new ABOLISH ICE pixel dates')}
if (shouldStopAfterCalc) {
return
}
resetDefaultBranch(isVerbose, 'main', 'develop')
// if make it this far sans errors, should just run paint.sh?
// if so, log warning that it may take 5-20min depending on machine.
console.log('finished resetting state. safe to run `./paint.sh` now.')
}
main()