{"id":13526926,"url":"https://github.com/AndyOGo/node-sync-glob","last_synced_at":"2025-04-01T08:30:38.900Z","repository":{"id":12760498,"uuid":"72730052","full_name":"AndyOGo/node-sync-glob","owner":"AndyOGo","description":"Synchronize files and folders locally by glob patterns, watch option included.","archived":false,"fork":false,"pushed_at":"2023-01-25T06:07:08.000Z","size":163,"stargazers_count":19,"open_issues_count":24,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T09:41:47.809Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndyOGo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-03T09:36:48.000Z","updated_at":"2023-01-19T07:14:03.000Z","dependencies_parsed_at":"2023-02-14T05:16:51.443Z","dependency_job_id":null,"html_url":"https://github.com/AndyOGo/node-sync-glob","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndyOGo%2Fnode-sync-glob","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndyOGo%2Fnode-sync-glob/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndyOGo%2Fnode-sync-glob/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndyOGo%2Fnode-sync-glob/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndyOGo","download_url":"https://codeload.github.com/AndyOGo/node-sync-glob/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246607097,"owners_count":20804515,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:01:37.675Z","updated_at":"2025-04-01T08:30:38.566Z","avatar_url":"https://github.com/AndyOGo.png","language":"JavaScript","readme":"# node-sync-glob\n\n[![Build Status](https://travis-ci.org/AndyOGo/node-sync-glob.svg?branch=master)](https://travis-ci.org/AndyOGo/node-sync-glob)\n\n[![Build status](https://ci.appveyor.com/api/projects/status/9i48hbtrfsy5sk1m/branch/master?svg=true)](https://ci.appveyor.com/project/AndyOGo/node-sync-glob/branch/master)\n\nSynchronize files and folders locally by glob patterns, watch option included.\n\n## Install\n\n```sh\nnpm i sync-glob\n```\n\n## Usage\n\n```sh\nUsage: bin/sync-glob.js \u003csources\u003e \u003ctarget\u003e\n\nCommands:\n  sources  One or more globs, files or directories to be mirrored (glob\n           exclusions are supported as well - ! prefix)\n  target   Destination folder for mirrored files\n\nOptions:\n  --version            Show version number                             [boolean]\n  --help               Show help                                       [boolean]\n  -d, --delete         Delete extraneous files from target\n                                                       [boolean] [default: true]\n  -w, --watch          Watch changes in sources and keep target in sync\n                                                      [boolean] [default: false]\n  -i, --depth          Maximum depth if you have performance issues (not\n                       everywhere yet: only on existing mirrors and watch\n                       scenario)                    [number] [default: Infinity]\n  -t, --transform      A module name to transform each file. sync-glob lookups\n                       the specified name via \"require()\".              [string]\n  -e, --exit-on-error  Exit if an error occurred                 [default: true]\n  -v, --verbose        Moar output                    [boolean] [default: false]\n  -s, --silent         No output (except errors)                [default: false]\n\ncopyright 2016\n```\n\n### In your `package.json`\n\nYou may have some build script in your package.json involving mirroring folders (let's say, static assets), that's a good use-case for `sync-glob`:\n\n```js\n// Before\n{\n  \"scripts\": {\n    \"build\": \"cp -rf src/images dist/\",\n    \"watch\": \"???\"\n  }\n}\n\n// After\n{\n  \"devDependencies\": {\n    \"sync-glob\": \"^1.0.0\"\n  },\n  \"scripts\": {\n    \"build\": \"sync-glob 'src/images/*' dist/images\",\n    \"watch\": \"sync-glob --watch 'src/images/*' dist/images\"\n  }\n}\n```\n\n### Important\n\nMake sure that your globs are not being parsed by your shell by properly escaping them, e.g.: by quoting `'**/*'`.\n\n### Exclude stuff\n\nTo exclude stuff from source just use glob exclusion - `!` prefix, like:\n```js\n{\n  \"scripts\": {\n    \"sync\": \"sync-glob 'src/images/*' '!src/images/excluded.jpg' dist/images\"\n  }\n}\n```\n\n### Windows\n\nAs [`node-glob`](https://www.npmjs.com/package/glob#windows) and [`node-glob-all`](https://www.npmjs.com/package/glob-all) respectively only support unix style path separators `/`, don't use windows style `\\`.\n\n\u003e **Please only use forward-slashes in glob expressions.**\n\u003e\n\u003e Though windows uses either `/` or `\\` as its path separator, only `/`\n\u003e characters are used by this glob implementation.  You must use\n\u003eforward-slashes **only** in glob expressions.  Back-slashes will always\n\u003e be interpreted as escape characters, not path separators.\n\u003e\n\u003e Results from absolute patterns such as `/foo/*` are mounted onto the\n\u003e root setting using `path.join`.  On windows, this will by default result\n\u003e in `/foo/*` matching `C:\\foo\\bar.txt`.\n\n## API\n\nCheck our [API documentation](./API.md)\n\n## Credit/Inspiration\n\nThis package was mainly inspired by [`node-sync-files`](https://github.com/byteclubfr/node-sync-files).\nI mainly kept the API as is, but enhanced the file matching by utilizing powerful globs.\nAdditionally it is a complete rewrite in ES6 and it does not suffer from outdated dependencies.\nSome fancy features like `--transform` is inspired by [`cpx`](https://www.npmjs.com/package/cpx)\n\nProudly brought to you by [`\u003cscale-unlimited\u003e`](http://www.scale-unlimited.com)\n","funding_links":[],"categories":["Repository"],"sub_categories":["Filesystem"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAndyOGo%2Fnode-sync-glob","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAndyOGo%2Fnode-sync-glob","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAndyOGo%2Fnode-sync-glob/lists"}