lib/crx.js
function build(TaskConfig, crx) {
    return new Promise(function(resolve, reject){
	mkdir(path.dirname(TaskConfig.dest), function(err){
	  if (err) {
	    return reject(err);
	  }

	  resolve();
	});
      })
      .then(function(){
	return crx.load(TaskConfig.src);
      })
      .then(function(){
	return crx.loadContents();
      })
      .then(function(archiveBuffer){
	if (path.extname(TaskConfig.dest) === '.zip') {
	  grunt.file.write(TaskConfig.dest, archiveBuffer);
	  grunt.log.ok(TaskConfig.dest + ' has been created.');
	}

	return archiveBuffer;
      })
      .then(function writeCrxArchive(archiveBuffer){
	if (path.extname(TaskConfig.dest) === '.crx') {
	  return crx.pack(archiveBuffer).then(function(crxBuffer) {
	    grunt.file.write(TaskConfig.dest, crxBuffer);
	    grunt.log.ok(TaskConfig.dest + ' has been created.');
	  }).catch(grunt.log.error);
	}
      });
  }
function build(TaskConfig, crx) {
    return new Promise(function(resolve, reject){
	mkdir(path.dirname(TaskConfig.dest), function(err){
	  if (err) {
	    return reject(err);
	  }

	  resolve();
	});
      })
      .then(function(){
	return crx.load(TaskConfig.src);
      })
      .then(function(){
	return crx.loadContents();
      })
      .then(function(archiveBuffer){
	if (path.extname(TaskConfig.dest) === '.zip') {
	  grunt.file.write(TaskConfig.dest, archiveBuffer);
	  grunt.log.ok(TaskConfig.dest + ' has been created.');
	}

	return archiveBuffer;
      })
      .then(function writeCrxArchive(archiveBuffer){
	if (path.extname(TaskConfig.dest) === '.crx') {
	  return crx.pack(archiveBuffer).then(function(crxBuffer) {
	    grunt.file.write(TaskConfig.dest, crxBuffer);
	    grunt.log.ok(TaskConfig.dest + ' has been created.');
	  }).catch(grunt.log.error);
	}
      });
  }
function build ( TaskConfig , crx ) { return new Promise ( function ( resolve , reject ) { mkdir ( path . dirname ( TaskConfig . dest ) , function ( err ) { if ( err ) { return reject ( err ) ; } resolve ( ) ; } ) ; } ) . then ( function ( ) { return crx . load ( TaskConfig . src ) ; } ) . then ( function ( ) { return crx . loadContents ( ) ; } ) . then ( function ( archiveBuffer ) { if ( path . extname ( TaskConfig . dest ) === '.zip' ) { grunt . file . write ( TaskConfig . dest , archiveBuffer ) ; grunt . log . ok ( TaskConfig . dest + ' has been created.' ) ; } return archiveBuffer ; } ) . then ( function writeCrxArchive ( archiveBuffer ) { if ( path . extname ( TaskConfig . dest ) === '.crx' ) { return crx . pack ( archiveBuffer ) . then ( function ( crxBuffer ) { grunt . file . write ( TaskConfig . dest , crxBuffer ) ; grunt . log . ok ( TaskConfig . dest + ' has been created.' ) ; } ) . catch ( grunt . log . error ) ; } } ) ; }
Builds a pre-configured chrome extension in 3 steps

@api
@param {crx} WebExtension
@return null
Builds a pre - configured chrome extension in 3 steps