@nx/angular 17.0.0-beta.1 → 17.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/executors.json +0 -20
  2. package/generators.d.ts +1 -0
  3. package/generators.js +1 -0
  4. package/generators.json +7 -149
  5. package/package.json +11 -11
  6. package/src/executors/ng-packagr-lite/schema.json +0 -13
  7. package/src/executors/package/package.impl.js +2 -8
  8. package/src/executors/package/schema.d.ts +0 -12
  9. package/src/executors/package/schema.json +0 -13
  10. package/src/generators/component/component.d.ts +1 -0
  11. package/src/generators/component/component.js +17 -13
  12. package/src/generators/component/files/__fileName__.html__tpl__ +1 -0
  13. package/src/generators/component/files/__fileName__.spec.ts__tpl__ +22 -0
  14. package/src/generators/component/files/{__fileName__.__type__.ts__tpl__ → __fileName__.ts__tpl__} +4 -4
  15. package/src/generators/component/lib/module.js +2 -2
  16. package/src/generators/component/lib/normalize-options.d.ts +1 -1
  17. package/src/generators/component/lib/normalize-options.js +19 -6
  18. package/src/generators/component/lib/validate-options.js +0 -2
  19. package/src/generators/component/schema.d.ts +21 -3
  20. package/src/generators/component/schema.json +24 -17
  21. package/src/generators/directive/directive.js +6 -7
  22. package/src/generators/directive/files/__fileName__.spec.ts__tpl__ +8 -0
  23. package/src/generators/directive/files/{__directiveFileName__.directive.ts__tpl__ → __fileName__.ts__tpl__} +1 -1
  24. package/src/generators/directive/lib/normalize-options.d.ts +1 -1
  25. package/src/generators/directive/lib/normalize-options.js +20 -8
  26. package/src/generators/directive/lib/validate-options.js +0 -2
  27. package/src/generators/directive/schema.d.ts +20 -4
  28. package/src/generators/directive/schema.json +15 -11
  29. package/src/generators/federate-module/federate-module.d.ts +4 -0
  30. package/src/generators/federate-module/federate-module.js +39 -0
  31. package/src/generators/federate-module/lib/add-file-to-remote-tsconfig.d.ts +2 -0
  32. package/src/generators/federate-module/lib/add-file-to-remote-tsconfig.js +15 -0
  33. package/src/generators/federate-module/lib/add-path-to-exposes.d.ts +8 -0
  34. package/src/generators/federate-module/lib/add-path-to-exposes.js +78 -0
  35. package/src/generators/federate-module/lib/add-path-to-ts-config.d.ts +8 -0
  36. package/src/generators/federate-module/lib/add-path-to-ts-config.js +12 -0
  37. package/src/generators/federate-module/lib/add-remote.d.ts +7 -0
  38. package/src/generators/federate-module/lib/add-remote.js +47 -0
  39. package/src/generators/federate-module/lib/check-remote-exists.d.ts +2 -0
  40. package/src/generators/federate-module/lib/check-remote-exists.js +22 -0
  41. package/src/generators/federate-module/lib/index.d.ts +4 -0
  42. package/src/generators/federate-module/lib/index.js +7 -0
  43. package/src/generators/federate-module/schema.d.ts +14 -0
  44. package/src/generators/federate-module/schema.json +77 -0
  45. package/src/generators/move/lib/update-ng-package.js +3 -6
  46. package/src/generators/pipe/files/__fileName__.spec.ts__tpl__ +8 -0
  47. package/src/generators/pipe/files/{__pipeFileName__.pipe.ts__tpl__ → __fileName__.ts__tpl__} +2 -2
  48. package/src/generators/pipe/lib/normalize-options.d.ts +1 -1
  49. package/src/generators/pipe/lib/normalize-options.js +20 -7
  50. package/src/generators/pipe/lib/validate-options.js +0 -2
  51. package/src/generators/pipe/pipe.js +7 -7
  52. package/src/generators/pipe/schema.d.ts +20 -4
  53. package/src/generators/pipe/schema.json +15 -11
  54. package/src/generators/scam/lib/convert-component-to-scam.js +3 -6
  55. package/src/generators/scam/lib/normalize-options.d.ts +1 -1
  56. package/src/generators/scam/lib/normalize-options.js +18 -5
  57. package/src/generators/scam/scam.js +1 -1
  58. package/src/generators/scam/schema.d.ts +18 -3
  59. package/src/generators/scam/schema.json +25 -18
  60. package/src/generators/scam-directive/lib/convert-directive-to-scam.js +3 -6
  61. package/src/generators/scam-directive/lib/normalize-options.d.ts +1 -1
  62. package/src/generators/scam-directive/lib/normalize-options.js +17 -7
  63. package/src/generators/scam-directive/scam-directive.js +1 -1
  64. package/src/generators/scam-directive/schema.d.ts +18 -5
  65. package/src/generators/scam-directive/schema.json +24 -17
  66. package/src/generators/scam-pipe/lib/convert-pipe-to-scam.js +3 -6
  67. package/src/generators/scam-pipe/lib/normalize-options.d.ts +1 -1
  68. package/src/generators/scam-pipe/lib/normalize-options.js +17 -7
  69. package/src/generators/scam-pipe/scam-pipe.js +1 -1
  70. package/src/generators/scam-pipe/schema.d.ts +18 -5
  71. package/src/generators/scam-pipe/schema.json +23 -16
  72. package/src/generators/utils/find-module.js +4 -1
  73. package/src/executors/browser-esbuild/compat.d.ts +0 -2
  74. package/src/executors/browser-esbuild/compat.js +0 -5
  75. package/src/executors/delegate-build/compat.d.ts +0 -2
  76. package/src/executors/delegate-build/compat.js +0 -5
  77. package/src/executors/ng-packagr-lite/compat.d.ts +0 -2
  78. package/src/executors/ng-packagr-lite/compat.js +0 -5
  79. package/src/executors/package/compat.d.ts +0 -2
  80. package/src/executors/package/compat.js +0 -5
  81. package/src/generators/add-linting/compat.d.ts +0 -2
  82. package/src/generators/add-linting/compat.js +0 -6
  83. package/src/generators/application/application.compat.d.ts +0 -1
  84. package/src/generators/application/application.compat.js +0 -7
  85. package/src/generators/component/component.compat.d.ts +0 -2
  86. package/src/generators/component/component.compat.js +0 -6
  87. package/src/generators/component/files/__fileName__.__type__.html__tpl__ +0 -1
  88. package/src/generators/component/files/__fileName__.__type__.spec.ts__tpl__ +0 -22
  89. package/src/generators/component-cypress-spec/compat.d.ts +0 -2
  90. package/src/generators/component-cypress-spec/compat.js +0 -6
  91. package/src/generators/component-story/compat.d.ts +0 -2
  92. package/src/generators/component-story/compat.js +0 -6
  93. package/src/generators/component-test/compat.d.ts +0 -2
  94. package/src/generators/component-test/compat.js +0 -6
  95. package/src/generators/convert-to-with-mf/convert-to-with-mf.compat.d.ts +0 -2
  96. package/src/generators/convert-to-with-mf/convert-to-with-mf.compat.js +0 -6
  97. package/src/generators/cypress-component-configuration/compat.d.ts +0 -2
  98. package/src/generators/cypress-component-configuration/compat.js +0 -6
  99. package/src/generators/directive/files/__directiveFileName__.directive.spec.ts__tpl__ +0 -8
  100. package/src/generators/host/host.compat.d.ts +0 -2
  101. package/src/generators/host/host.compat.js +0 -6
  102. package/src/generators/init/init.compat.d.ts +0 -1
  103. package/src/generators/init/init.compat.js +0 -7
  104. package/src/generators/library/library.compat.d.ts +0 -1
  105. package/src/generators/library/library.compat.js +0 -7
  106. package/src/generators/library-secondary-entry-point/compat.d.ts +0 -2
  107. package/src/generators/library-secondary-entry-point/compat.js +0 -6
  108. package/src/generators/move/compat.d.ts +0 -1
  109. package/src/generators/move/compat.js +0 -7
  110. package/src/generators/ng-add/compat.d.ts +0 -2
  111. package/src/generators/ng-add/compat.js +0 -5
  112. package/src/generators/ngrx/compat.d.ts +0 -2
  113. package/src/generators/ngrx/compat.js +0 -6
  114. package/src/generators/pipe/files/__pipeFileName__.pipe.spec.ts__tpl__ +0 -8
  115. package/src/generators/remote/remote.compat.d.ts +0 -2
  116. package/src/generators/remote/remote.compat.js +0 -6
  117. package/src/generators/scam/scam.compat.d.ts +0 -2
  118. package/src/generators/scam/scam.compat.js +0 -6
  119. package/src/generators/scam-directive/scam-directive.compat.d.ts +0 -2
  120. package/src/generators/scam-directive/scam-directive.compat.js +0 -6
  121. package/src/generators/scam-pipe/scam-pipe.compat.d.ts +0 -2
  122. package/src/generators/scam-pipe/scam-pipe.compat.js +0 -6
  123. package/src/generators/scam-to-standalone/compat.d.ts +0 -2
  124. package/src/generators/scam-to-standalone/compat.js +0 -6
  125. package/src/generators/setup-mf/setup-mf.compat.d.ts +0 -2
  126. package/src/generators/setup-mf/setup-mf.compat.js +0 -6
  127. package/src/generators/setup-ssr/setup-ssr.compat.d.ts +0 -2
  128. package/src/generators/setup-ssr/setup-ssr.compat.js +0 -6
  129. package/src/generators/setup-tailwind/setup-tailwind.compat.d.ts +0 -2
  130. package/src/generators/setup-tailwind/setup-tailwind.compat.js +0 -6
  131. package/src/generators/stories/compat.d.ts +0 -2
  132. package/src/generators/stories/compat.js +0 -6
  133. package/src/generators/storybook-configuration/compat.d.ts +0 -2
  134. package/src/generators/storybook-configuration/compat.js +0 -6
  135. package/src/generators/utils/warn-for-schematic-usage.d.ts +0 -1
  136. package/src/generators/utils/warn-for-schematic-usage.js +0 -8
  137. package/src/generators/web-worker/compat.d.ts +0 -2
  138. package/src/generators/web-worker/compat.js +0 -6
  139. /package/src/generators/component/files/{__fileName__.__type__.__style__ → __fileName__.__style__} +0 -0
package/executors.json CHANGED
@@ -22,21 +22,6 @@
22
22
  }
23
23
  },
24
24
  "builders": {
25
- "delegate-build": {
26
- "implementation": "./src/executors/delegate-build/compat",
27
- "schema": "./src/executors/delegate-build/schema.json",
28
- "description": "Delegates the build to a different target while supporting incremental builds."
29
- },
30
- "ng-packagr-lite": {
31
- "implementation": "./src/executors/ng-packagr-lite/compat",
32
- "schema": "./src/executors/ng-packagr-lite/schema.json",
33
- "description": "Builds a library with support for incremental builds.\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nrwl/angular:package` executor but with some key differences:\n- It doesn't run `ngcc` automatically (`ngcc` needs to be run separately beforehand if needed, this can be done in a `postinstall` hook on `package.json`)\n- It only produces ESM2020 bundles\n- It doesn't generate package exports in the `package.json`"
34
- },
35
- "package": {
36
- "implementation": "./src/executors/package/compat",
37
- "schema": "./src/executors/package/schema.json",
38
- "description": "Builds and packages an Angular library to be distributed as an NPM package. It supports incremental builds."
39
- },
40
25
  "webpack-browser": {
41
26
  "implementation": "./src/builders/webpack-browser/webpack-browser.impl",
42
27
  "schema": "./src/builders/webpack-browser/schema.json",
@@ -61,11 +46,6 @@
61
46
  "implementation": "./src/builders/module-federation-dev-ssr/module-federation-dev-ssr.impl",
62
47
  "schema": "./src/builders/module-federation-dev-ssr/schema.json",
63
48
  "description": "The module-federation-dev-ssr executor is reserved exclusively for use with host Module Federation applications that use SSR. It allows the user to specify which remote applications should be served with the host."
64
- },
65
- "browser-esbuild": {
66
- "implementation": "./src/executors/browser-esbuild/compat",
67
- "schema": "./src/executors/browser-esbuild/schema.json",
68
- "description": "Builds your application with esbuild and adds support for incremental builds."
69
49
  }
70
50
  }
71
51
  }
package/generators.d.ts CHANGED
@@ -4,6 +4,7 @@ export * from './src/generators/component-cypress-spec/component-cypress-spec';
4
4
  export * from './src/generators/component-story/component-story';
5
5
  export * from './src/generators/component/component';
6
6
  export * from './src/generators/directive/directive';
7
+ export * from './src/generators/federate-module/federate-module';
7
8
  export * from './src/generators/host/host';
8
9
  export * from './src/generators/init/init';
9
10
  export * from './src/generators/library-secondary-entry-point/library-secondary-entry-point';
package/generators.js CHANGED
@@ -7,6 +7,7 @@ tslib_1.__exportStar(require("./src/generators/component-cypress-spec/component-
7
7
  tslib_1.__exportStar(require("./src/generators/component-story/component-story"), exports);
8
8
  tslib_1.__exportStar(require("./src/generators/component/component"), exports);
9
9
  tslib_1.__exportStar(require("./src/generators/directive/directive"), exports);
10
+ tslib_1.__exportStar(require("./src/generators/federate-module/federate-module"), exports);
10
11
  tslib_1.__exportStar(require("./src/generators/host/host"), exports);
11
12
  tslib_1.__exportStar(require("./src/generators/init/init"), exports);
12
13
  tslib_1.__exportStar(require("./src/generators/library-secondary-entry-point/library-secondary-entry-point"), exports);
package/generators.json CHANGED
@@ -2,154 +2,6 @@
2
2
  "name": "Nx Angular",
3
3
  "version": "0.1",
4
4
  "extends": ["@schematics/angular", "@nx/workspace"],
5
- "schematics": {
6
- "add-linting": {
7
- "factory": "./src/generators/add-linting/compat",
8
- "schema": "./src/generators/add-linting/schema.json",
9
- "description": "Adds linting configuration to an Angular project.",
10
- "hidden": true
11
- },
12
- "application": {
13
- "factory": "./src/generators/application/application.compat#applicationSchematic",
14
- "schema": "./src/generators/application/schema.json",
15
- "aliases": ["app"],
16
- "x-type": "application",
17
- "description": "Creates an Angular application."
18
- },
19
- "component": {
20
- "factory": "./src/generators/component/component.compat",
21
- "schema": "./src/generators/component/schema.json",
22
- "aliases": ["c"],
23
- "description": "Generate an Angular Component."
24
- },
25
- "component-cypress-spec": {
26
- "factory": "./src/generators/component-cypress-spec/compat",
27
- "schema": "./src/generators/component-cypress-spec/schema.json",
28
- "description": "Creates a Cypress spec for a UI component that has a story.",
29
- "hidden": true
30
- },
31
- "component-story": {
32
- "factory": "./src/generators/component-story/compat",
33
- "schema": "./src/generators/component-story/schema.json",
34
- "description": "Creates a `stories.ts` file for a component.",
35
- "hidden": true
36
- },
37
- "component-test": {
38
- "factory": "./src/generators/component-test/compat",
39
- "schema": "./src/generators/component-test/schema.json",
40
- "description": "Creates a cypress component test file for a component."
41
- },
42
- "init": {
43
- "factory": "./src/generators/init/init.compat#initSchematic",
44
- "schema": "./src/generators/init/schema.json",
45
- "description": "Initializes the `@nrwl/angular` plugin.",
46
- "hidden": true
47
- },
48
- "library": {
49
- "factory": "./src/generators/library/library.compat#librarySchematic",
50
- "schema": "./src/generators/library/schema.json",
51
- "aliases": ["lib"],
52
- "x-type": "library",
53
- "description": "Creates an Angular library."
54
- },
55
- "library-secondary-entry-point": {
56
- "factory": "./src/generators/library-secondary-entry-point/compat",
57
- "schema": "./src/generators/library-secondary-entry-point/schema.json",
58
- "aliases": ["secondary-entry-point", "entry-point"],
59
- "description": "Creates a secondary entry point for an Angular publishable library."
60
- },
61
- "remote": {
62
- "factory": "./src/generators/remote/remote.compat",
63
- "schema": "./src/generators/remote/schema.json",
64
- "x-type": "application",
65
- "description": "Generate a Remote Angular Module Federation Application."
66
- },
67
- "move": {
68
- "factory": "./src/generators/move/compat",
69
- "schema": "./src/generators/move/schema.json",
70
- "aliases": ["mv"],
71
- "description": "Moves an Angular application or library to another folder within the workspace and updates the project configuration.",
72
- "x-deprecated": "Use the `@nx/workspace:move` generator instead. This generator will be removed in Nx v18."
73
- },
74
- "convert-to-with-mf": {
75
- "factory": "./src/generators/convert-to-with-mf/convert-to-with-mf.compat",
76
- "schema": "./src/generators/convert-to-with-mf/schema.json",
77
- "description": "Converts an old micro frontend configuration to use the new `withModuleFederation` helper. It will run successfully if the following conditions are met: \n - Is either a host or remote application \n - Shared npm package configurations have not been modified \n - Name used to identify the Micro Frontend application matches the project name \n\n{% callout type=\"warning\" title=\"Overrides\" %}This generator will overwrite your webpack config. If you have additional custom configuration in your config file, it will be lost!{% /callout %}"
78
- },
79
- "host": {
80
- "factory": "./src/generators/host/host.compat",
81
- "schema": "./src/generators/host/schema.json",
82
- "x-type": "application",
83
- "description": "Generate a Host Angular Module Federation Application."
84
- },
85
- "ng-add": {
86
- "factory": "./src/generators/ng-add/compat",
87
- "schema": "./src/generators/ng-add/schema.json",
88
- "description": "Migrates an Angular CLI workspace to Nx or adds the Angular plugin to an Nx workspace.",
89
- "hidden": true
90
- },
91
- "ngrx": {
92
- "factory": "./src/generators/ngrx/compat",
93
- "schema": "./src/generators/ngrx/schema.json",
94
- "description": "Adds NgRx support to an application or library.",
95
- "x-deprecated": "This generator is deprecated and will be removed in a future version of Nx. Use the 'ngrx-root-store' and 'ngrx-feature-store' generators instead."
96
- },
97
- "scam-to-standalone": {
98
- "factory": "./src/generators/scam-to-standalone/compat",
99
- "schema": "./src/generators/scam-to-standalone/schema.json",
100
- "description": "Convert an existing Single Component Angular Module (SCAM) to a Standalone Component."
101
- },
102
- "scam": {
103
- "factory": "./src/generators/scam/scam.compat",
104
- "schema": "./src/generators/scam/schema.json",
105
- "description": "Generate a component with an accompanying Single Component Angular Module (SCAM)."
106
- },
107
- "scam-directive": {
108
- "factory": "./src/generators/scam-directive/scam-directive.compat",
109
- "schema": "./src/generators/scam-directive/schema.json",
110
- "description": "Generate a directive with an accompanying Single Component Angular Module (SCAM)."
111
- },
112
- "scam-pipe": {
113
- "factory": "./src/generators/scam-pipe/scam-pipe.compat",
114
- "schema": "./src/generators/scam-pipe/schema.json",
115
- "description": "Generate a pipe with an accompanying Single Component Angular Module (SCAM)."
116
- },
117
- "setup-mf": {
118
- "factory": "./src/generators/setup-mf/setup-mf.compat",
119
- "schema": "./src/generators/setup-mf/schema.json",
120
- "description": "Generate a Module Federation configuration for a given Angular application."
121
- },
122
- "setup-ssr": {
123
- "factory": "./src/generators/setup-ssr/setup-ssr.compat",
124
- "schema": "./src/generators/setup-ssr/schema.json",
125
- "description": "Generate Angular Universal (SSR) setup for an Angular application."
126
- },
127
- "setup-tailwind": {
128
- "factory": "./src/generators/setup-tailwind/setup-tailwind.compat",
129
- "schema": "./src/generators/setup-tailwind/schema.json",
130
- "description": "Configures Tailwind CSS for an application or a buildable/publishable library."
131
- },
132
- "stories": {
133
- "factory": "./src/generators/stories/compat",
134
- "schema": "./src/generators/stories/schema.json",
135
- "description": "Creates stories/specs for all components declared in a project."
136
- },
137
- "storybook-configuration": {
138
- "factory": "./src/generators/storybook-configuration/compat",
139
- "schema": "./src/generators/storybook-configuration/schema.json",
140
- "description": "Adds Storybook configuration to a project."
141
- },
142
- "cypress-component-configuration": {
143
- "factory": "./src/generators/cypress-component-configuration/compat",
144
- "schema": "./src/generators/cypress-component-configuration/schema.json",
145
- "description": "Setup Cypress component testing for a project."
146
- },
147
- "web-worker": {
148
- "factory": "./src/generators/web-worker/compat",
149
- "schema": "./src/generators/web-worker/schema.json",
150
- "description": "Creates a Web Worker."
151
- }
152
- },
153
5
  "generators": {
154
6
  "add-linting": {
155
7
  "factory": "./src/generators/add-linting/add-linting",
@@ -165,7 +17,7 @@
165
17
  "description": "Creates an Angular application."
166
18
  },
167
19
  "component": {
168
- "factory": "./src/generators/component/component",
20
+ "factory": "./src/generators/component/component#componentGeneratorInternal",
169
21
  "schema": "./src/generators/component/schema.json",
170
22
  "aliases": ["c"],
171
23
  "description": "Generate an Angular Component."
@@ -193,6 +45,12 @@
193
45
  "aliases": ["d"],
194
46
  "description": "Generate an Angular directive."
195
47
  },
48
+ "federate-module": {
49
+ "factory": "./src/generators/federate-module/federate-module",
50
+ "schema": "./src/generators/federate-module/schema.json",
51
+ "x-type": "application",
52
+ "description": "Create a federated module, which is exposed by a remote and can be subsequently loaded by a host."
53
+ },
196
54
  "init": {
197
55
  "factory": "./src/generators/init/init",
198
56
  "schema": "./src/generators/init/schema.json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "17.0.0-beta.1",
3
+ "version": "17.0.0-beta.4",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -60,8 +60,8 @@
60
60
  "url": "https://github.com/nrwl/nx/issues"
61
61
  },
62
62
  "homepage": "https://nx.dev",
63
- "builders": "./executors.json",
64
- "schematics": "./generators.json",
63
+ "executors": "./executors.json",
64
+ "generators": "./generators.json",
65
65
  "ng-update": {
66
66
  "requirements": {},
67
67
  "migrations": "./migrations.json"
@@ -79,14 +79,14 @@
79
79
  "webpack": "^5.80.0",
80
80
  "webpack-merge": "^5.8.0",
81
81
  "enquirer": "^2.3.6",
82
- "@nx/devkit": "17.0.0-beta.1",
83
- "@nx/cypress": "17.0.0-beta.1",
84
- "@nx/jest": "17.0.0-beta.1",
85
- "@nx/js": "17.0.0-beta.1",
86
- "@nx/linter": "17.0.0-beta.1",
87
- "@nx/webpack": "17.0.0-beta.1",
88
- "@nx/workspace": "17.0.0-beta.1",
89
- "@nrwl/angular": "17.0.0-beta.1"
82
+ "@nx/devkit": "17.0.0-beta.4",
83
+ "@nx/cypress": "17.0.0-beta.4",
84
+ "@nx/jest": "17.0.0-beta.4",
85
+ "@nx/js": "17.0.0-beta.4",
86
+ "@nx/linter": "17.0.0-beta.4",
87
+ "@nx/webpack": "17.0.0-beta.4",
88
+ "@nx/workspace": "17.0.0-beta.4",
89
+ "@nrwl/angular": "17.0.0-beta.4"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "@angular-devkit/build-angular": ">= 14.0.0 < 17.0.0",
@@ -33,19 +33,6 @@
33
33
  "description": "Whether to run a build when any file changes.",
34
34
  "default": false
35
35
  },
36
- "updateBuildableProjectDepsInPackageJson": {
37
- "type": "boolean",
38
- "description": "Whether to update the buildable project dependencies in the build output package.json.",
39
- "default": false,
40
- "x-deprecated": "Configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks). It will be removed in v17."
41
- },
42
- "buildableProjectDepsInPackageJsonType": {
43
- "type": "string",
44
- "description": "When `updateBuildableProjectDepsInPackageJson` is `true`, this adds dependencies to either `peerDependencies` or `dependencies`.",
45
- "enum": ["dependencies", "peerDependencies"],
46
- "default": "peerDependencies",
47
- "x-deprecated": "Configure the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks). It will be removed in v17."
48
- },
49
36
  "tailwindConfig": {
50
37
  "type": "string",
51
38
  "description": "The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured."
@@ -39,17 +39,11 @@ function createLibraryExecutor(initializeNgPackagr) {
39
39
  if (!(0, buildable_libs_utils_1.checkDependentProjectsHaveBeenBuilt)(context.root, context.projectName, context.targetName, dependencies)) {
40
40
  return Promise.resolve({ success: false });
41
41
  }
42
- function updatePackageJson() {
43
- if (topLevelDependencies.length > 0 &&
44
- options.updateBuildableProjectDepsInPackageJson) {
45
- (0, buildable_libs_utils_1.updateBuildableProjectPackageJsonDependencies)(context.root, context.projectName, context.targetName, context.configurationName, target, topLevelDependencies, options.buildableProjectDepsInPackageJsonType);
46
- }
47
- }
48
42
  if (options.watch) {
49
- return yield* (0, rxjs_for_await_1.eachValueFrom)((0, rxjs_1.from)(initializeNgPackagr(options, context, dependencies)).pipe((0, operators_1.switchMap)((packagr) => packagr.watch()), (0, operators_1.tap)(() => updatePackageJson()), (0, operators_1.mapTo)({ success: true })));
43
+ return yield* (0, rxjs_for_await_1.eachValueFrom)((0, rxjs_1.from)(initializeNgPackagr(options, context, dependencies)).pipe((0, operators_1.switchMap)((packagr) => packagr.watch()), (0, operators_1.mapTo)({ success: true })));
50
44
  }
51
45
  return (0, rxjs_1.from)(initializeNgPackagr(options, context, dependencies))
52
- .pipe((0, operators_1.switchMap)((packagr) => packagr.build()), (0, operators_1.tap)(() => updatePackageJson()), (0, operators_1.mapTo)({ success: true }))
46
+ .pipe((0, operators_1.switchMap)((packagr) => packagr.build()), (0, operators_1.mapTo)({ success: true }))
53
47
  .toPromise();
54
48
  };
55
49
  }
@@ -1,18 +1,6 @@
1
1
  export interface BuildAngularLibraryExecutorOptions {
2
2
  project: string;
3
- /**
4
- * @deprecated Configure the project to use the `@nx/dependency-checks` ESLint
5
- * rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks).
6
- * It will be removed in v17.
7
- */
8
- buildableProjectDepsInPackageJsonType?: 'dependencies' | 'peerDependencies';
9
3
  tailwindConfig?: string;
10
4
  tsConfig?: string;
11
- /**
12
- * @deprecated Configure the project to use the `@nx/dependency-checks` ESLint
13
- * rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks).
14
- * It will be removed in v17.
15
- */
16
- updateBuildableProjectDepsInPackageJson?: boolean;
17
5
  watch?: boolean;
18
6
  }
@@ -33,19 +33,6 @@
33
33
  "description": "Whether to run a build when any file changes.",
34
34
  "default": false
35
35
  },
36
- "updateBuildableProjectDepsInPackageJson": {
37
- "type": "boolean",
38
- "description": "Whether to update the buildable project dependencies in the build output package.json.",
39
- "default": false,
40
- "x-deprecated": "Configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks). It will be removed in v17."
41
- },
42
- "buildableProjectDepsInPackageJsonType": {
43
- "type": "string",
44
- "description": "When `updateBuildableProjectDepsInPackageJson` is `true`, this adds dependencies to either `peerDependencies` or `dependencies`.",
45
- "enum": ["dependencies", "peerDependencies"],
46
- "default": "peerDependencies",
47
- "x-deprecated": "Configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/packages/eslint-plugin/documents/dependency-checks). It will be removed in v17."
48
- },
49
36
  "tailwindConfig": {
50
37
  "type": "string",
51
38
  "description": "The full path for the Tailwind configuration file, relative to the workspace root. If not provided and a `tailwind.config.js` file exists in the project or workspace root, it will be used. Otherwise, Tailwind will not be configured.",
@@ -1,4 +1,5 @@
1
1
  import type { Tree } from '@nx/devkit';
2
2
  import type { Schema } from './schema';
3
3
  export declare function componentGenerator(tree: Tree, rawOptions: Schema): Promise<void>;
4
+ export declare function componentGeneratorInternal(tree: Tree, rawOptions: Schema): Promise<void>;
4
5
  export default componentGenerator;
@@ -1,19 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.componentGenerator = void 0;
3
+ exports.componentGeneratorInternal = exports.componentGenerator = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const utils_1 = require("../utils");
6
6
  const lib_1 = require("./lib");
7
7
  async function componentGenerator(tree, rawOptions) {
8
+ await componentGeneratorInternal(tree, {
9
+ nameAndDirectoryFormat: 'derived',
10
+ ...rawOptions,
11
+ });
12
+ }
13
+ exports.componentGenerator = componentGenerator;
14
+ async function componentGeneratorInternal(tree, rawOptions) {
8
15
  (0, lib_1.validateOptions)(tree, rawOptions);
9
- const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
10
- const componentNames = (0, devkit_1.names)(options.name);
11
- const typeNames = (0, devkit_1.names)(options.type);
16
+ const options = await (0, lib_1.normalizeOptions)(tree, rawOptions);
12
17
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), options.directory, {
13
- fileName: componentNames.fileName,
14
- className: componentNames.className,
15
- type: typeNames.fileName,
16
- typeClassName: typeNames.className,
18
+ name: options.name,
19
+ fileName: options.fileName,
20
+ symbolName: options.symbolName,
17
21
  style: options.style,
18
22
  inlineStyle: options.inlineStyle,
19
23
  inlineTemplate: options.inlineTemplate,
@@ -26,25 +30,25 @@ async function componentGenerator(tree, rawOptions) {
26
30
  tpl: '',
27
31
  });
28
32
  if (options.skipTests) {
29
- const pathToSpecFile = (0, devkit_1.joinPathFragments)(options.directory, `${componentNames.fileName}.${typeNames.fileName}.spec.ts`);
33
+ const pathToSpecFile = (0, devkit_1.joinPathFragments)(options.directory, `${options.fileName}.spec.ts`);
30
34
  tree.delete(pathToSpecFile);
31
35
  }
32
36
  if (options.inlineTemplate) {
33
- const pathToTemplateFile = (0, devkit_1.joinPathFragments)(options.directory, `${componentNames.fileName}.${typeNames.fileName}.html`);
37
+ const pathToTemplateFile = (0, devkit_1.joinPathFragments)(options.directory, `${options.fileName}.html`);
34
38
  tree.delete(pathToTemplateFile);
35
39
  }
36
40
  if (options.style === 'none' || options.inlineStyle) {
37
- const pathToStyleFile = (0, devkit_1.joinPathFragments)(options.directory, `${componentNames.fileName}.${typeNames.fileName}.${options.style}`);
41
+ const pathToStyleFile = (0, devkit_1.joinPathFragments)(options.directory, `${options.fileName}.${options.style}`);
38
42
  tree.delete(pathToStyleFile);
39
43
  }
40
44
  if (!options.skipImport && !options.standalone) {
41
45
  const modulePath = (0, lib_1.findModuleFromOptions)(tree, options, options.projectRoot);
42
- (0, utils_1.addToNgModule)(tree, options.path, modulePath, componentNames.fileName, `${componentNames.className}${typeNames.className}`, `${componentNames.fileName}.${typeNames.fileName}`, 'declarations', options.flat, options.export);
46
+ (0, utils_1.addToNgModule)(tree, options.directory, modulePath, options.name, options.symbolName, options.fileName, 'declarations', true, options.export);
43
47
  }
44
48
  (0, lib_1.exportComponentInEntryPoint)(tree, options);
45
49
  if (!options.skipFormat) {
46
50
  await (0, devkit_1.formatFiles)(tree);
47
51
  }
48
52
  }
49
- exports.componentGenerator = componentGenerator;
53
+ exports.componentGeneratorInternal = componentGeneratorInternal;
50
54
  exports.default = componentGenerator;
@@ -0,0 +1 @@
1
+ <p><%= name %> works!</p>
@@ -0,0 +1,22 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { <%= symbolName %> } from './<%= fileName %>';
3
+
4
+ describe('<%= symbolName %>', () => {
5
+ let component: <%= symbolName %>;
6
+ let fixture: ComponentFixture<<%= symbolName %>>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ <%= standalone ? 'imports' : 'declarations' %>: [ <%= symbolName %> ]
11
+ })
12
+ .compileComponents();
13
+
14
+ fixture = TestBed.createComponent(<%= symbolName %>);
15
+ component = fixture.componentInstance;
16
+ fixture.detectChanges();
17
+ });
18
+
19
+ it('should create', () => {
20
+ expect(component).toBeTruthy();
21
+ });
22
+ });
@@ -5,8 +5,8 @@ import { CommonModule } from '@angular/common';<% } %>
5
5
  selector: '<%= selector %>',<%}%><% if(standalone) {%>
6
6
  standalone: true,
7
7
  imports: [CommonModule],<%}%><% if(inlineTemplate) { %>
8
- template: `<p><%= fileName %> works!</p>`<% } else { %>
9
- templateUrl: './<%= fileName %><%= type ? '.' + type : '' %>.html'<% } if(inlineStyle) { %>,
8
+ template: `<p><%= name %> works!</p>`<% } else { %>
9
+ templateUrl: './<%= fileName %>.html'<% } if(inlineStyle) { %>,
10
10
  styles: [<% if(displayBlock){ %>
11
11
  `
12
12
  :host {
@@ -14,8 +14,8 @@ import { CommonModule } from '@angular/common';<% } %>
14
14
  }
15
15
  `<% } %>
16
16
  ]<% } else if (style !== 'none') { %>,
17
- styleUrls: ['./<%= fileName %><%= type ? '.' + type : '' %>.<%= style %>']<% } %><% if(!!viewEncapsulation) { %>,
17
+ styleUrls: ['./<%= fileName %>.<%= style %>']<% } %><% if(!!viewEncapsulation) { %>,
18
18
  encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection !== 'Default') { %>,
19
19
  changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %>
20
20
  })
21
- export class <%= className %><%= typeClassName %> {}
21
+ export class <%= symbolName %> {}
@@ -12,10 +12,10 @@ function findModuleFromOptions(tree, options, projectRoot) {
12
12
  return (0, devkit_1.normalizePath)(findModule(tree, options.directory, projectRoot));
13
13
  }
14
14
  else {
15
- const modulePath = (0, devkit_1.joinPathFragments)(options.path, options.module);
15
+ const modulePath = (0, devkit_1.joinPathFragments)(options.directory, options.module);
16
16
  const componentPath = options.directory;
17
17
  const moduleBaseName = (0, path_1.basename)(modulePath);
18
- const candidateSet = new Set([options.path]);
18
+ const candidateSet = new Set([options.directory]);
19
19
  const projectRootParent = (0, path_1.dirname)(projectRoot);
20
20
  for (let dir = modulePath; dir !== projectRootParent; dir = (0, path_1.dirname)(dir)) {
21
21
  candidateSet.add(dir);
@@ -1,3 +1,3 @@
1
1
  import type { Tree } from '@nx/devkit';
2
2
  import type { NormalizedSchema, Schema } from '../schema';
3
- export declare function normalizeOptions(tree: Tree, options: Schema): NormalizedSchema;
3
+ export declare function normalizeOptions(tree: Tree, options: Schema): Promise<NormalizedSchema>;
@@ -2,23 +2,36 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeOptions = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const path_1 = require("../../utils/path");
5
+ const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
6
6
  const selector_1 = require("../../utils/selector");
7
- function normalizeOptions(tree, options) {
7
+ async function normalizeOptions(tree, options) {
8
8
  options.type ??= 'component';
9
- const { directory, filePath, name, path, root, sourceRoot } = (0, path_1.normalizeNameAndPaths)(tree, options);
10
- const { prefix } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
9
+ const { artifactName: name, directory, fileName, filePath, project, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
10
+ artifactType: 'component',
11
+ callingGenerator: '@nx/angular:component',
12
+ name: options.name,
13
+ directory: options.directory ?? options.path,
14
+ flat: options.flat,
15
+ nameAndDirectoryFormat: options.nameAndDirectoryFormat,
16
+ project: options.project,
17
+ suffix: options.type ?? 'component',
18
+ });
19
+ const { className } = (0, devkit_1.names)(name);
20
+ const { className: suffixClassName } = (0, devkit_1.names)(options.type);
21
+ const symbolName = `${className}${suffixClassName}`;
22
+ const { prefix, root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, project);
11
23
  const selector = options.selector ??
12
24
  (0, selector_1.buildSelector)(tree, name, options.prefix, prefix, 'fileName');
13
25
  return {
14
26
  ...options,
15
27
  name,
28
+ project,
16
29
  changeDetection: options.changeDetection ?? 'Default',
17
30
  style: options.style ?? 'css',
18
- flat: options.flat ?? false,
19
31
  directory,
32
+ fileName,
20
33
  filePath,
21
- path,
34
+ symbolName,
22
35
  projectSourceRoot: sourceRoot,
23
36
  projectRoot: root,
24
37
  selector,
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateOptions = void 0;
4
4
  const validations_1 = require("../../utils/validations");
5
5
  function validateOptions(tree, options) {
6
- (0, validations_1.validateProject)(tree, options.project);
7
- (0, validations_1.validatePathIsUnderProjectRoot)(tree, options.project, options.path);
8
6
  (0, validations_1.validateStandaloneOption)(tree, options.standalone);
9
7
  }
10
8
  exports.validateOptions = validateOptions;
@@ -1,7 +1,9 @@
1
+ import type { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-and-directory-utils';
2
+
1
3
  export interface Schema {
2
4
  name: string;
3
- project: string;
4
- path?: string;
5
+ directory?: string;
6
+ nameAndDirectoryFormat?: NameAndDirectoryFormat;
5
7
  displayBlock?: boolean;
6
8
  inlineStyle?: boolean;
7
9
  inlineTemplate?: boolean;
@@ -11,7 +13,6 @@ export interface Schema {
11
13
  style?: 'css' | 'scss' | 'sass' | 'less' | 'none';
12
14
  skipTests?: boolean;
13
15
  type?: string;
14
- flat?: boolean;
15
16
  skipImport?: boolean;
16
17
  selector?: string;
17
18
  module?: string;
@@ -19,12 +20,29 @@ export interface Schema {
19
20
  export?: boolean;
20
21
  prefix?: string;
21
22
  skipFormat?: boolean;
23
+
24
+ /**
25
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. It will be removed in Nx v18.
26
+ */
27
+ flat?: boolean;
28
+ /**
29
+ * @deprecated Provide the `directory` option instead. It will be removed in Nx v18.
30
+ */
31
+ path?: string;
32
+ /**
33
+ * @deprecated Provide the `directory` option instead. The project will be determined from the directory provided. It will be removed in Nx v18.
34
+ */
35
+ project?: string;
22
36
  }
23
37
 
24
38
  export interface NormalizedSchema extends Schema {
25
39
  directory: string;
26
40
  filePath: string;
41
+ project: string;
27
42
  projectSourceRoot: string;
28
43
  projectRoot: string;
29
44
  selector: string;
45
+
46
+ fileName: string;
47
+ symbolName: string;
30
48
  }