index.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. "use strict";
  2. /**
  3. * @license
  4. * Copyright Google LLC All Rights Reserved.
  5. *
  6. * Use of this source code is governed by an MIT-style license that can be
  7. * found in the LICENSE file at https://angular.dev/license
  8. */
  9. Object.defineProperty(exports, "__esModule", { value: true });
  10. exports.default = default_1;
  11. const schematics_1 = require("@angular-devkit/schematics");
  12. const schematics_2 = require("@angular/cdk/schematics");
  13. /**
  14. * Scaffolds a new navigation component.
  15. * Internally it bootstraps the base component schematic
  16. */
  17. function default_1(options) {
  18. return (0, schematics_1.chain)([
  19. (0, schematics_2.buildComponent)({ ...options }, {
  20. template: './__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template',
  21. stylesheet: './__path__/__name@dasherize@if-flat__/__name@dasherize__.component.__style__.template',
  22. }),
  23. options.skipImport ? (0, schematics_1.noop)() : addNavModulesToModule(options),
  24. ]);
  25. }
  26. /**
  27. * Adds the required modules to the relative module.
  28. */
  29. function addNavModulesToModule(options) {
  30. return async (host) => {
  31. const isStandalone = await (0, schematics_2.isStandaloneSchematic)(host, options);
  32. if (!isStandalone) {
  33. const modulePath = (await (0, schematics_2.findModuleFromOptions)(host, options));
  34. (0, schematics_2.addModuleImportToModule)(host, modulePath, 'MatToolbarModule', '@angular/material/toolbar');
  35. (0, schematics_2.addModuleImportToModule)(host, modulePath, 'MatButtonModule', '@angular/material/button');
  36. (0, schematics_2.addModuleImportToModule)(host, modulePath, 'MatSidenavModule', '@angular/material/sidenav');
  37. (0, schematics_2.addModuleImportToModule)(host, modulePath, 'MatIconModule', '@angular/material/icon');
  38. (0, schematics_2.addModuleImportToModule)(host, modulePath, 'MatListModule', '@angular/material/list');
  39. }
  40. };
  41. }
  42. //# sourceMappingURL=index.js.map