-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathindex.js
35 lines (31 loc) · 870 Bytes
/
index.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
const rimraf = require('rimraf')
const ora = require('ora')
const minimist = require('minimist')
const timeout = require('./lib/timeout')
const randomInt = require('./lib/randomInt')
const args = minimist(process.argv.slice(2))
const pathToDelete = args.path || process.cwd()
const steps = [
'Searching for code smell source',
'Analyzing code base',
'Searching optimal solution',
'Preparing internal tools'
]
;(() => {
const spinner = ora().start()
function nextStage() {
return timeout(() => {
spinner.succeed(steps.splice(0, 1)).frame()
}, randomInt(250, 1500))
}
return nextStage()
.then(nextStage)
.then(nextStage)
.then(nextStage)
.then(() => timeout(() => {
rimraf(pathToDelete, () => {
console.info('All bad code is cleared! 😎')
})
process.exit(0)
}, randomInt(1000, 2500)))
})()