lib/inject.js
function moveModuleUp(source, target, module) {
  const targetZip = new JSZip();

  return fse
    .readFileAsync(source)
    .then(buffer => JSZip.loadAsync(buffer))
    .then(sourceZip => sourceZip.filter(file => file.startsWith(module + '/')))
    .map(srcZipObj =>
      zipFile(
        targetZip,
        srcZipObj.name.replace(module + '/', ''),
        srcZipObj.async('nodebuffer')
      )
    )
    .then(() => writeZip(targetZip, target));
}
function moveModuleUp(source, target, module) {
  const targetZip = new JSZip();

  return fse
    .readFileAsync(source)
    .then(buffer => JSZip.loadAsync(buffer))
    .then(sourceZip => sourceZip.filter(file => file.startsWith(module + '/')))
    .map(srcZipObj =>
      zipFile(
        targetZip,
        srcZipObj.name.replace(module + '/', ''),
        srcZipObj.async('nodebuffer')
      )
    )
    .then(() => writeZip(targetZip, target));
}
function moveModuleUp ( source , target , module ) { const targetZip = new JSZip ( ) ; return fse . readFileAsync ( source ) . then ( buffer => JSZip . loadAsync ( buffer ) ) . then ( sourceZip => sourceZip . filter ( file => file . startsWith ( module + '/' ) ) ) . map ( srcZipObj => zipFile ( targetZip , srcZipObj . name . replace ( module + '/' , '' ) , srcZipObj . async ( 'nodebuffer' ) ) ) . then ( ( ) => writeZip ( targetZip , target ) ) ; }
Remove all modules but the selected module from a package.
@param {string} source path to original package
@param {string} target path to result package
@param {string} module module to keep
@return {Promise} the JSZip object written out.
Remove all modules but the selected module from a package .