0.1.0 • Published 7 years ago

shipit-cnpmjs v0.1.0

Weekly downloads
2
License
MIT
Repository
-
Last release
7 years ago

shipit-cnpm

A set of tasks for Shipit used for cnpm specific tasks on deploy.

Inspired by the capistrano/composer extension.

Features:

Install

npm install shipit-cnpm

Usage

Just simply run: (This triggers the cnpm task on the deploy updated or fetched event. No additional config necessary.)

shipit staging deploy

Or you can run the tasks separatly :

shipit staging cnpm:init cnpm:install
shipit staging cnpm:run --cmd "update"

Options shipit.config.cnpm

cnpm.remote

Type: Boolean Default: true

A Boolean to determine whether to run the task in local workspace or on the remote.

cnpm.installArgs

Type: Array or String Default: []

An array or string specifying cnpm args passed to the cnpm install cmd.

cnpm.installFlags

Type: Array or String Default: []

An array or string specifying cnpm flags passed to the cnpm install cmd.

cnpm.triggerEvent

Type: String,Boolean Default: updated or fetched (depending on cnpm.remote value)

An event name that triggers cnpm:install. Can be set to false to prevent the cnpm:install task from listening to any events.

Example shipitfile.js options usage

module.exports = function (shipit) {
  require('shipit-deploy')(shipit);
  require('shipit-cnpm')(shipit);

  shipit.initConfig({
    default: {
      cnpm: {
        remote: false,
        installArgs: ['gulp'],
        installFlags: ['-g']
      }
    }
  });
};

Workflow tasks

  • cnpm
    • cnpm:init
      • Emit event "cnpm_inited".
    • cnpm:install
      • Runs cnpm install (with any Args cnpm.installArgs or Flags cnpm.installFlags defined in options)
      • Emit event "cnpm_installed"
    • cnpm:run
      • Runs cnpm command.
Event flow:
  • on Event "deploy" (shipit-deploy initialized)
    • Runs cnpm:init
    • on Event "cnpm_inited"
      • Runs cnpm:install (Triggered on the updated or fetched event from shipit-deploy or by a custom cnpm.triggerEvent as mentioned above.)

License

MIT