0.0.0-beta.10 • Published 7 years ago
aem-pkg v0.0.0-beta.10
aem-pkg
The Problem
Sometimes you just need to push, pull and sync AEM package from local file system to AEM server frequently for development and you end up doing it manually uploading, downloading and extracting packages.
This Solution
- Provide simple command to upload and download packages from AEM remote server
- Provide git like commands to keep your local revisioned-package directory sync with your remote AEM server.
- It uses the package manager service API to do all the operations.
Install
$ npm install aem-pkg -gCLI Usage
$ aem-pkg --help
Usage
$ aem-pkg <command>
Options
--protocol=<protocol> Protocol for package manager service
--host=<host> Host for package manager service
--port=<port> Port number for package manager service
--extractMetaDir=<extractMetaDir> Flag, whether you want to extract meta directory during push and pull.
--pkgPropFile=<pkgPropFile> Path to package meta properties.xml file
--jcrRootDir =<jcrRootDir> Name of JCR root directory
--pkgService=<pkgService> Path of package manager service
--username=<username> Username for package manager service authentication
--password=<password> Password for package manager service authentication
--installPkg=<installPkg> Flag, whether you want uploaded package installation
--pkgFilePattern=<pkgFilePattern> Package zip file search pattern
--cwd=<dir> Current working directory for operation
Examples
Clone 'my-aem-package' from remote server for development.
$ aem-pkg clone my-aem-package
Push current changes to remote server.
$ aem-pkg push
Pull current changes from remote server.
$ aem-pkg pull
Upload all packages from current directory
$ aem-pkg up
Upload 'my-aem-pacakge.zip' package from current directory
$ aem-pkg up my-aem-pacakge.zip
Download and Upload 'my-aem-pacakge.zip' package
$ aem-pkg up https://www.mywebsite.com/packages/my-aem-pacakge.zip
Upload multiple packages serially from current directory and server
$ aem-pkg up my-aem-pacakge1.zip my-aem-pacakge2.zip https://www.mywebsite.com/packages/my-aem-pacakge3.zip
Extract and upload packages from 'pacakges-zip-file.zip' file. This file should have aem packages.
$ aem-pkg upzip pacakges-zip-file.zip
Download, extract and upload packages from URL 'https://www.mypackages.com/pacakges-zip-file.zip' file. This file should have aem packages.
$ aem-pkg upzip https://www.mypackages.com/pacakges-zip-file.zipAPI Usage
import aemPkg from 'aem-pkg';
// Upload all packages from this directory
await aemPkg.uploadPkgsFromDir('./my-aem-pkgs/');
// With options to override defaultOptions
await aemPkg.uploadPkgsFromDir('./my-aem-pkgs/', {
port: 80,
host: 'www.mywebsite.com',
username: 'admin',
password: 'admin'
});API
defaultOptions
Type: Object
Properties
protocolString? Protocol for package manager service. (optional, defaulthttp)hostString? Host for package manager service. (optional, defaultlocalhost)portNumber? Port number for package manager service. (optional, default4502)extractMetaDirBoolean? Flag to extract meta directory during push and pull.. (optional, defaultfalse)pkgPropFileString? Path to package meta . properties.xml file (optional, default./META-INF/vault/properties.xml)jcrRootDirString? Name of JCR root directory. (optional, defaultjcr_root)pkgServiceString? Path of package manager service. (optional, default/crx/packmgr/service.jsp)usernameString? Username for package manager service authentication. (optional, defaultadmin)passwordString? Password for package manager service authentication. (optional, defaultadmin)installPkgBoolean? Flag, whether you want uploaded package installation. (optional, defaulttrue)pkgFilePatternString? Package zip file search pattern. (optional, default*.zip)cwdString? Current working directory for operation. (optional, defaultprocess.cwd())
aemPkg
buildRemotePkg
Parameters
pkgNameString Name of the package to build without extensionoptsObject Options to override default options (optional, defaultdefaultOptions)
Examples
await aemPkg.buildRemotePkg('my-awesome-aem-website');Returns Promise
pull
Parameters
srcString Path of the package directory where need to pull the package.optsObject Options to override default options (optional, defaultdefaultOptions)
Examples
await aemPkg.pull('./my-aem-pkg-dir/my-aem-website');Returns Promise
push
Parameters
srcString Path of the package directory which you need to push to the server.optsObject Options to override default options (optional, defaultdefaultOptions)
Examples
await aemPkg.push('./my-aem-pkg-dir/my-aem-website');Returns Promise
clone
Parameters
pkgNameString Name of the package without extensioncloneDirPathString Path of directory to clone the packageoptsObject Options to override default options (optional, defaultdefaultOptions)
Examples
await aemPkg.clone('my-aem-website', './my-aem-pkg-dir/');Returns Promise
uploadPkg
Parameters
file(String | Object) path or file url or object with buffer and filename propertiesoptsObject Options to override default options (optional, defaultdefaultOptions)
Examples
await aemPkg.uploadPkg('./my-aem-pkgs/my-website.zip');
await aemPkg.uploadPkg('https://www.mywebsite.com/my-aem-pkgs/my-website.zip');
await aemPkg.uploadPkg({ buffer: zipFileBuffer, name: 'my-website' });Returns Promise
uploadPkgs
Parameters
pkgsArray array of package file pathsoptsObject Options to override default options (optional, defaultdefaultOptions)
Examples
await aemPkg.uploadPkgs([
'./my-aem-pkgs/my-first-website.zip',
'./my-aem-pkgs/my-second-website.zip',
'https://www.mywebsite.com/my-aem-pkgs/my-second-website.zip'
]);Returns Promise
uploadPkgsFromDir
Parameters
pkgsDirString Directory of all package zipoptsObject Options to override default options (optional, defaultdefaultOptions)
Examples
// Upload all packages from this directory
await aemPkg.uploadPkgsFromDir('./my-aem-pkgs/');Returns Promise
uploadPkgsFromZip
Parameters
zipFileString Path of zip file which contains many packages. All will be uploaded individually.optsObject Options to override default options (optional, defaultdefaultOptions)
Examples
// Upload packages from zip file which contains many AEM packages
await aemPkg.uploadPkgsFromZip('./aem-pkgs/my-aem-pkgs.zip');Returns Promise
uploadPkgsFromZipUrl
Parameters
zipUrlString URL of zip file which contains AEM packagesoptsObject Options to override default options (optional, defaultdefaultOptions)
Examples
// Upload packages from zip file URL which contain many AEM packages
await aemPkg.uploadPkgsFromZip(
'https://www.example.com/packages/my-aem-pkgs.zip'
);Returns Promise
TODO
aem-pkg synccommand. This will keep pulling and pushing updates from and to aem server.
License
MIT ©
0.0.0-beta.10
7 years ago
0.0.0-beta.8
7 years ago
0.0.0-beta.7
7 years ago
0.0.0-beta.6
7 years ago
0.0.0-beta.5
7 years ago
0.0.0-beta.4
7 years ago
0.0.0-beta.3
7 years ago
0.0.0-beta.2
7 years ago
0.0.0-beta.1
7 years ago
0.0.0-beta.0
7 years ago