# aemsync-weily

> Adobe AEM Synchronization Tool

Latest version **1.2.1** (published 2017-11-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install aemsync-weily
pnpm add aemsync-weily
yarn add aemsync-weily
bun add aemsync-weily
```

Provides the command `aemsync`.

## 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.2.1 |
| Published | 2017-11-03 |
| First published | 2017-03-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Michal Kochel |
| Maintainers | dutscher |
| Keywords | AEM, CQ, Sling, Synchronization |

## Links

- npm: https://www.npmjs.com/package/aemsync-weily
- Repository: https://github.com/dutscher/aemsync
- Homepage: https://github.com/bitjoo/aemsync
- Issues: https://github.com/dutscher/aemsync/issues
- npm.io page: https://npm.io/package/aemsync-weily

## Dependencies (6)

- [chalk](https://npm.io/package/chalk.md) ^1.1.1
- [anymatch](https://npm.io/package/anymatch.md) ^1.3.0
- [archiver](https://npm.io/package/archiver.md) ^0.21.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [form-data](https://npm.io/package/form-data.md) ^0.2.0
- [graceful-fs](https://npm.io/package/graceful-fs.md) ^4.1.3

## Recent versions

- 1.2.1 (latest) — 2017-11-03
- 1.2.0 — 2017-03-13
- 1.1.1 — 2017-03-13

## README

aemsync
=======

AEM (Adobe CQ) Synchronization Tool.

### Synopsis

The tool pushes code changes to AEM instance(s) upon a file change.
* There is no vault dependency.
* It can push to multiple instances at the same time (e.g. author and publish).
* IDE/editor agnostic.
* Works on Windows, Linux and Mac.

### Installation

With [npm](http://npmjs.org) do:

```
npm install aemsync -g
```

### Usage

Commandline
```
aemsync -t targets -w path_to_watch

-t: Comma separated list of target hosts; default is http://admin:admin@localhost:4502.
-w: Folder to watch; default is current.
-i: Update interval; default is 300ms.
-e: Anymatch exclude filter; any file matching the pattern will be skipped.
-d: Enable debug mode.
```

```
aemsync -t http://admin:admin@localhost:4502,http://admin:admin@localhost:4503 -w ~/workspace/my_project
```

JavaScript
```JavaScript
// Import aemsync.
const aemsync = require('aemsync')

// Set up the environment.
let workingDir = '~/workspace/my_project'
let targets = [
  'http://admin:admin@localhost:4502',
  'http://admin:admin@localhost:4503'
]
let exclude = '**/*.orig' // Skip merge files.
let pushInterval = 300
let onPushEnd = (err, host) => {
  if (err) {
    return console.log(`Error when pushing package to ${host}.`, err)
  }
  console.log(`Package pushed to ${host}.`)  
}

// Create Pusher and Watcher.
let pusher = new Pusher(targets, pushInterval, onPushEnd)
let watcher = new Watcher()

// Initialize queue processing.
pusher.start()

// Watch over workingDir.
watcher.watch(workingDir, exclude, (localPath) => {
  // Add item to Pusher's queue when a change is detected.
  pusher.addItem(localPath)
})
```

### Description

The Watcher uses Node's `fs.watch()` function to watch over directory changes recursively. For Windows and OSX the `recursive` option is used, which significantly improves the performance. Any changes inside `jcr_root/*` folders are detected and deployed to AEM instance(s) as a package.

Update interval is the time the Pusher waits for file changes before the package is created. In case of multiple file changes (e.g. switching between code branches), creating a new package per file should be avoided and instead, all changes should be pushed in one go. Lowering the value decreases the delay for a single file change but may increase the delay for multiple file changes. If you are unsure, please leave the default value.

### Known issues

Packages are installed using package manager service (`/crx/packmgr/service.jsp`), which takes some time to initialize after AEM startup. If the push happens before, the Sling Post Servlet will take over causing the `/crx/packmgr/service.jsp/file` node to be added to the repository.

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