Skip to content

Commit 4d7c6df

Browse files
committed
feat: add the command clean cache
resolve #25
1 parent 5d74d50 commit 4d7c6df

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

bin/clean

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env node
2+
const rimraf = require('rimraf')
3+
const paths = require('../src/paths')
4+
const { promisify } = require('util')
5+
6+
7+
const rm = promisify(rimraf)
8+
9+
module.exports = async () => {
10+
await rm(paths.templates)
11+
}

bin/mili

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const log = require('../src/log')
77
const init = require('./init')
88
const upgrade = require('./upgrade')
99
const update = require('./update')
10+
const clean = require('./clean')
1011
const { version } = require('../package.json')
1112

1213

@@ -50,6 +51,16 @@ program
5051
.catch(err => log.error('program', 'update break', err))
5152
})
5253

54+
program
55+
.command('clean')
56+
.description('Clean the cache of mili')
57+
.action(() => {
58+
log.info('begin clean')
59+
clean()
60+
.then(() => log.info('clean complete'))
61+
.catch(err => log.error('clean', 'clean break', err))
62+
})
63+
5364

5465
// error on unknown commands
5566
program.on('command:*', function () {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"cosmiconfig": "^5.0.6",
4848
"merge-deep": "^3.0.2",
4949
"mustache": "^3.0.0",
50+
"rimraf": "^2.6.2",
5051
"sanitization": "^0.3.0",
5152
"semver": "^5.6.0",
5253
"simple-git": "^1.104.0"

0 commit comments

Comments
 (0)