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

arc-pb-deployer

v1.0.4

Published

Bundles a PageBuilder project into a .zip file and posts it to the PageBuilder API.

Downloads

748

Readme

Arc PageBuilder Deployer

The Arc PageBuilder Deployer package is a simple Node script which bundles a PageBuilder repository into a .zip file and then makes a POST request to the PageBuilder deployer API. Once posted you can deploy your site bundle directly through the deployer window.

For detailed setup instructions with CircleCI including examples click here.

Getting Started

To get started you must first install the npm package. You'll also need to install version 8.0 or higher of NodeJS.

npm install arc-pb-deployer

Once installed you can then require the package, passing in some information about the repository file structure and the PageBuilder API you'd like to upload to. You can then call the deploy method to start the bundling process.

const path = require('path')
const postDeploy = require('./postDeploy');
const environment = process.env.NODE_ENV

const deploy = require('arc-pb-deployer')({
  rootDirectory: path.resolve(__dirname, '..', '..'),
  endpoint: process.env[`${environment}_DEPLOYER_ENDPOINT`],
  username: process.env[`${environment}_DEPLOYER_USERNAME`],
  password: process.env[`${environment}_DEPLOYER_PASSWORD`],
  environment,
  postDeploy
})

deploy()

By default the module omits a series of folders and file types that are deemed as unnecessary for a PageBuilder bundle such as the node_modules, docker and mongo directories. However if you'd like to override the regex and setup your own you can do so by passing it in as the argument.

const deploy = require('arc-pb-deployer')({
  // ...
  ommittedContent: /node_modules$|^.*\.(scss|map|less)$|.git$|__tests__$|build$|src$|package*$|yarn.lock$|circle[.]*|bash[.]*|gulp[.]*|docker[.]*|deploy[.]*|deployment[.]*|pagebuilder[.]*|mongo[.]*|proxy[.]*/
})

deploy()

Whenever the deploy function runs it will generate a .zip file to the deployment folder in the root directory of the PageBuilder project, this folder should be ignored inside of the projects .gitignore file.

Chat Client Notifications

If you'd like to recieve a chat client notification whenever the bundle has finished deploying you can pass in a postDeploy callback that uses your chat client's webhook API. Here's a generalized example:

const someChatClient = require('some-chat-client');
const deploy = require('arc-pb-deployer')({
  // ...
  postDeploy: function(success, name, environment) {
    if (success) {
      someChatClient(`Your bundle, \`${name}\` has been deployed to the \`${environment}\` environment`)
    } else {
      someChatClient(`Your bundle, \`${name}\` to \`${environment}\` has failed.`)
    }
  }
})

deploy()

The callback will pass back if the deployment is successful, the name of the bundle, and the environment it was deployed to.

API

The following properties can be passed in as arguments when instantiating the arc-pb-deploy package. Remember to pass them as properties on an arguments object, e.g., { rootDirectory, endpoint, username, etc, }

| Key | Data type | Required? | Description | | ----------| ---------------------| ----------|-------------| | rootDirectory| string | true | Absolute path to project root directory. | | endpoint | string | true | API endpoint you want to deploy zip file to. | | username | string | true | API username credential for deployment request authentication. | | password | string | true | API password credential for deployment request authentication. | | ommittedContent| RegExp | false | File or directory name patterns to omit from being zipped/deployed. | | environment| string | true | Environment to be included in the log messages. | | postDeploy| function | true | Callback to execute after a deployment attempt. |

Developer Tools

The following developer commands are accesible after running yarn install.

| Command | Description | | ------------- | ------------- | | yarn lint | Lints the deployer package against the Airbnb styleguide. | | yarn test | Runs a series of unit tests. |