@ngrx/schematics
Version:
NgRx Schematics for Angular
24 lines • 1.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const schematics_1 = require("@angular-devkit/schematics");
const schematics_core_1 = require("../../schematics-core");
function default_1(options) {
return (host, context) => {
options.path = (0, schematics_core_1.getProjectPath)(host, options);
options.prefix = (0, schematics_core_1.getPrefix)(options);
const parsedPath = (0, schematics_core_1.parseName)(options.path, options.name);
options.name = parsedPath.name;
options.path = parsedPath.path;
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
(0, schematics_1.applyTemplates)({
...schematics_core_1.stringUtils,
'if-flat': (s) => schematics_core_1.stringUtils.group(options.flat ? '' : s, options.group ? 'actions' : ''),
...options,
}),
(0, schematics_1.move)(parsedPath.path),
]);
return (0, schematics_1.chain)([(0, schematics_1.branchAndMerge)((0, schematics_1.chain)([(0, schematics_1.mergeWith)(templateSource)]))])(host, context);
};
}
//# sourceMappingURL=index.js.map