lib/clientlib.js
function processItem(item, options, processDone) {

  if (!item.path) {
    item.path = options.clientLibRoot;
  }

  options.verbose && console.log("\n\nprocessing clientlib: " + item.name);

  // remove current files if exists
  removeClientLib(item, function (err) {

    var clientLibPath = item.outputPath || path.join(item.path, item.name);

    // create clientlib directory
    fse.mkdirsSync(clientLibPath);

    var serializationFormat = (item.serializationFormat === SERIALIZATION_FORMAT_XML) ? SERIALIZATION_FORMAT_XML : SERIALIZATION_FORMAT_JSON;

    options.verbose && console.log("Write node configuration using serialization format: " + serializationFormat);

    if (serializationFormat === SERIALIZATION_FORMAT_JSON) {
        // write configuration JSON
        writeClientLibJson(item, options);
    } else {
        writeClientLibXml(item, options);
    }

    var assetList = normalizeAssets(clientLibPath, item.assets);

    // iterate through assets
    async.eachSeries(assetList, function (asset, assetDone) {

      // write clientlib creator files
      if (asset.type === "js" || asset.type === "css") {
        options.verbose && console.log("");
        writeAssetTxt(clientLibPath, asset, options);
      }

      // copy files for given asset
      async.eachSeries(asset.files, function (fileItem, copyDone) {
        if (fileItem.src == fileItem.dest) {
          options.verbose && console.log(`${fileItem.src} already in output directory`);
          return copyDone();
        }
        options.verbose && console.log("copy:", fileItem.src, fileItem.dest);
        if (options.dry) {
          return copyDone();
        }

        // create directories separately or it will be copied recursively
        if (fs.lstatSync(fileItem.src).isDirectory()) {
          fs.mkdir(fileItem.dest, copyDone);
        } else {
          fse.copy(fileItem.src, fileItem.dest, copyDone);
        }
      }, assetDone);

    }, processDone);
  });
}
function processItem(item, options, processDone) {

  if (!item.path) {
    item.path = options.clientLibRoot;
  }

  options.verbose && console.log("\n\nprocessing clientlib: " + item.name);

  // remove current files if exists
  removeClientLib(item, function (err) {

    var clientLibPath = item.outputPath || path.join(item.path, item.name);

    // create clientlib directory
    fse.mkdirsSync(clientLibPath);

    var serializationFormat = (item.serializationFormat === SERIALIZATION_FORMAT_XML) ? SERIALIZATION_FORMAT_XML : SERIALIZATION_FORMAT_JSON;

    options.verbose && console.log("Write node configuration using serialization format: " + serializationFormat);

    if (serializationFormat === SERIALIZATION_FORMAT_JSON) {
        // write configuration JSON
        writeClientLibJson(item, options);
    } else {
        writeClientLibXml(item, options);
    }

    var assetList = normalizeAssets(clientLibPath, item.assets);

    // iterate through assets
    async.eachSeries(assetList, function (asset, assetDone) {

      // write clientlib creator files
      if (asset.type === "js" || asset.type === "css") {
        options.verbose && console.log("");
        writeAssetTxt(clientLibPath, asset, options);
      }

      // copy files for given asset
      async.eachSeries(asset.files, function (fileItem, copyDone) {
        if (fileItem.src == fileItem.dest) {
          options.verbose && console.log(`${fileItem.src} already in output directory`);
          return copyDone();
        }
        options.verbose && console.log("copy:", fileItem.src, fileItem.dest);
        if (options.dry) {
          return copyDone();
        }

        // create directories separately or it will be copied recursively
        if (fs.lstatSync(fileItem.src).isDirectory()) {
          fs.mkdir(fileItem.dest, copyDone);
        } else {
          fse.copy(fileItem.src, fileItem.dest, copyDone);
        }
      }, assetDone);

    }, processDone);
  });
}
function processItem ( item , options , processDone ) { if ( ! item . path ) { item . path = options . clientLibRoot ; } options . verbose && console . log ( "\n\nprocessing clientlib: " + item . name ) ; // remove current files if exists removeClientLib ( item , function ( err ) { var clientLibPath = item . outputPath || path . join ( item . path , item . name ) ; // create clientlib directory fse . mkdirsSync ( clientLibPath ) ; var serializationFormat = ( item . serializationFormat === SERIALIZATION_FORMAT_XML ) ? SERIALIZATION_FORMAT_XML : SERIALIZATION_FORMAT_JSON ; options . verbose && console . log ( "Write node configuration using serialization format: " + serializationFormat ) ; if ( serializationFormat === SERIALIZATION_FORMAT_JSON ) { // write configuration JSON writeClientLibJson ( item , options ) ; } else { writeClientLibXml ( item , options ) ; } var assetList = normalizeAssets ( clientLibPath , item . assets ) ; // iterate through assets async . eachSeries ( assetList , function ( asset , assetDone ) { // write clientlib creator files if ( asset . type === "js" || asset . type === "css" ) { options . verbose && console . log ( "" ) ; writeAssetTxt ( clientLibPath , asset , options ) ; } // copy files for given asset async . eachSeries ( asset . files , function ( fileItem , copyDone ) { if ( fileItem . src == fileItem . dest ) { options . verbose && console . log ( ` ${ fileItem . src } ` ) ; return copyDone ( ) ; } options . verbose && console . log ( "copy:" , fileItem . src , fileItem . dest ) ; if ( options . dry ) { return copyDone ( ) ; } // create directories separately or it will be copied recursively if ( fs . lstatSync ( fileItem . src ) . isDirectory ( ) ) { fs . mkdir ( fileItem . dest , copyDone ) ; } else { fse . copy ( fileItem . src , fileItem . dest , copyDone ) ; } } , assetDone ) ; } , processDone ) ; } ) ; }
Process the given clientlib configuration object.
@param {ClientLibItem} item - clientlib configuration object
@param {Object} options - configuration options
@param {Function} processDone - to be called if everything is done
Process the given clientlib configuration object .