# sync-dir

> sync directory in package.json

Latest version **1.5.1** (published 2016-10-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install sync-dir
pnpm add sync-dir
yarn add sync-dir
bun add sync-dir
```

Provides the command `sync-dir`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.1 |
| Published | 2016-10-08 |
| First published | 2016-08-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=5.0.0 |
| Dependencies | 7 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | frontainer |
| Maintainers | frontainer |
| Keywords | sync, dir, package.json, cli, sync-dir, watch |

## Links

- npm: https://www.npmjs.com/package/sync-dir
- Repository: https://github.com/frontainer/sync-dir
- Homepage: https://github.com/frontainer/sync-dir#readme
- Issues: https://github.com/frontainer/sync-dir/issues
- npm.io page: https://npm.io/package/sync-dir

## Dependencies (7)

- [cpx](https://npm.io/package/cpx.md) ^1.5.0
- [glob](https://npm.io/package/glob.md) ^7.1.1
- [meow](https://npm.io/package/meow.md) ^3.7.0
- [chalk](https://npm.io/package/chalk.md) ^1.1.3
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [chokidar](https://npm.io/package/chokidar.md) ^1.6.0
- [glob-base](https://npm.io/package/glob-base.md) ^0.3.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.5.1 (latest) — 2016-10-08
- 1.5.0 — 2016-09-11
- 1.4.2 — 2016-09-02
- 1.4.1 — 2016-08-27
- 1.4.0 — 2016-08-26
- 1.3.1 — 2016-08-26
- 1.3.0 — 2016-08-26
- 1.2.1 — 2016-08-24
- 1.2.0 — 2016-08-22
- 1.1.0 — 2016-08-21
- 1.0.0 — 2016-08-16

## README

# sync-dir

sync directory in package.json

## Require

Node.js =< 5.0

## Install

```
npm i sync-dir --save-dev
```

## Usage

Add 'sync' property to package.json.

```
{
  "sync": {
    "/path/to/source/**/*": "/path/to/dest"
  }
}
```

Or create `sync.conf.js`. When, execute `sync-dir` command with `-c ./sync.conf.js` option.

```
module.exports = {
    "/path/to/source/**/*": "/path/to/dest"
};
```

### CLI

```
# from package.json's sync property.
$ sync-dir 

# watch files
$ sync-dir -w

# from `sync.conf.js`
$ sync-dir -c ./sync.conf.js
```

### Options

- -w, --watch: watch directories
- -c, --config: load sync files config
- -v, --version version: show version number
- -h, --help help: show help

### Module

```
const syncDir = require('sync-dir');
syncDir.copy({
    '/path/to/source/**/*': '/path/to/dest'
}).then(() => {
    // done
}).catch(() => {
    // error
});
```

```
const syncDir = require('sync-dir');
const DATA = {
    '/path/to/source/**/*': '/path/to/dest'
};
let files = syncDir.getFiles(DATA);
syncDir.watch(files,() => {
    syncDir.copy(DATA);
});
```

---
_Source: https://npm.io/package/sync-dir · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
