@feeloor/ng-extension-schematics
Version:
Angular extension schematics
36 lines (33 loc) • 1.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const schematics_1 = require("@angular-devkit/schematics");
const core_1 = require("@angular-devkit/core");
const utility_1 = require("../utility");
function default_1(options) {
return schematics_1.chain([
schematics_1.externalSchematic('@schematics/angular', 'module', options),
(tree, _context) => {
const parsedPath = core_1.normalize(options.path + '/' + options.name);
// Creating barrel for Module
tree.create(core_1.normalize(parsedPath + '/index.ts'), `
// Components
export * from './components';
// Pipes
export * from './pipes';
// Directives
export * from './directives';
// Module
export * from './${options.name}.module';
`);
// Creating barrel and folder for all Components
tree.create(core_1.normalize(parsedPath + '/components/index.ts'), utility_1.getDefaultIndexTS());
// Creating barrel and folder for all Pipes
tree.create(core_1.normalize(parsedPath + '/pipes/index.ts'), utility_1.getDefaultIndexTS());
// Creating barrel and folder for all Directives
tree.create(core_1.normalize(parsedPath + '/directives/index.ts'), utility_1.getDefaultIndexTS());
return tree;
}
]);
}
exports.default = default_1;
//# sourceMappingURL=index.js.map