arc-pb-deployer
Bundles a PageBuilder project into a .zip file and posts it to the PageBuilder API.
Last updated 2 years ago by ivesj .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install arc-pb-deployer 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 1.0.4                                ...           latest (2 years ago)

10 Versions

  • 1.0.4                                ...           2 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.0.6                                ...           3 years ago
  • 0.0.5                                ...           3 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 9
Last Day 1
Last Week 2
Last Month 6
Dependencies (5)
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |