schema.d.ts 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * Creates a new directive in your project. Directives are used to extend the behavior or
  3. * appearance of HTML elements and components. They allow you to manipulate the DOM, add
  4. * custom attributes, and respond to events. This schematic generates the necessary files
  5. * and boilerplate code for a new directive.
  6. */
  7. export type Schema = {
  8. /**
  9. * Automatically export the directive from the specified NgModule, making it accessible to
  10. * other modules in the application.
  11. */
  12. export?: boolean;
  13. /**
  14. * Creates the new directive files at the top level of the current project. If set to false,
  15. * a new folder with the directive's name will be created to contain the files.
  16. */
  17. flat?: boolean;
  18. /**
  19. * Specify the NgModule where the directive should be declared. If not provided, the CLI
  20. * will attempt to find the closest NgModule in the directive's path.
  21. */
  22. module?: string;
  23. /**
  24. * The name for the new directive. This will be used to create the directive's class and
  25. * spec files (e.g., `my-directive.directive.ts` and `my-directive.directive.spec.ts`).
  26. */
  27. name: string;
  28. /**
  29. * The path where the directive files should be created, relative to the workspace root. If
  30. * not provided, the directive will be created in the current directory.
  31. */
  32. path?: string;
  33. /**
  34. * A prefix to be added to the directive's selector. For example, if the prefix is `app` and
  35. * the directive name is `highlight`, the selector will be `appHighlight`.
  36. */
  37. prefix?: string;
  38. /**
  39. * The name of the project where the directive should be added. If not specified, the CLI
  40. * will determine the project from the current directory.
  41. */
  42. project: string;
  43. /**
  44. * The HTML selector to use for this directive. If not provided, a selector will be
  45. * generated based on the directive's name (e.g., `appHighlight`).
  46. */
  47. selector?: string;
  48. /**
  49. * Do not automatically import the new directive into its closest NgModule.
  50. */
  51. skipImport?: boolean;
  52. /**
  53. * Skip the generation of a unit test file `spec.ts` for the new directive.
  54. */
  55. skipTests?: boolean;
  56. /**
  57. * Generate a standalone directive. Standalone directives are self-contained and don't need
  58. * to be declared in an NgModule. They can be used independently or imported directly into
  59. * other standalone components or directives.
  60. */
  61. standalone?: boolean;
  62. };