Giter Site home page Giter Site logo

copy-and-watch's People

Contributors

aquaticat avatar arnarthor avatar mugli avatar thecomputerm avatar zont avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

copy-and-watch's Issues

(node:43172) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE

I got an error with this command: "filecopy":"copy-and-watch --watch templates/files/media/**/*.{css,js} zzz/dist/"

[WATCH] templates/files/media/**/*.{css,js}
(node:43172) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "from" argument must be of type string. Received undefined
at validateString (internal/validators.js:124:11)
at Object.relative (path.js:492:5)
at findTarget (E:\wamp64\www\j41rbs5\node_modules\copy-and-watch\index.js:40:33)
at FSWatcher.copy (E:\wamp64\www\j41rbs5\node_modules\copy-and-watch\index.js:60:14)
at FSWatcher.emit (events.js:400:28)
at FSWatcher.emitWithAll (E:\wamp64\www\j41rbs5\node_modules\copy-and-watch\node_modules\chokidar\index.js:540:8)
at FSWatcher._emit (E:\wamp64\www\j41rbs5\node_modules\copy-and-watch\node_modules\chokidar\index.js:632:8)
at listener (E:\wamp64\www\j41rbs5\node_modules\copy-and-watch\node_modules\chokidar\lib\nodefs-handler.js:370:20)
(Use node --trace-warnings ... to show where the warning was created)
(node:43172) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:43172) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Hope you can fix this!

Thanks in advance!

different target after initial copy

My command:
copy-and-watch --watch src/cms/templates/**/* src/static/**/* dist/site/templates

When the script starts, the first file is copied like this:
[COPY] src/cms/templates/basic-page.php to dist-pw\site\templates\basic-page.php

This is the desired result.

But after the initial copy, when I change this file, the whole structure after src is replicated:
[COPY] src\cms\templates\basic-page.php to dist-pw\site\templates\cms\templates\basic-page.php

TypeError: Path must be a string. Received undefined

Hi, I'm having trouble using --watch, I'm running this:

npm run watch

with

"watch": "copy-and-watch ./src/public/**/*.{html,css} ./build --watch"

and getting this result when I make a change to src/public/panel.html and save:

> [email protected] watch /Users/alex/dev/is/r2
> copy-and-watch ./src/public/**/*.{html,css} ./build --watch

[COPY] ./src/public/panel.html to build/panel.html
[COPY] ./src/public/panel.css to build/panel.css
[WATCH] ./src/public/**/*.html
[WATCH] ./src/public/**/*.css
path.js:28
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:28:11)
    at Object.relative (path.js:1268:5)
    at findTarget (/Users/alex/dev/is/r2/node_modules/copy-and-watch/index.js:37:33)
    at FSWatcher.copy (/Users/alex/dev/is/r2/node_modules/copy-and-watch/index.js:57:14)
    at emitOne (events.js:115:13)
    at FSWatcher.emit (events.js:210:7)
    at FSWatcher.<anonymous> (/Users/alex/dev/is/r2/node_modules/chokidar/index.js:196:15)
    at FSWatcher._emit (/Users/alex/dev/is/r2/node_modules/chokidar/index.js:238:5)
    at FSWatcher.<anonymous> (/Users/alex/dev/is/r2/node_modules/chokidar/lib/fsevents-handler.js:204:14)
    at addOrChange (/Users/alex/dev/is/r2/node_modules/chokidar/lib/fsevents-handler.js:210:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] watch: `copy-and-watch ./src/public/**/*.{html,css} ./build --watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/alex/.npm/_logs/2018-01-22T04_06_25_666Z-debug.log

Add --exclude argument

Would be nice to add a --exclude pattern argument to exclude for example .DS_Store files or folder from the copy/watch

watch crashes on folder deletion

if I do copy-and-watch --watch some/folder/**/* target/ copy-and-watch crashes if I delete some subfolder of some/folder/. In my opinion this is just a simple change that needs to mirrored.

Folders don't appear to be mirrored

I'm running this command:

copy-and-watch src/public/**/*.{html,css,jpg,png} build

with this result:

[COPY] src/public/panel.html to build/panel.html
[COPY] src/public/panel.css to build/panel.css
[COPY] src/public/icons/icon128.png to build/icon128.png
[COPY] src/public/icons/icon16.png to build/icon16.png
[COPY] src/public/icons/icon19.png to build/icon19.png
[COPY] src/public/icons/icon48.png to build/icon48.png

I expected the png files to end up in build/icon not build

Copy files initially

From the small docs, I can see it should copy the files initially, but it doesn't for me. it only does when a file has changes, and one by one. Is this because they are folders, rather than singular files?

copy-and-watch --watch packages/* web/src & copy-and-watch --watch packages/* mobile/src

symlink support?

I am using npm link for developing dependency alongside main app.

Unfortunately copy-and-watch --watch src/**/*.{html,css,js,svg,png} dist/ does not find files inside a symlink.

Is there any solution to that?

How to copy the directory itself and not the files within it?

If I do copy-and-watch --watch assets/ dist/ it will copy nothing, while I expect the assets/ folder to be copied. Also if I do copy-and-watch --watch assets/* dist/ It will copy the files inside the assets folder and not itself. Is it possible to copy and watch a directory itself?

--watch not working on file rename?

I tried to rename a file and got these errors:

(node:20668) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "from" argument must be of type string. Received undefined
    at validateString (internal/validators.js:120:11)
    at Object.relative (path.js:437:5)
    at findTarget (...\node_modules\copy-and-watch\index.js:40:33)
    at FSWatcher.copy (...\node_modules\copy-and-watch\index.js:60:14)
    at FSWatcher.emit (events.js:315:20)
    at FSWatcher.emitWithAll (...\node_modules\chokidar\index.js:524:8)
    at FSWatcher._emit (...\node_modules\chokidar\index.js:616:8)
    at NodeFsHandler._handleFile (...\node_modules\chokidar\lib\nodefs-handler.js:400:14)
    at NodeFsHandler._addToNodeFs (...\node_modules\chokidar\lib\nodefs-handler.js:628:21)
(node:20668) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:20668) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
internal/validators.js:120
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "from" argument must be of type string. Received undefined
    at validateString (internal/validators.js:120:11)
    at Object.relative (path.js:437:5)
    at findTarget (...\node_modules\copy-and-watch\index.js:40:33)
    at FSWatcher.remove (...\node_modules\copy-and-watch\index.js:70:14)
    at FSWatcher.emit (events.js:315:20)
    at ...\node_modules\chokidar\index.js:565:16
    at Map.forEach (<anonymous>)
    at Timeout._onTimeout (...\node_modules\chokidar\index.js:564:30)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7) {
  code: 'ERR_INVALID_ARG_TYPE'
}

XML file paths are ignored

Its working fine, except for XML files. For all other files it keeps the relative path from source folder and copies over. But XML in any sub-dir is being copied to root target dir only.

Command used: copy-and-watch --watch /mypath/**/*.{aspx,Master,asax,css,js,png,jpg,xml,gif,otf,eot,ttf,woff} /home/web/targetdir

If i run this command with *.{xml} only it sync the xml files with proper path. But not in combination with other suffixes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.