src/prebuild.js
function preBuild(addonPath) {
  // Require the addon
  let addonToBuild = require(addonPath);
  // Augment it with isDevelopingAddon function.
  addonToBuild.isDevelopingAddon = function() {
    return true;
  }
  // If addon has pre-built path set in it use that else use the default path
  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);
  // 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);
 }
function preBuild(addonPath) {
  // Require the addon
  let addonToBuild = require(addonPath);
  // Augment it with isDevelopingAddon function.
  addonToBuild.isDevelopingAddon = function() {
    return true;
  }
  // If addon has pre-built path set in it use that else use the default path
  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);
  // 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);
 }
function preBuild ( addonPath ) { // Require the addon let addonToBuild = require ( addonPath ) ; // Augment it with isDevelopingAddon function. addonToBuild . isDevelopingAddon = function ( ) { return true ; } // If addon has pre-built path set in it use that else use the default path if ( ! addonToBuild . PREBUILT_PATH ) { addonToBuild . PREBUILT_PATH = ` ${ addonPath } ` ; } 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 ) ; // 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 ) ; }
Pre-build the dependency of an addon and store it in prebuilt path by invoking the treeForAddon and treeForVendor hook
Pre - build the dependency of an addon and store it in prebuilt path by invoking the treeForAddon and treeForVendor hook