@acoustic-content-sdk/cli
Version:
Command line utility for the Acoustic Content SDK.
2 lines • 8.98 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@acoustic-content-sdk/tooling"),require("@acoustic-content-sdk/utils"),require("path"),require("process"),require("rxjs/operators"),require("@acoustic-content-sdk/api"),require("commander"),require("@acoustic-content-sdk/tooling-feature-module"),require("@acoustic-content-sdk/tooling-messages"),require("@acoustic-content-sdk/tooling-types")):"function"==typeof define&&define.amd?define("@acoustic-content-sdk/cli",["exports","@acoustic-content-sdk/tooling","@acoustic-content-sdk/utils","path","process","rxjs/operators","@acoustic-content-sdk/api","commander","@acoustic-content-sdk/tooling-feature-module","@acoustic-content-sdk/tooling-messages","@acoustic-content-sdk/tooling-types"],t):t(((e=e||self)["acoustic-content-sdk"]=e["acoustic-content-sdk"]||{},e["acoustic-content-sdk"].cli={}),e["acoustic-content-sdk"].tooling,e["acoustic-content-sdk"].utils,e.path,e.process,e.rxjs.operators,e["acoustic-content-sdk"].api,e.Commander,e["acoustic-content-sdk"]["tooling-feature-module"],e["acoustic-content-sdk"]["tooling-messages"],e["acoustic-content-sdk"]["tooling-types"])}(this,(function(e,t,o,r,a,i,n,c,s,d,l){"use strict";function u(e){return o.isString(e)?e.split(","):o.isStringArray(e)?e:void 0}function p(e,t){return r.normalize(r.isAbsolute(t)?t:r.join(e,t))}function m(e){var n=e.command("canonicalize-assets").description("Rewrites the wchtools data folder in a canonical format.").option("--data <data>","Location of the data directory.").option("--dir <dir>","Location of the target directory. Defaults to the data directory.").option("--include <include>","Regular expression of the types to include.").option("--exclude <exclude>","Regular expression of the types to exclude.").action((function(c){var s=e.verbose?t.createChalkLoggerService():o.NOOP_LOGGER_SERVICE,d=s.get(n.name()),l=a.cwd(),p=r.normalize(n.data||r.join(l,"data")),m=r.normalize(n.dir||p);d.info("dataDir",p,"dstDir",m);var g=t.canonicalizeAssets({data:"/",include:u(n.include),exclude:u(n.exclude)});return o.rxPipe(g(t.createReadDirectory(p),s),t.writeFiles(m),t.logFileDescriptor(),i.ignoreElements()).toPromise()}));return n}function g(e){var n=e.command("generate-data-overlay").description("Generates an overlay of wchtools data folders for referenced modules.").option("--dir <dir>",'Location of the target directory. Defaults to "temp".').option("--src <dir>","Location of the directory that contains the package.json to analyze. Defaults to the current working directory.").action((function(){var c=e.verbose?t.createChalkLoggerService():o.NOOP_LOGGER_SERVICE,s=c.get(n.name()),d=a.cwd(),l=p(d,n.dir||"temp"),u=p(d,n.src||""),m=r.parse(u).root,g=r.parse(l).root,f=r.relative(g,l),y=r.relative(m,u);s.info("srcDir",y),s.info("dstDir",f);var h=t.generateDataOverlay({src:y});return o.rxPipe(h(t.createReadTextFile(m),t.createReadDirectory(g),c),t.writeFiles(l),t.logFileDescriptor(),i.ignoreElements()).toPromise()}));return n}function f(e){var n=e.command("generate-keys").description("Generates keys into the content.").option("--data <data>","Location of the data directory.").option("--dir <dir>","Location of the target directory. Defaults to the data directory.").option("--include <include>","Regular expression of the content items to include.").option("--exclude <exclude>","Regular expression of the content items to exclude.").action((function(){var c=e.verbose?t.createChalkLoggerService():o.NOOP_LOGGER_SERVICE,s=c.get(n.name()),d=a.cwd(),l=r.normalize(n.data||r.join(d,"data")),p=r.normalize(n.dir||l);s.info("dataDir",l,"dstDir",p);var m=t.generateKeys({data:"/",include:u(n.include),exclude:u(n.exclude)});return o.rxPipe(m(t.createReadDirectory(l),c),t.writeFiles(p),t.logFileDescriptor(),i.ignoreElements()).toPromise()}));return n}function y(e){var n=e.command("generate-layout [name]").description("Generates a layout for a particular content type.").option("--data <data>","Location of the data directory.").requiredOption("--type <type>","Name or ID of the type.").option("--dir <dir>","Location of the target directory. Defaults to the data directory.").option("--templateType <templateType>",'Type of the rendering template to use, can be "angular" or "handlebars".').option("--tags <tags>","Tags to add to the new layouts.").action((function(c){var s=e.verbose?t.createChalkLoggerService():o.NOOP_LOGGER_SERVICE,d=s.get(n.name()),l=a.cwd(),p=r.normalize(n.data||r.join(l,"data")),m=r.normalize(n.dir||p);d.info("dataDir",p,"dstDir",m);var g=t.generateLayout({data:"/",type:n.type,name:c,tags:u(n.tags),templateType:n.templateType});return o.rxPipe(g(t.createReadDirectory(p),s),t.writeFiles(m),t.logFileDescriptor(),i.ignoreElements()).toPromise()}));return n}function h(e){var n=e.command("generate-layouts").description("Generates layouts and layout mappings based on type information in a batch in the wchtools folder. The names of the artifacts are derived from the type names.").option("--data <data>","Location of the data directory.").option("--dir <dir>","Location of the target directory. Defaults to the data directory.").option("--include <include>","Regular expression of the types to include.").option("--exclude <exclude>","Regular expression of the types to exclude.").option("--templateType <templateType>",'Type of the rendering template to use, can be "angular" or "handlebars".').option("--tags <tags>","Tags to add to the new layouts.").action((function(){var c=e.verbose?t.createChalkLoggerService():o.NOOP_LOGGER_SERVICE,s=c.get(n.name()),d=a.cwd(),l=r.normalize(n.data||r.join(d,"data")),p=r.normalize(n.dir||l);s.info("dataDir",l,"dstDir",p);var m=t.generateLayouts({data:"/",tags:u(n.tags),include:u(n.include),exclude:u(n.exclude),templateType:n.templateType});return o.rxPipe(m(t.createReadDirectory(l),c),t.writeFiles(p),t.logFileDescriptor(),i.ignoreElements()).toPromise()}));return n}var v={version:{major:"9",minor:"0",patch:"10076",branch:"master"},build:new Date(1585229427693)};function x(e){var o=e.command("version",{isDefault:!0}).description("Show version info.").action((function(){t.createChalkLoggerService().get(o.name()).info("@acoustic-content-sdk/cli",n.createVersionString(v))}));return o}e.VERSION=v,e.canonicalizeAssetsCommand=m,e.generateDataOverlayCommand=g,e.generateKeysCommand=f,e.generateLayoutCommand=y,e.generateLayoutsCommand=h,e.runProgram=function(e){void 0===e&&(e=a.argv);var D=new c.Command("acoustic-content-sdk-cli").version(n.createVersionString(v)).option("-v, --verbose","print additional logs");return x(D),h(D),y(D),f(D),g(D),function(e){var r=e.command("generate-messages").description("Generate translated messages.").option("--src <directory>","Source directory").option("--dir <directory>","Target directory").option("--default <default>","Default locale").action((function(){var n=e.verbose?t.createChalkLoggerService():o.NOOP_LOGGER_SERVICE,c=n.get(r.name()),s=r.src||a.cwd(),l=r.dir||a.cwd(),u=r.default;c.info("srcDir",s),c.info("dstDir",l),c.info("defaultLocale",u);var p=d.generateMessages({dir:"/",default:u});return o.rxPipe(p(t.createReadDirectory(s),n),t.writeFiles(l),t.logFileDescriptor(),i.ignoreElements()).toPromise()}))}(D),function(e){var n=e.command("generate-types").description("Generates typings and helper methods based on a set of content type definitions.").option("--data <data>","Location of the data directory.").option("--dir <dir>",'Location of the target directory. Defaults to the "src" directory.').option("--include <include>","Regular expression of the types to include.").option("--exclude <exclude>","Regular expression of the types to exclude.").action((function(){var c=e.verbose?t.createChalkLoggerService():o.NOOP_LOGGER_SERVICE,s=c.get(n.name()),d=a.cwd(),p=r.normalize(n.data||r.join(d,"data")),m=r.normalize(n.dir||d);s.info("dataDir",p),s.info("dstDir",m);var g=l.generateTypes({data:"/",include:u(n.include),exclude:u(n.exclude)});return o.rxPipe(g(t.createReadDirectory(p),t.createReadTextFile(p),c),t.writeFiles(m),t.logFileDescriptor(),i.ignoreElements()).toPromise()}))}(D),function(e){var r=e.command("generate-feature-module").description("Adds support for the ng-add schematic to feature modules.").option("--src <dir>","Location of the directory that contains the package.json to analyze. Defaults to the current working directory.").requiredOption("--module <modules>","NgModule to export from the feature module. May be a comma separated list.").action((function(){var n=e.verbose?t.createChalkLoggerService():o.NOOP_LOGGER_SERVICE,c=n.get(r.name()),d=a.cwd(),l=r.module,u=p(d,r.src||"");c.info("module",l),c.info("srcDir",u);var m=s.generateFeatureModule({module:l});return o.rxPipe(m(t.createReadTextFile(u),n),t.writeFiles(u),t.logFileDescriptor(),i.ignoreElements()).toPromise()}))}(D),m(D),D.parse(e)},e.versionCommand=x,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=acoustic-content-sdk-cli.umd.min.js.map