ember-cli-deploy-plugin

raw JSON →
0.2.9 verified Sat Apr 25 auth: no javascript maintenance

Base class for building plugins for ember-cli-deploy. Version 0.2.9 is the latest stable release, with a slow release cadence (last release 2016). It provides a base class with helpers for config management (defaultConfig, requiredConfig, readConfig), logging (log method with color and verbose options), and async hooks (returning promises). Key differentiator: standardizes plugin development across the ember-cli-deploy ecosystem, reducing boilerplate and ensuring consistent behavior. Older versions may have breaking changes, e.g., v0.2.7 changed `this` context in config functions.

error Cannot find module 'ember-cli-deploy-plugin'
cause Package not installed or incorrect module path.
fix
Run npm install ember-cli-deploy-plugin --save-dev in your plugin directory.
error TypeError: this.readConfig is not a function
cause The plugin instance does not have readConfig method, likely because the base class was not extended correctly.
fix
Ensure you call DeployPluginBase.extend({...}) and return new DeployPlugin() in createDeployPlugin.
error The plugin did not provide a name
cause Missing name property in the plugin object or options.name not passed.
fix
Set name in module.exports.name or pass options.name to the createDeployPlugin function.
breaking Context of `this` within user-defined config property functions changed from the base plugin to the surrounding config object.
fix Update config functions to reference the config object instead of the plugin instance.
gotcha The package only supports CommonJS require; using ES6 import syntax will fail.
fix Use const pkg = require('ember-cli-deploy-plugin'); instead of import.
deprecated The package is now in maintenance mode and not actively developed for new features.
fix Consider migrating to ember-cli-deploy's newer plugin patterns if available.
npm install ember-cli-deploy-plugin
yarn add ember-cli-deploy-plugin
pnpm add ember-cli-deploy-plugin

Demonstrates creating a custom deploy plugin using the base class, with default config, required config, and a hook.

// index.js
'use strict';

var DeployPluginBase = require('ember-cli-deploy-plugin');

module.exports = {
  name: 'ember-cli-deploy-awesomeness',
  createDeployPlugin: function(options) {
    var DeployPlugin = DeployPluginBase.extend({
      name: options.name,
      defaultConfig: {
        someKey: 'defaultValue'
      },
      requiredConfig: ['awesomeApiKey'],
      willUpload: function(context) {
        var someValue = this.readConfig('someKey');
        this.log('Log message', { color: 'green' });
        return Promise.resolve();
      }
    });
    return new DeployPlugin();
  }
};