@feeloor/ng-extension-schematics
Version:
Angular extension schematics
46 lines (41 loc) • 1.81 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'), `
// Services
export * from './services';
// Models
export * from './models';
// Guards
export * from './guards';
// Interceptors
export * from './interceptors';
// Resolvers
export * from './resolvers';
// Module
export * from './${options.name}.module';
`);
// Creating barrel and folder for all Services
tree.create(core_1.normalize(parsedPath + '/services/index.ts'), utility_1.getDefaultIndexTS());
// Creating barrel and folder for all Models
tree.create(core_1.normalize(parsedPath + '/models/index.ts'), utility_1.getDefaultIndexTS());
// Creating barrel and folder for all Guards
tree.create(core_1.normalize(parsedPath + '/guards/index.ts'), utility_1.getDefaultIndexTS());
// Creating barrel and folder for all Interceptors
tree.create(core_1.normalize(parsedPath + '/interceptors/index.ts'), utility_1.getDefaultIndexTS());
// Creating barrel and folder for all Resolvers
tree.create(core_1.normalize(parsedPath + '/resolvers/index.ts'), utility_1.getDefaultIndexTS());
return tree;
}
]);
}
exports.default = default_1;
//# sourceMappingURL=index.js.map