npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

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, default http)
  • host String? Host for package manager service. (optional, default localhost)
  • port Number? Port number for package manager service. (optional, default 4502)
  • extractMetaDir Boolean? Flag to extract meta directory during push and pull.. (optional, default false)
  • pkgPropFile String? Path to package meta . properties.xml file (optional, default ./META-INF/vault/properties.xml)
  • jcrRootDir String? Name of JCR root directory. (optional, default jcr_root)
  • pkgService String? Path of package manager service. (optional, default /crx/packmgr/service.jsp)
  • username String? Username for package manager service authentication. (optional, default admin)
  • password String? Password for package manager service authentication. (optional, default admin)
  • installPkg Boolean? Flag, whether you want uploaded package installation. (optional, default true)
  • pkgFilePattern String? Package zip file search pattern. (optional, default *.zip)
  • cwd String? Current working directory for operation. (optional, default process.cwd())

aemPkg

buildRemotePkg

Parameters
  • pkgName String Name of the package to build without extension
  • opts Object Options to override default options (optional, default defaultOptions)
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, default defaultOptions)
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, default defaultOptions)
Examples
await aemPkg.push('./my-aem-pkg-dir/my-aem-website');

Returns Promise

clone

Parameters
  • pkgName String Name of the package without extension
  • cloneDirPath String Path of directory to clone the package
  • opts Object Options to override default options (optional, default defaultOptions)
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 properties
  • opts Object Options to override default options (optional, default defaultOptions)
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 paths
  • opts Object Options to override default options (optional, default defaultOptions)
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 zip
  • opts Object Options to override default options (optional, default defaultOptions)
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, default defaultOptions)
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 packages
  • opts Object Options to override default options (optional, default defaultOptions)
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 ©