How to use the ember-cli/lib/models/addon.extend function in ember-cli

To help you get started, we’ve selected a few ember-cli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github asakusuma / ember-rollup / src / prebuild.js View on Github external
if(!addonToBuild.PREBUILT_PATH) {
    addonToBuild.PREBUILT_PATH = `${addonPath}/pre-built`;
  }
  fs.removeSync(addonToBuild.PREBUILT_PATH);

  const ui = new UI({
    inputStream: process.stdin,
    outputStream: process.stdout,
    errorStream: process.stderr,
    writeLevel: 'DEBUG' | 'INFO' | 'WARNING' | 'ERROR',
    ci: true | false
  });
  const project = Project.closestSync(addonPath, ui);
  project.initializeAddons();
  // Extend the current addon from base Addon
  const CurrentAddon = Addon.extend(Object.assign({}, addonToBuild, {root: addonPath, pkg: project.pkg}));
  const currAddon  = new CurrentAddon(addonPath, project);

  // Get the tree for Addon and Vendor
  let addonTree = new Funnel (currAddon.treeFor('addon'), {
    destDir:  'addon'
  });

  let vendorTree = new Funnel (currAddon.treeFor('vendor'), {
    destDir:  'vendor'
  });

  // Merge, Build the resulting tree and store it in prebuild path
  return build(new Merge([addonTree, vendorTree], { annotation: '[ember-rollup] Merging prebuild addon and vendor tree' }), addonToBuild.PREBUILT_PATH);
 }
github ember-engines / ember-asset-loader / lib / manifest-generator.js View on Github external
var Addon = require('ember-cli/lib/models/addon');
var objectAssign = require('object-assign');
var findHost = require('./utils/find-host');

/**
 * A simple base class for other addons to extend when they want to generate an
 * Asset Manifest.
 *
 * @class ManifestGenerator
 * @extends EmberCliAddon
 */
var ManifestGenerator = Addon.extend({
  /**
   * Insert a meta tag to hold the manifest in the DOM. We won't insert the
   * manifest until after postprocessing so the content is a placeholder value.
   */
  contentFor: function(type, config) {
    var app = findHost(this);
    var options = app && app.options && app.options.assetLoader;
    if (type === 'head-footer' && !(options && options.noManifest)) {
      var metaName = config.modulePrefix + '/config/asset-manifest';
      return '';
    }
  },

  /**
   * Generate an Asset Manifest from the "all" post-processing tree with any
   * specified manifestOptions.