files-extractor
Advanced tools
Comparing version 0.0.2 to 0.0.3
21
index.js
@@ -11,2 +11,3 @@ /*! | ||
const ora = require('ora'); | ||
const glob = require('glob'); | ||
@@ -16,6 +17,7 @@ const path = require('path'); | ||
const yaml = require('js-yaml'); | ||
const colors = require('colors'); | ||
const chalk = require('chalk'); | ||
const utils = require('./lib/utils'); | ||
const async = require('./lib/async'); | ||
const ProgressBar = require('progress'); | ||
const spinners = require('cli-spinners'); | ||
@@ -58,2 +60,5 @@ const CWD = utils.CWD; | ||
const searching = chalk.reset.green.bold('Searching'); | ||
const load = ora({ stream: process.stdout, spinner: spinners.line }); | ||
function FilesExtractor(options) { | ||
@@ -79,5 +84,9 @@ this.options = options; | ||
extract: function() { | ||
load.start(); | ||
let options = this.options; | ||
glob(options.files, { root: CWD, dot: options.dot, nodir: true, ignore: options.ignore }, function(error, files) { | ||
load.stop(); | ||
if (error) { | ||
@@ -89,3 +98,3 @@ return process.stderr.write(error); | ||
let extracting = colors.reset.green.bold('Extracting'); | ||
let extracting = chalk.reset.green.bold('Extracting'); | ||
let fmt = `${ extracting }: [:bar] (:current/:total) :percent - :file`; | ||
@@ -96,3 +105,3 @@ let bar = new ProgressBar(fmt, { width: 30, clear: true, total: files.length, stream: process.stdout, head: '>' }); | ||
fs.copy(file, dest(file, options), { preserveTimestamps: true }, function(error) { | ||
bar.tick({ file: colors.reset.cyan.bold(file) }); | ||
bar.tick({ file: chalk.reset.cyan.bold(file) }); | ||
@@ -103,3 +112,3 @@ if (error) { | ||
bar.interrupt(`${ extracting }: ${ syscall } ${ colors.reset.red.bold(file) } ${ code }!`); | ||
bar.interrupt(`${ extracting }: ${ syscall } ${ chalk.reset.red.bold(file) } ${ code }!`); | ||
} | ||
@@ -112,5 +121,7 @@ | ||
process.stdout.write(colors.reset.green.bold(message)); | ||
process.stdout.write(chalk.reset.green.bold(message)); | ||
process.exit(); | ||
}); | ||
}).on('match', function(file) { | ||
load.text = `${ searching }: ${ chalk.reset.cyan.bold(file) }`; | ||
}); | ||
@@ -117,0 +128,0 @@ |
{ | ||
"name": "files-extractor", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Extract files that have changed between the specified date.", | ||
@@ -38,3 +38,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"colors": "^1.1.2", | ||
"ora": "^1.3.0", | ||
"commander": "^2.11.0", | ||
@@ -41,0 +41,0 @@ "fs-extra": "^4.0.2", |
Sorry, the diff of this file is not supported yet
13109
194
+ Addedora@^1.3.0
+ Addedcli-spinners@1.3.1(transitive)
+ Addedlog-symbols@2.2.0(transitive)
+ Addedora@1.4.0(transitive)
- Removedcolors@^1.1.2
- Removedcolors@1.4.0(transitive)