mysticatea / cpx

A cli tool to watch and copy file globs.
MIT License
524 stars 36 forks source link

Initial copy #13

Closed tjconcept closed 8 years ago

tjconcept commented 8 years ago

Maybe I am doing something wrong, but I miss an option for having the program watch a directory and copy everything over initially. Currently I run the command twice; with and without --watch.

mysticatea commented 8 years ago

Thank you for this issue.

Hmm, cpx does copy files then start watching files. For example, on this repo:

C:\Users\t-nagashima.AD\Documents\GitHub\cpx [master]> cpx src/**/*.js aaa --watch --verbose
Copied: src/command.js --> aaa/command.js
Copied: src/copy.js --> aaa/copy.js
Copied: src/cpx.js --> aaa/cpx.js
Copied: src/index.js --> aaa/index.js
Copied: src/queue.js --> aaa/queue.js
Copied: src/utils.js --> aaa/utils.js

Be watching in src

This behavior relies on chokidar. chokidar emits "add" events while initialization by default: https://github.com/paulmillr/chokidar#path-filtering

tjconcept commented 8 years ago

Oh, seems like the problem was caused by ./ in front of source and destination paths e.g. ./src/**/*.js - how can that be? Is it expected?

mysticatea commented 8 years ago

Ouch, that's a bug!