lib/clientlib.js
function writeClientLibJson(item, options) {
  var content = {
    'jcr:primaryType': 'cq:ClientLibraryFolder'
  };

  // if categories is a config entry append the values to the array, else use item.name
  if (item.hasOwnProperty('categories')) {
    content.categories = item['categories'];
  } else {
    content.categories = [item.name];
  }

  clientLibDirectoryFields.forEach(function (nodeKey) {
    if (item.hasOwnProperty(nodeKey)) {
      content[nodeKey] = item[nodeKey];
    }
  });


  var jsonFile = path.join(item.path, item.name + ".json");
  options.verbose && console.log("write clientlib json file: " + jsonFile);
  if (!options.dry) {
    fse.writeJsonSync(jsonFile, content, {spaces: 2});
  }
}
function writeClientLibJson(item, options) {
  var content = {
    'jcr:primaryType': 'cq:ClientLibraryFolder'
  };

  // if categories is a config entry append the values to the array, else use item.name
  if (item.hasOwnProperty('categories')) {
    content.categories = item['categories'];
  } else {
    content.categories = [item.name];
  }

  clientLibDirectoryFields.forEach(function (nodeKey) {
    if (item.hasOwnProperty(nodeKey)) {
      content[nodeKey] = item[nodeKey];
    }
  });


  var jsonFile = path.join(item.path, item.name + ".json");
  options.verbose && console.log("write clientlib json file: " + jsonFile);
  if (!options.dry) {
    fse.writeJsonSync(jsonFile, content, {spaces: 2});
  }
}
function writeClientLibJson ( item , options ) { var content = { 'jcr:primaryType' : 'cq:ClientLibraryFolder' } ; // if categories is a config entry append the values to the array, else use item.name if ( item . hasOwnProperty ( 'categories' ) ) { content . categories = item [ 'categories' ] ; } else { content . categories = [ item . name ] ; } clientLibDirectoryFields . forEach ( function ( nodeKey ) { if ( item . hasOwnProperty ( nodeKey ) ) { content [ nodeKey ] = item [ nodeKey ] ; } } ) ; var jsonFile = path . join ( item . path , item . name + ".json" ) ; options . verbose && console . log ( "write clientlib json file: " + jsonFile ) ; if ( ! options . dry ) { fse . writeJsonSync ( jsonFile , content , { spaces : 2 } ) ; } }
Write a configuration JSON file for a clientlib
with the given properties in `item`
@param {ClientLibItem} item - clientlib configuration properties
@param {Object} options - further options
Write a configuration JSON file for a clientlib with the given properties in item