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

cloudcms-http-deployment-receiver

v1.0.2

Published

Cloud CMS Http Deployment Receiver

Downloads

2

Readme

Cloud CMS Http Deployment Receiver

This repository provides a framework that you can use to build your own Cloud CMS custom HTTP deployment receivers. Deployment Receivers are endpoints for the Cloud CMS deployment process. They receive Deployment Packages which contain content (JSON and binaries) that are to be either deployed or undeployed against the endpoint.

Getting Started

To use this in a Node project, you will first need to:

npm install --save cloudcms-http-deployment-receiver

And then in your code, you'd do:

var receiver = require("cloudcms-http-deployment-receiver");

receiver.start(function() {
    console.log("Deployment Receiver is online");
});

This will start an HTTP server (using Express). The HTTP server exposes two controller methods:

POST /push``

GET /status/:id 

When Cloud CMS deploys its deployment packages, those should be targeted to the /push endpoint. If you want asynchronous deployment, you should configure the Status URL for your deployment target to point to /status/{{id}}. This will allow Cloud CMS to poll this deployment receiver to check when the asset has been successfully deployed.

Event Handlers

When a Deployment Package arrives, a series of event callbacks are triggered which allow you to plug in custom handling code. You insert your custom code by registering functions. Each function will receive information about the current step and will also receive a callback argument. You must invoke this callback when you are all finished.

The reason for the callback is because functions run asynchronous and in parallel for performance. You may also need to do things like insert content into a database or do other operations which inherently take time. Fire the callback once you're finished.

The deploymentPackage is a JSON object that describes what was deployed. It has an operation property that will either be DEPLOY or UNDEPLOY. You can use this information, if you choose, to add or remove the content.

before

This runs once the deployment package has arrived but before any execution has occurred.

receiver.before(function(deploymentPackage, callback) {
    callback();
});

execute

This runs when the deployment has been completely unpacked and is ready to deploy. The store variable gives you access to the all the files. And the manifest is a JSON object containing an inventory of everything that is in the package including dependnecy information.

receiver.before(function(deploymentPackage, manifest, store, callback) {
    callback();
});

entry

This runs per entry in the deployment. It serves as an alternative (or a companion) to the execute method, allowing you to focus on entries one at a time.

receiver.entry(function(deploymentPackage, manifest, store, entryPath, callback) {    
    callback();
});

after

This runs when the deployment package has completed its deployment.

receiver.after(function(deploymentPackage, manifest, store, callback) {
    callback();
});

Example

To see a full-fledged example of this in action, check out the