Skip to content

Commit

Permalink
feat: show progress in CLI verbose mode
Browse files Browse the repository at this point in the history
closes #180
  • Loading branch information
tricoder42 committed Jul 22, 2018
1 parent c265dd4 commit 0cbbc54
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"make-plural": "^4.1.1",
"messageformat-parser": "^2.0.0",
"mkdirp": "^0.5.1",
"ora": "^3.0.0",
"ramda": "^0.25.0",
"typescript": "^2.9.2"
},
Expand Down
9 changes: 7 additions & 2 deletions packages/cli/src/api/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import fs from "fs"
import path from "path"
import chalk from "chalk"
import ora from "ora"
import R from "ramda"

import * as extractors from "./extractors"
Expand Down Expand Up @@ -40,11 +41,15 @@ export function extract(

const extracted = R.values(extractors).some((ext: ExtractorType) => {
if (!ext.match(srcFilename)) return false

let spinner
if (verbose) spinner = ora().start(srcFilename)

ext.extract(srcFilename, targetPath, options.babelOptions)
if (verbose && spinner) spinner.succeed()

return true
})

if (extracted && verbose) console.log(chalk.green(srcFilename))
})
}

Expand Down
11 changes: 11 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4497,6 +4497,17 @@ ora@^2.1.0:
strip-ansi "^4.0.0"
wcwidth "^1.0.1"

ora@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ora/-/ora-3.0.0.tgz#8179e3525b9aafd99242d63cc206fd64732741d0"
dependencies:
chalk "^2.3.1"
cli-cursor "^2.1.0"
cli-spinners "^1.1.0"
log-symbols "^2.2.0"
strip-ansi "^4.0.0"
wcwidth "^1.0.1"

os-browserify@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27"
Expand Down

0 comments on commit 0cbbc54

Please sign in to comment.