Skip to content

Commit

Permalink
feat: support verbose in --clean
Browse files Browse the repository at this point in the history
  • Loading branch information
Darío Javier Cravero committed May 28, 2019
1 parent baf1edd commit dc71965
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import deleteEmpty from 'delete-empty'
import glob from 'fast-glob'
import path from 'path'

export default async function clean(src) {
export default async function clean(src, verbose) {
let morphed = await glob(['**/*.view.js', `Fonts/*.js`, 'use-flow.js'], {
bashNative: ['linux'],
cwd: src,
Expand All @@ -12,11 +12,13 @@ export default async function clean(src) {

await Promise.all(
morphed.map(f => {
console.log(`x ${f}`)
verbose && console.log(`x ${f}`)
return fs.unlink(path.join(src, f))
})
)

let deleted = await deleteEmpty(src)
deleted.forEach(d => console.log(`x ${d}`))
if (verbose) {
deleted.forEach(d => console.log(`x ${d}`))
}
}
2 changes: 1 addition & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ import watch from './watch.js'

if (clean) {
console.log(`Cleaning up ${input}...`)
await cleanup(input)
await cleanup(input, verbose)
process.exit()
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@viewstools/morph",
"version": "19.0.0",
"version": "19.0.1",
"description": "Views language morpher",
"main": "index.js",
"type": "module",
Expand Down

0 comments on commit dc71965

Please sign in to comment.