aem-pkg
v0.0.0-beta.10
Published
Sometimes you just need to push, pull and sync AEM package from local file system to AEM server.
Downloads
2
Readme
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 -g
CLI 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.zip
API 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
protocol
String? Protocol for package manager service. (optional, defaulthttp
)host
String? Host for package manager service. (optional, defaultlocalhost
)port
Number? Port number for package manager service. (optional, default4502
)extractMetaDir
Boolean? Flag to extract meta directory during push and pull.. (optional, defaultfalse
)pkgPropFile
String? Path to package meta . properties.xml file (optional, default./META-INF/vault/properties.xml
)jcrRootDir
String? Name of JCR root directory. (optional, defaultjcr_root
)pkgService
String? Path of package manager service. (optional, default/crx/packmgr/service.jsp
)username
String? Username for package manager service authentication. (optional, defaultadmin
)password
String? Password for package manager service authentication. (optional, defaultadmin
)installPkg
Boolean? Flag, whether you want uploaded package installation. (optional, defaulttrue
)pkgFilePattern
String? Package zip file search pattern. (optional, default*.zip
)cwd
String? Current working directory for operation. (optional, defaultprocess.cwd()
)
aemPkg
buildRemotePkg
Parameters
pkgName
String Name of the package to build without extensionopts
Object Options to override default options (optional, defaultdefaultOptions
)
Examples
await aemPkg.buildRemotePkg('my-awesome-aem-website');
Returns Promise
pull
Parameters
src
String Path of the package directory where need to pull the package.opts
Object Options to override default options (optional, defaultdefaultOptions
)
Examples
await aemPkg.pull('./my-aem-pkg-dir/my-aem-website');
Returns Promise
push
Parameters
src
String Path of the package directory which you need to push to the server.opts
Object Options to override default options (optional, defaultdefaultOptions
)
Examples
await aemPkg.push('./my-aem-pkg-dir/my-aem-website');
Returns Promise
clone
Parameters
pkgName
String Name of the package without extensioncloneDirPath
String Path of directory to clone the packageopts
Object 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 propertiesopts
Object 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
pkgs
Array array of package file pathsopts
Object 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
pkgsDir
String Directory of all package zipopts
Object Options to override default options (optional, defaultdefaultOptions
)
Examples
// Upload all packages from this directory
await aemPkg.uploadPkgsFromDir('./my-aem-pkgs/');
Returns Promise
uploadPkgsFromZip
Parameters
zipFile
String Path of zip file which contains many packages. All will be uploaded individually.opts
Object 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
zipUrl
String URL of zip file which contains AEM packagesopts
Object 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 sync
command. This will keep pulling and pushing updates from and to aem server.
License
MIT ©