lib/utils.js
function getManifest(options) {
  options = _.assign({
    addonDir: process.cwd(),
    xpiPath: null
  }, options);
  return when.promise(function(resolve, reject) {
    if (options.xpiPath) {
      return getXpiInfo(options.xpiPath)
        .then(function(xpiInfo) {
          resolve(xpiInfo.manifest);
        })
        .catch(reject);
    } else {
      var json = path.join(options.addonDir, "package.json");
      var manifest = {};
      try {
        manifest = require(json);
      } catch (e) {} // eslint-disable-line no-empty

      return resolve(manifest);
    }
  });
}
function getManifest(options) {
  options = _.assign({
    addonDir: process.cwd(),
    xpiPath: null
  }, options);
  return when.promise(function(resolve, reject) {
    if (options.xpiPath) {
      return getXpiInfo(options.xpiPath)
        .then(function(xpiInfo) {
          resolve(xpiInfo.manifest);
        })
        .catch(reject);
    } else {
      var json = path.join(options.addonDir, "package.json");
      var manifest = {};
      try {
        manifest = require(json);
      } catch (e) {} // eslint-disable-line no-empty

      return resolve(manifest);
    }
  });
}
function getManifest ( options ) { options = _ . assign ( { addonDir : process . cwd ( ) , xpiPath : null } , options ) ; return when . promise ( function ( resolve , reject ) { if ( options . xpiPath ) { return getXpiInfo ( options . xpiPath ) . then ( function ( xpiInfo ) { resolve ( xpiInfo . manifest ) ; } ) . catch ( reject ) ; } else { var json = path . join ( options . addonDir , "package.json" ) ; var manifest = { } ; try { manifest = require ( json ) ; } catch ( e ) { } // eslint-disable-line no-empty return resolve ( manifest ) ; } } ) ; }
Returns the `package.json` manifest as an object
from the `cwd`, or `null` if not found.
If you pass in an optional XPI filename, the manifest will be returned
from this directory after a temporary XPI extraction.

@param {Object} options
- `addonDir` directory of the add-on source code, defaulting
to the working directory.
- `xpiPath` a path to an XPI file where the manifest resides.
Without this, the current working directory is assumed.
@return {Promise} resolves to a manifest object
Returns the package . json manifest as an object from the cwd or null if not found . If you pass in an optional XPI filename the manifest will be returned from this directory after a temporary XPI extraction .