@abmaonline/aemsync 中文文档教程

发布于 4年前 浏览 20 项目主页 更新于 3年前

@abmaonline/aemsync

AEM (Adobe CQ) 同步工具。

基于 https://github.com/gavoja/aemsynchttps://github.com/gavoja。 此分支添加了有关将哪些文件推送到 AEM 的反馈。

Synopsis

该工具在文件更改时将代码更改推送到 AEM 实例。

  • 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

使用 npm 执行:

npm install @abmaonline/aemsync -g

Usage

命令行

Usage:
  aemsync [OPTIONS]

Options:
  -t <targets>            Defult is http://admin:admin@localhost:4502
  -w <path_to_watch>      Default is current
  -p <path_to_push>       Path to push directly; used instead of above,
                          no watching takes place
  -e <exclude_filter>     Micromatch exclude filter; disabled by default
  -i <sync_interval>      Update interval; default is 300ms
  -u <packmgr_path>       Package manager path; default is
                          /crx/packmgr/service.jsp
  -d                      Enable debug mode
  -h                      Displays this screen
aemsync -t http://admin:admin@localhost:4502,http://admin:admin@localhost:4503 -w ~/workspace/my_project

JavaScript(完整监视示例):

// Import aemsync.
const aemsync = require('@abmaonline/aemsync')

// Set up the environment.
const workingDir = '~/workspace/my_project'
const targets = [
  'http://admin:admin@localhost:4502',
  'http://admin:admin@localhost:4503'
]
const exclude = '**/*.orig' // Skip merge files.
const interval = 300
const packmgrUrl = '/foo/crx/packmgr/service.jsp'
const onPushEnd = (err, host) => {
  if (err) {
    return console.log(`Error when pushing package to ${host}.`, err)
  }
  console.log(`Package pushed to ${host}.`)
}

// Will watch for changes on workingDir and push them.
aemsync({workingDir, targets, exclude, interval, packmgrUrl, onPushEnd})

JavaScript(直接推送示例):

// Import aemsync.
const aemsync = require('@abmaonline/aemsync')

// Set up the environment.
const path = '~/foo/bar/my-workspace/jcr_content/apps/my-app/components/my-component'
const targets = [
  'http://admin:admin@localhost:4502',
  'http://admin:admin@localhost:4503'
]
const onPushEnd = (err, host) => {
  if (err) {
    return console.log(`Error when pushing package to ${host}.`, err)
  }
  console.log(`Package pushed to ${host}.`)
}

// Will push the path to AEM.
aemsync.push({path, targets, onPushEnd})

Description

Watcher 使用 Node 的 fs.watch()< /code> 函数以递归方式监视目录更改。 对于 Windows 和 OSX,使用 recursive 选项,这显着提高了性能。 jcr_root 文件夹内的任何更改都会被检测并作为包部署到 AEM 实例。 规则:

  • Changes to first level directories under jcr_root are ingored. This is to avoid accidentally removing apps, libs or any other first level node in AEM.
  • The following are ignored by default: .svn, .git, .hg.

Update interval 是 Pusher 在创建包之前等待文件更改的时间。 在多个文件更改的情况下(例如在代码分支之间切换),应避免为每个文件创建一个新包,而是应一次性推送所有更改。 降低该值会减少单个文件更改的延迟,但可能会增加多个文件更改的延迟。 如果不确定,请保留默认值。

请注意,某些文件更改将导致推送整个父文件夹:

  • Ading, removing or renaming files or directories.
  • Changing .content.xml.
  • Changing any file or directory inside nt:unstructured subtree. In this case the first non nt:unstructured ancestor will be pushed. This behaviour ensures proper handling of self-contained unstructured blocks of nodes such as dialogs that are distributed across multiple files (see issue 19).

Known issues

包是使用包管理器服务 (/crx/packmgr/service.jsp) 安装的,这在 AEM 启动后需要一些时间进行初始化. 如果推送发生在之前,Sling Post Servlet 将接管,导致将 /crx/packmgr/service.jsp/file 节点添加到存储库。

@abmaonline/aemsync

AEM (Adobe CQ) Synchronization Tool.

Based on https://github.com/gavoja/aemsync by https://github.com/gavoja. This fork adds feedback about what files were pushed to AEM.

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 do:

npm install @abmaonline/aemsync -g

Usage

Commandline

Usage:
  aemsync [OPTIONS]

Options:
  -t <targets>            Defult is http://admin:admin@localhost:4502
  -w <path_to_watch>      Default is current
  -p <path_to_push>       Path to push directly; used instead of above,
                          no watching takes place
  -e <exclude_filter>     Micromatch exclude filter; disabled by default
  -i <sync_interval>      Update interval; default is 300ms
  -u <packmgr_path>       Package manager path; default is
                          /crx/packmgr/service.jsp
  -d                      Enable debug mode
  -h                      Displays this screen
aemsync -t http://admin:admin@localhost:4502,http://admin:admin@localhost:4503 -w ~/workspace/my_project

JavaScript (full watch example):

// Import aemsync.
const aemsync = require('@abmaonline/aemsync')

// Set up the environment.
const workingDir = '~/workspace/my_project'
const targets = [
  'http://admin:admin@localhost:4502',
  'http://admin:admin@localhost:4503'
]
const exclude = '**/*.orig' // Skip merge files.
const interval = 300
const packmgrUrl = '/foo/crx/packmgr/service.jsp'
const onPushEnd = (err, host) => {
  if (err) {
    return console.log(`Error when pushing package to ${host}.`, err)
  }
  console.log(`Package pushed to ${host}.`)
}

// Will watch for changes on workingDir and push them.
aemsync({workingDir, targets, exclude, interval, packmgrUrl, onPushEnd})

JavaScript (direct push example):

// Import aemsync.
const aemsync = require('@abmaonline/aemsync')

// Set up the environment.
const path = '~/foo/bar/my-workspace/jcr_content/apps/my-app/components/my-component'
const targets = [
  'http://admin:admin@localhost:4502',
  'http://admin:admin@localhost:4503'
]
const onPushEnd = (err, host) => {
  if (err) {
    return console.log(`Error when pushing package to ${host}.`, err)
  }
  console.log(`Package pushed to ${host}.`)
}

// Will push the path to AEM.
aemsync.push({path, targets, onPushEnd})

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. Rules:

  • Changes to first level directories under jcr_root are ingored. This is to avoid accidentally removing apps, libs or any other first level node in AEM.
  • The following are ignored by default: .svn, .git, .hg.

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.

Note that some of the file changes will result in pushing the entire parent folder:

  • Ading, removing or renaming files or directories.
  • Changing .content.xml.
  • Changing any file or directory inside nt:unstructured subtree. In this case the first non nt:unstructured ancestor will be pushed. This behaviour ensures proper handling of self-contained unstructured blocks of nodes such as dialogs that are distributed across multiple files (see issue 19).

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.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文