@nx/angular 21.1.2 → 21.2.0-beta.2

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 (271) hide show
  1. package/README.md +4 -4
  2. package/fesm2022/nx-angular-mf.mjs +10 -3
  3. package/fesm2022/nx-angular-mf.mjs.map +1 -1
  4. package/fesm2022/nx-angular.mjs.map +1 -1
  5. package/index.d.ts +2 -1
  6. package/mf/index.d.ts +71 -1
  7. package/migrations.json +106 -0
  8. package/ng-package.json +0 -1
  9. package/package.json +28 -16
  10. package/plugins/component-testing.js +8 -3
  11. package/src/builders/dev-server/dev-server.impl.js +4 -7
  12. package/src/builders/dev-server/lib/normalize-options.js +0 -6
  13. package/src/builders/dev-server/lib/validate-options.js +0 -4
  14. package/src/builders/dev-server/schema.d.ts +3 -15
  15. package/src/builders/dev-server/schema.json +3 -9
  16. package/src/builders/webpack-browser/webpack-browser.impl.js +2 -0
  17. package/src/builders/webpack-server/webpack-server.impl.d.ts +3 -1
  18. package/src/builders/webpack-server/webpack-server.impl.js +2 -0
  19. package/src/executors/application/application.impl.d.ts +2 -2
  20. package/src/executors/application/application.impl.js +11 -6
  21. package/src/executors/application/schema.d.ts +1 -1
  22. package/src/executors/application/schema.json +21 -10
  23. package/src/executors/application/utils/normalize-options.js +8 -1
  24. package/src/executors/application/utils/validate-options.js +10 -40
  25. package/src/executors/extract-i18n/extract-i18n.impl.js +6 -14
  26. package/src/executors/extract-i18n/schema.d.ts +1 -6
  27. package/src/executors/extract-i18n/schema.json +5 -0
  28. package/src/executors/extract-i18n/utils/validate-options.d.ts +2 -0
  29. package/src/executors/extract-i18n/utils/validate-options.js +13 -0
  30. package/src/executors/module-federation-dev-server/lib/normalize-options.js +1 -7
  31. package/src/executors/module-federation-dev-server/schema.d.ts +3 -15
  32. package/src/executors/module-federation-dev-server/schema.json +2 -15
  33. package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +10 -8
  34. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.d.ts +6 -3
  35. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.js +46 -8
  36. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.di.d.ts +1 -1
  37. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.di.js +3 -3
  38. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.transform.d.ts +2 -2
  39. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.transform.js +36 -7
  40. package/src/executors/ng-packagr-lite/schema.json +2 -3
  41. package/src/executors/package/package.impl.js +1 -5
  42. package/src/executors/package/schema.d.ts +3 -1
  43. package/src/executors/package/schema.json +2 -3
  44. package/src/executors/utilities/builder-package.d.ts +1 -0
  45. package/src/executors/utilities/builder-package.js +11 -0
  46. package/src/executors/utilities/esbuild-extensions.d.ts +2 -1
  47. package/src/executors/utilities/ng-packagr/package-imports.d.ts +3 -1
  48. package/src/executors/utilities/ng-packagr/package-imports.js +2 -2
  49. package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.d.ts +2 -24
  50. package/src/executors/utilities/ng-packagr/pre-v19/stylesheet-processor.js +40 -107
  51. package/src/executors/utilities/ng-packagr/stylesheet-processor.di.js +4 -8
  52. package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.d.ts +1 -1
  53. package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.js +18 -11
  54. package/src/generators/add-linting/add-linting.js +8 -0
  55. package/src/generators/application/application.js +22 -8
  56. package/src/generators/application/files/base/tsconfig.app.json__tpl__ +10 -1
  57. package/src/generators/application/files/base/tsconfig.json__tpl__ +7 -8
  58. package/src/generators/application/files/ng-module/src/app/app__componentFileSuffix__.spec.ts__tpl__ +28 -0
  59. package/src/generators/application/files/ng-module/src/app/{app.component.ts__tpl__ → app__componentFileSuffix__.ts__tpl__} +4 -4
  60. package/src/generators/application/files/ng-module/src/app/app__moduleTypeSeparator__module.ts__tpl__ +17 -0
  61. package/src/generators/application/files/ng-module/src/main.ts__tpl__ +11 -3
  62. package/src/generators/application/files/nx-welcome/claimed/ng-module/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
  63. package/src/generators/application/files/nx-welcome/claimed/standalone/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
  64. package/src/generators/application/files/nx-welcome/not-configured/ng-module/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
  65. package/src/generators/application/files/nx-welcome/not-configured/standalone/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
  66. package/src/generators/application/files/nx-welcome/unclaimed/ng-module/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
  67. package/src/generators/application/files/nx-welcome/unclaimed/standalone/src/app/{nx-welcome.component.ts__tpl__ → nx-welcome__componentFileSuffix__.ts__tpl__} +1 -1
  68. package/src/generators/application/files/standalone-components/src/app/app.config.ts__tpl__ +6 -2
  69. package/src/generators/application/files/standalone-components/src/app/app__componentFileSuffix__.spec.ts__tpl__ +27 -0
  70. package/src/generators/application/files/standalone-components/src/app/{app.component.ts__tpl__ → app__componentFileSuffix__.ts__tpl__} +6 -6
  71. package/src/generators/application/files/standalone-components/src/main.ts__tpl__ +2 -2
  72. package/src/generators/application/lib/create-files.d.ts +1 -1
  73. package/src/generators/application/lib/create-files.js +18 -19
  74. package/src/generators/application/lib/create-project.d.ts +1 -1
  75. package/src/generators/application/lib/create-project.js +119 -26
  76. package/src/generators/application/lib/enable-strict-type-checking.js +4 -2
  77. package/src/generators/application/lib/index.d.ts +1 -2
  78. package/src/generators/application/lib/index.js +1 -2
  79. package/src/generators/application/lib/set-generator-defaults.js +1 -0
  80. package/src/generators/application/lib/{update-editor-tsconfig.d.ts → update-tsconfig-files.d.ts} +1 -1
  81. package/src/generators/application/lib/update-tsconfig-files.js +93 -0
  82. package/src/generators/application/schema.json +1 -1
  83. package/src/generators/component/component.js +13 -2
  84. package/src/generators/component/files/__fileName__.ts__tpl__ +1 -1
  85. package/src/generators/component/lib/component.js +11 -1
  86. package/src/generators/component/lib/module.d.ts +7 -2
  87. package/src/generators/component/lib/module.js +7 -5
  88. package/src/generators/component/lib/normalize-options.js +7 -3
  89. package/src/generators/component/schema.d.ts +1 -0
  90. package/src/generators/component/schema.json +6 -2
  91. package/src/generators/convert-to-application-executor/convert-to-application-executor.js +37 -24
  92. package/src/generators/convert-to-rspack/convert-to-rspack.d.ts +1 -1
  93. package/src/generators/convert-to-rspack/convert-to-rspack.js +173 -28
  94. package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.js +1 -1
  95. package/src/generators/directive/directive.js +1 -1
  96. package/src/generators/directive/lib/normalize-options.js +7 -2
  97. package/src/generators/directive/schema.d.ts +1 -0
  98. package/src/generators/directive/schema.json +10 -2
  99. package/src/generators/host/host.js +21 -1
  100. package/src/generators/host/schema.d.ts +1 -0
  101. package/src/generators/host/schema.json +7 -1
  102. package/src/generators/init/init.js +1 -1
  103. package/src/generators/library/files/base/tsconfig.json__tpl__ +5 -5
  104. package/src/generators/library/files/ng-module/src/index.ts__tpl__ +1 -1
  105. package/src/generators/library/files/standalone-components/src/lib/lib.routes.ts__tpl__ +2 -2
  106. package/src/generators/library/lib/add-standalone-component.js +1 -0
  107. package/src/generators/library/lib/create-files.js +10 -3
  108. package/src/generators/library/lib/normalize-options.d.ts +3 -3
  109. package/src/generators/library/lib/normalize-options.js +6 -1
  110. package/src/generators/library/lib/normalized-schema.d.ts +2 -0
  111. package/src/generators/library/lib/set-generator-defaults.js +1 -0
  112. package/src/generators/library/lib/update-tsconfig-files.d.ts +3 -0
  113. package/src/generators/library/lib/update-tsconfig-files.js +98 -0
  114. package/src/generators/library/library.js +19 -33
  115. package/src/generators/library-secondary-entry-point/files/src/index.ts__tmpl__ +1 -1
  116. package/src/generators/library-secondary-entry-point/lib/add-files.js +2 -1
  117. package/src/generators/library-secondary-entry-point/lib/normalize-options.d.ts +2 -2
  118. package/src/generators/library-secondary-entry-point/lib/normalize-options.js +3 -0
  119. package/src/generators/library-secondary-entry-point/schema.d.ts +1 -0
  120. package/src/generators/move/lib/update-module-name.js +17 -10
  121. package/src/generators/move/lib/update-secondary-entry-points.js +0 -3
  122. package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +1 -1
  123. package/src/generators/ng-add/migrators/projects/app.migrator.js +43 -8
  124. package/src/generators/ngrx/schema.json +3 -3
  125. package/src/generators/ngrx-root-store/lib/normalize-options.js +9 -2
  126. package/src/generators/pipe/lib/normalize-options.js +4 -0
  127. package/src/generators/pipe/pipe.js +1 -1
  128. package/src/generators/pipe/schema.d.ts +1 -0
  129. package/src/generators/pipe/schema.json +11 -2
  130. package/src/generators/remote/files/standalone/src/bootstrap.server.ts__tmpl__ +4 -4
  131. package/src/generators/remote/lib/update-ssr-setup.js +5 -0
  132. package/src/generators/remote/remote.js +23 -0
  133. package/src/generators/remote/schema.d.ts +1 -0
  134. package/src/generators/remote/schema.json +7 -1
  135. package/src/generators/scam/lib/convert-component-to-scam.js +1 -3
  136. package/src/generators/scam/lib/normalize-options.js +11 -3
  137. package/src/generators/scam/schema.d.ts +1 -0
  138. package/src/generators/scam/schema.json +1 -2
  139. package/src/generators/scam-directive/lib/convert-directive-to-scam.js +1 -3
  140. package/src/generators/scam-directive/lib/normalize-options.js +11 -2
  141. package/src/generators/scam-directive/schema.d.ts +2 -0
  142. package/src/generators/scam-directive/schema.json +10 -2
  143. package/src/generators/scam-pipe/lib/convert-pipe-to-scam.js +1 -3
  144. package/src/generators/scam-pipe/lib/normalize-options.js +8 -0
  145. package/src/generators/scam-pipe/schema.d.ts +2 -0
  146. package/src/generators/scam-pipe/schema.json +5 -0
  147. package/src/generators/setup-mf/files/entry-module-files/{entry.module.ts__tmpl__ → __entryModuleFileName__.ts__tmpl__} +4 -4
  148. package/src/generators/setup-mf/files/entry-module-files/entry.routes.ts__tmpl__ +2 -2
  149. package/src/generators/setup-mf/files/entry-module-files/{entry.component.ts__tmpl__ → entry__componentFileSuffix__.ts__tmpl__} +1 -1
  150. package/src/generators/setup-mf/files/host-files/__appFileName__.spec.ts__tmpl__ +43 -0
  151. package/src/generators/setup-mf/files/standalone-entry-component-files/entry.routes.ts__tmpl__ +2 -2
  152. package/src/generators/setup-mf/files/standalone-entry-component-files/{entry.component.ts__tmpl__ → entry__componentFileSuffix__.ts__tmpl__} +3 -3
  153. package/src/generators/setup-mf/files/ts-webpack/module-federation.config.ts__tmpl__ +1 -1
  154. package/src/generators/setup-mf/files/ts-webpack/tsconfig.lint.json__tmpl__ +1 -1
  155. package/src/generators/setup-mf/files/webpack/module-federation.config.js__tmpl__ +1 -1
  156. package/src/generators/setup-mf/lib/add-remote-entry.d.ts +2 -2
  157. package/src/generators/setup-mf/lib/add-remote-entry.js +9 -3
  158. package/src/generators/setup-mf/lib/add-remote-to-host.js +11 -1
  159. package/src/generators/setup-mf/lib/fix-bootstrap.d.ts +2 -2
  160. package/src/generators/setup-mf/lib/fix-bootstrap.js +4 -4
  161. package/src/generators/setup-mf/lib/generate-config.d.ts +2 -2
  162. package/src/generators/setup-mf/lib/generate-config.js +1 -0
  163. package/src/generators/setup-mf/lib/normalize-options.d.ts +1 -1
  164. package/src/generators/setup-mf/lib/normalize-options.js +13 -0
  165. package/src/generators/setup-mf/lib/remove-dead-code-from-remote.d.ts +2 -2
  166. package/src/generators/setup-mf/lib/remove-dead-code-from-remote.js +18 -14
  167. package/src/generators/setup-mf/lib/setup-host-if-dynamic.js +1 -5
  168. package/src/generators/setup-mf/lib/setup-tspath-for-remote.d.ts +2 -2
  169. package/src/generators/setup-mf/lib/setup-tspath-for-remote.js +1 -1
  170. package/src/generators/setup-mf/lib/update-host-app-routes.d.ts +2 -2
  171. package/src/generators/setup-mf/lib/update-host-app-routes.js +12 -9
  172. package/src/generators/setup-mf/lib/update-tsconfig.d.ts +2 -2
  173. package/src/generators/setup-mf/lib/update-tsconfig.js +5 -5
  174. package/src/generators/setup-mf/schema.d.ts +7 -0
  175. package/src/generators/setup-mf/setup-mf.d.ts +2 -2
  176. package/src/generators/setup-mf/setup-mf.js +16 -6
  177. package/src/generators/setup-ssr/files/v20+/application-builder/ngmodule-src/__main__ +1 -0
  178. package/src/generators/setup-ssr/files/v20+/application-builder/ngmodule-src/app/__rootModuleFileName__ +12 -0
  179. package/src/generators/setup-ssr/files/v20+/application-builder/ngmodule-src/app/app.routes.server.ts__tpl__ +8 -0
  180. package/src/generators/setup-ssr/files/v20+/application-builder/server/__serverFileName__ +66 -0
  181. package/src/generators/setup-ssr/files/v20+/application-builder/standalone-src/__main__ +7 -0
  182. package/src/generators/setup-ssr/files/v20+/application-builder/standalone-src/app/app.config.server.ts__tpl__ +12 -0
  183. package/src/generators/setup-ssr/files/v20+/application-builder/standalone-src/app/app.routes.server.ts__tpl__ +8 -0
  184. package/src/generators/setup-ssr/files/v20+/server-builder/ngmodule-src/__main__ +1 -0
  185. package/src/generators/setup-ssr/files/v20+/server-builder/ngmodule-src/app/__rootModuleFileName__ +14 -0
  186. package/src/generators/setup-ssr/files/v20+/server-builder/root/tsconfig.server.json.template +18 -0
  187. package/src/generators/setup-ssr/files/v20+/server-builder/server/__serverFileName__ +69 -0
  188. package/src/generators/setup-ssr/files/v20+/server-builder/standalone-src/__main__ +7 -0
  189. package/src/generators/setup-ssr/files/v20+/server-builder/standalone-src/app/app.config.server.ts.template +11 -0
  190. package/src/generators/setup-ssr/lib/add-dependencies.js +11 -8
  191. package/src/generators/setup-ssr/lib/add-hydration.js +10 -3
  192. package/src/generators/setup-ssr/lib/add-server-file.js +7 -2
  193. package/src/generators/setup-ssr/lib/generate-files.js +17 -4
  194. package/src/generators/setup-ssr/lib/generate-server-ts-config.js +32 -6
  195. package/src/generators/setup-ssr/lib/normalize-options.js +5 -3
  196. package/src/generators/setup-ssr/lib/update-project-config.js +5 -0
  197. package/src/generators/setup-ssr/lib/validate-options.js +2 -2
  198. package/src/generators/setup-ssr/schema.d.ts +1 -0
  199. package/src/generators/setup-ssr/schema.json +1 -1
  200. package/src/generators/utils/add-jest.js +6 -1
  201. package/src/generators/utils/app-components-info.d.ts +9 -0
  202. package/src/generators/utils/app-components-info.js +39 -0
  203. package/src/generators/utils/artifact-types.d.ts +3 -0
  204. package/src/generators/utils/artifact-types.js +33 -0
  205. package/src/generators/utils/assert-mf-utils.d.ts +1 -0
  206. package/src/generators/utils/assert-mf-utils.js +11 -0
  207. package/src/generators/utils/ensure-angular-dependencies.js +6 -3
  208. package/src/generators/utils/export-scam.d.ts +1 -0
  209. package/src/generators/utils/export-scam.js +1 -2
  210. package/src/generators/utils/find-module.js +18 -13
  211. package/src/generators/utils/storybook-ast/component-info.js +40 -24
  212. package/src/generators/utils/storybook-ast/module-info.d.ts +1 -1
  213. package/src/generators/utils/storybook-ast/module-info.js +3 -8
  214. package/src/generators/utils/testing.js +28 -28
  215. package/src/generators/utils/version-utils.js +2 -2
  216. package/src/generators/web-worker/lib/add-snippet.js +3 -3
  217. package/src/migrations/update-21-2-0/migrate-provide-server-rendering-import.d.ts +2 -0
  218. package/src/migrations/update-21-2-0/migrate-provide-server-rendering-import.js +110 -0
  219. package/src/migrations/update-21-2-0/replace-provide-server-routing.d.ts +2 -0
  220. package/src/migrations/update-21-2-0/replace-provide-server-routing.js +103 -0
  221. package/src/migrations/update-21-2-0/set-generator-defaults-for-previous-style-guide.d.ts +2 -0
  222. package/src/migrations/update-21-2-0/set-generator-defaults-for-previous-style-guide.js +47 -0
  223. package/src/migrations/update-21-2-0/update-angular-cli.d.ts +3 -0
  224. package/src/migrations/update-21-2-0/update-angular-cli.js +23 -0
  225. package/src/migrations/update-21-2-0/update-module-resolution.d.ts +2 -0
  226. package/src/migrations/update-21-2-0/update-module-resolution.js +45 -0
  227. package/src/plugins/plugin.js +22 -13
  228. package/src/utils/backward-compatible-versions.d.ts +2 -2
  229. package/src/utils/backward-compatible-versions.js +22 -19
  230. package/src/utils/nx-devkit/ast-utils.js +17 -3
  231. package/src/utils/nx-devkit/testing.js +9 -9
  232. package/src/utils/targets.d.ts +2 -1
  233. package/src/utils/targets.js +6 -0
  234. package/src/utils/versions.d.ts +4 -3
  235. package/src/utils/versions.js +5 -4
  236. package/mf/mf.d.ts +0 -69
  237. package/src/generators/application/files/base-pre18/src/favicon.ico +0 -0
  238. package/src/generators/application/files/ng-module/src/app/app.component.spec.ts__tpl__ +0 -29
  239. package/src/generators/application/files/ng-module/src/app/app.module.ts__tpl__ +0 -17
  240. package/src/generators/application/files/standalone-components/src/app/app.component.__style__ +0 -0
  241. package/src/generators/application/files/standalone-components/src/app/app.component.spec.ts__tpl__ +0 -28
  242. package/src/generators/application/lib/set-app-strict-default.d.ts +0 -2
  243. package/src/generators/application/lib/set-app-strict-default.js +0 -13
  244. package/src/generators/application/lib/update-editor-tsconfig.js +0 -21
  245. package/src/generators/library/lib/enable-strict-type-checking.d.ts +0 -7
  246. package/src/generators/library/lib/enable-strict-type-checking.js +0 -47
  247. package/src/generators/library/lib/update-tsconfig.d.ts +0 -3
  248. package/src/generators/library/lib/update-tsconfig.js +0 -36
  249. package/src/generators/setup-mf/files/host-files/app.component.spec.ts__tmpl__ +0 -47
  250. /package/src/generators/application/files/{base-18+ → base}/public/favicon.ico +0 -0
  251. /package/src/generators/application/files/{base-pre18/src/assets/.gitkeep__tpl__ → ng-module/src/app/app__componentFileSuffix__.__style__} +0 -0
  252. /package/src/generators/application/files/ng-module/src/app/{app.component.html__tpl__ → app__componentFileSuffix__.html__tpl__} +0 -0
  253. /package/src/generators/application/files/{ng-module/src/app/app.component.__style__ → standalone-components/src/app/app__componentFileSuffix__.__style__} +0 -0
  254. /package/src/generators/application/files/standalone-components/src/app/{app.component.html__tpl__ → app__componentFileSuffix__.html__tpl__} +0 -0
  255. /package/src/generators/component/files/{__fileName__.html__tpl__ → __fileName____ngext__.html__tpl__} +0 -0
  256. /package/src/generators/library/files/ng-module/src/lib/{__libFileName__.module.ts__tpl__ → __libFileName____moduleTypeSeparator__module.ts__tpl__} +0 -0
  257. /package/src/generators/library-secondary-entry-point/files/src/lib/{__fileName__.module.ts__tmpl__ → __fileName____moduleTypeSeparator__module.ts__tmpl__} +0 -0
  258. /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/ngmodule-src/__main__ +0 -0
  259. /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/ngmodule-src/app/__rootModuleFileName__ +0 -0
  260. /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/ngmodule-src/app/app.routes.server.ts__tpl__ +0 -0
  261. /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/server/__serverFileName__ +0 -0
  262. /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/standalone-src/__main__ +0 -0
  263. /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/standalone-src/app/app.config.server.ts__tpl__ +0 -0
  264. /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder/standalone-src/app/app.routes.server.ts__tpl__ +0 -0
  265. /package/src/generators/setup-ssr/files/{v19+ → v19}/application-builder-common-engine/server/__serverFileName__ +0 -0
  266. /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/ngmodule-src/__main__ +0 -0
  267. /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/ngmodule-src/app/__rootModuleFileName__ +0 -0
  268. /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/root/tsconfig.server.json.template +0 -0
  269. /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/server/__serverFileName__ +0 -0
  270. /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/standalone-src/__main__ +0 -0
  271. /package/src/generators/setup-ssr/files/{v19+ → v19}/server-builder/standalone-src/app/app.config.server.ts.template +0 -0
@@ -7,7 +7,6 @@ const buildable_libs_utils_1 = require("@nx/js/src/utils/buildable-libs-utils");
7
7
  const path_1 = require("path");
8
8
  const rxjs_1 = require("rxjs");
9
9
  const operators_1 = require("rxjs/operators");
10
- const angular_version_utils_1 = require("../utilities/angular-version-utils");
11
10
  const typescript_1 = require("../utilities/typescript");
12
11
  const ng_packagr_1 = require("./ng-packagr-adjustments/ng-packagr");
13
12
  async function initializeNgPackagr(options, context, projectDependencies) {
@@ -27,10 +26,7 @@ async function initializeNgPackagr(options, context, projectDependencies) {
27
26
  */
28
27
  function createLibraryExecutor(initializeNgPackagr) {
29
28
  return async function* (options, context) {
30
- const { major: angularMajorVersion, version: angularVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
31
- if (angularMajorVersion < 18 && options.poll !== undefined) {
32
- throw new Error(`The "poll" option requires Angular version 18.0.0 or greater. You are currently using version ${angularVersion}.`);
33
- }
29
+ options.project ??= (0, path_1.join)(context.projectsConfigurations.projects[context.projectName].root, 'ng-package.json');
34
30
  const { dependencies } = (0, buildable_libs_utils_1.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, context.projectName, context.targetName, context.configurationName);
35
31
  if (options.watch) {
36
32
  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 })));
@@ -1,4 +1,6 @@
1
1
  import type { NgPackagrBuilderOptions } from '@angular-devkit/build-angular';
2
2
 
3
3
  export interface BuildAngularLibraryExecutorOptions
4
- extends NgPackagrBuilderOptions {}
4
+ extends NgPackagrBuilderOptions {
5
+ project?: string;
6
+ }
@@ -31,9 +31,8 @@
31
31
  },
32
32
  "poll": {
33
33
  "type": "number",
34
- "description": "Enable and define the file watching poll time period in milliseconds. _Note: this is only supported in Angular versions >= 18.0.0_."
34
+ "description": "Enable and define the file watching poll time period in milliseconds."
35
35
  }
36
36
  },
37
- "additionalProperties": false,
38
- "required": ["project"]
37
+ "additionalProperties": false
39
38
  }
@@ -0,0 +1 @@
1
+ export declare function assertBuilderPackageIsInstalled(packageName: string): void;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertBuilderPackageIsInstalled = assertBuilderPackageIsInstalled;
4
+ function assertBuilderPackageIsInstalled(packageName) {
5
+ try {
6
+ require.resolve(packageName);
7
+ }
8
+ catch {
9
+ throw new Error(`This executor requires the package ${packageName} to be installed. Please make sure it is installed and try again.`);
10
+ }
11
+ }
@@ -1,4 +1,5 @@
1
- type Plugin = Parameters<typeof import('@angular-devkit/build-angular').buildApplication>[2]['codePlugins'][number];
1
+ import type { buildApplication } from '@angular/build';
2
+ type Plugin = Parameters<typeof buildApplication>[2]['codePlugins'][number];
2
3
  export type PluginSpec = {
3
4
  path: string;
4
5
  options: any;
@@ -1 +1,3 @@
1
- export declare function importNgPackagrPath<T>(path: string, ngPackagrMajorVersion: number): T;
1
+ type NgPackagrImportPath = `ng-packagr/src/${string}`;
2
+ export declare function importNgPackagrPath<T>(path: NgPackagrImportPath, ngPackagrMajorVersion: number): T;
3
+ export {};
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.importNgPackagrPath = importNgPackagrPath;
4
4
  function importNgPackagrPath(path, ngPackagrMajorVersion) {
5
5
  let finalPath = path;
6
- if (ngPackagrMajorVersion >= 20 && !path.startsWith('ng-packagr/src/')) {
7
- finalPath = path.replace(/^ng-packagr\//, 'ng-packagr/src/');
6
+ if (ngPackagrMajorVersion < 20 && path.startsWith('ng-packagr/src/')) {
7
+ finalPath = path.replace(/^ng-packagr\/src\//, 'ng-packagr/');
8
8
  }
9
9
  return require(finalPath);
10
10
  }
@@ -2,8 +2,8 @@
2
2
  * Adapted from the original ng-packagr source.
3
3
  *
4
4
  * Changes made:
5
- * - Use our own function to get the TailwindCSS config path to support a
6
- * config at the root of the workspace.
5
+ * - Resolve `piscina` from the installed `ng-packagr` package.
6
+ * - Additionally search for the TailwindCSS config in the workspace root.
7
7
  */
8
8
  export declare enum CssUrl {
9
9
  inline = "inline",
@@ -25,25 +25,3 @@ export declare class StylesheetProcessor {
25
25
  destroy(): void;
26
26
  private createRenderWorker;
27
27
  }
28
- /**
29
- * This class is used when ng-packagr version is 17.2.0. The async `loadPostcssConfiguration` function
30
- * introduced in ng-packagr 17.2.0 causes a memory leak due to multiple workers being created. We must
31
- * keep this class to support any workspace that might be using ng-packagr 17.2.0 where that function
32
- * need to be awaited.
33
- */
34
- export declare class AsyncStylesheetProcessor {
35
- private readonly projectBasePath;
36
- private readonly basePath;
37
- private readonly cssUrl?;
38
- private readonly includePaths?;
39
- private readonly cacheDirectory?;
40
- private renderWorker;
41
- constructor(projectBasePath: string, basePath: string, cssUrl?: CssUrl, includePaths?: string[], cacheDirectory?: string | false);
42
- process({ filePath, content, }: {
43
- filePath: string;
44
- content: string;
45
- }): Promise<string>;
46
- /** Destory workers in pool. */
47
- destroy(): void;
48
- private createRenderWorker;
49
- }
@@ -3,22 +3,17 @@
3
3
  * Adapted from the original ng-packagr source.
4
4
  *
5
5
  * Changes made:
6
- * - Use our own function to get the TailwindCSS config path to support a
7
- * config at the root of the workspace.
6
+ * - Resolve `piscina` from the installed `ng-packagr` package.
7
+ * - Additionally search for the TailwindCSS config in the workspace root.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.AsyncStylesheetProcessor = exports.StylesheetProcessor = exports.CssUrl = void 0;
10
+ exports.StylesheetProcessor = exports.CssUrl = void 0;
11
11
  const tslib_1 = require("tslib");
12
+ const devkit_1 = require("@nx/devkit");
12
13
  const browserslist_1 = tslib_1.__importDefault(require("browserslist"));
13
14
  const fs_1 = require("fs");
15
+ const color_1 = require("ng-packagr/src/lib/utils/color");
14
16
  const path_1 = require("path");
15
- const Piscina = require('piscina');
16
- const color_1 = require("ng-packagr/lib/utils/color");
17
- // using this instead of the one from ng-packagr
18
- const tailwindcss_1 = require("../tailwindcss");
19
- const devkit_1 = require("@nx/devkit");
20
- const semver_1 = require("semver");
21
- const ng_packagr_version_1 = require("../ng-packagr-version");
22
17
  const maxWorkersVariable = process.env['NG_BUILD_MAX_WORKERS'];
23
18
  const maxThreads = typeof maxWorkersVariable === 'string' && maxWorkersVariable !== ''
24
19
  ? +maxWorkersVariable
@@ -72,25 +67,16 @@ class StylesheetProcessor {
72
67
  currentDir = (0, path_1.dirname)(prevDir);
73
68
  }
74
69
  const browserslistData = (0, browserslist_1.default)(undefined, { path: this.basePath });
75
- const { version: ngPackagrVersion } = (0, ng_packagr_version_1.getNgPackagrVersionInfo)();
76
- let tailwindConfigPath;
77
- let postcssConfiguration;
78
- if ((0, semver_1.gte)(ngPackagrVersion, '18.0.0')) {
79
- const { findTailwindConfiguration, generateSearchDirectories, loadPostcssConfiguration, } = require('ng-packagr/lib/styles/postcss-configuration');
80
- let searchDirs = generateSearchDirectories([this.projectBasePath]);
81
- postcssConfiguration = loadPostcssConfiguration(searchDirs);
82
- // (nx-specific): we support loading the TailwindCSS config from the root of the workspace
83
- searchDirs = generateSearchDirectories([
84
- this.projectBasePath,
85
- devkit_1.workspaceRoot,
86
- ]);
87
- tailwindConfigPath = findTailwindConfiguration(searchDirs);
88
- }
89
- else if ((0, semver_1.gt)(ngPackagrVersion, '17.2.0')) {
90
- const { loadPostcssConfiguration, } = require('ng-packagr/lib/styles/postcss-configuration');
91
- postcssConfiguration = loadPostcssConfiguration(this.projectBasePath);
92
- tailwindConfigPath = (0, tailwindcss_1.getTailwindConfigPath)(this.projectBasePath, devkit_1.workspaceRoot);
93
- }
70
+ const { findTailwindConfiguration, generateSearchDirectories, loadPostcssConfiguration, } = require('ng-packagr/lib/styles/postcss-configuration');
71
+ let searchDirs = generateSearchDirectories([this.projectBasePath]);
72
+ const postcssConfiguration = loadPostcssConfiguration(searchDirs);
73
+ // (nx-specific): we support loading the TailwindCSS config from the root of the workspace
74
+ searchDirs = generateSearchDirectories([
75
+ this.projectBasePath,
76
+ devkit_1.workspaceRoot,
77
+ ]);
78
+ const tailwindConfigPath = findTailwindConfiguration(searchDirs);
79
+ const Piscina = getPiscina();
94
80
  this.renderWorker = new Piscina({
95
81
  filename: require.resolve('ng-packagr/lib/styles/stylesheet-processor-worker'),
96
82
  maxThreads,
@@ -113,84 +99,6 @@ class StylesheetProcessor {
113
99
  }
114
100
  }
115
101
  exports.StylesheetProcessor = StylesheetProcessor;
116
- /**
117
- * This class is used when ng-packagr version is 17.2.0. The async `loadPostcssConfiguration` function
118
- * introduced in ng-packagr 17.2.0 causes a memory leak due to multiple workers being created. We must
119
- * keep this class to support any workspace that might be using ng-packagr 17.2.0 where that function
120
- * need to be awaited.
121
- */
122
- class AsyncStylesheetProcessor {
123
- constructor(projectBasePath, basePath, cssUrl, includePaths, cacheDirectory) {
124
- this.projectBasePath = projectBasePath;
125
- this.basePath = basePath;
126
- this.cssUrl = cssUrl;
127
- this.includePaths = includePaths;
128
- this.cacheDirectory = cacheDirectory;
129
- // By default, browserslist defaults are too inclusive
130
- // https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
131
- // We change the default query to browsers that Angular support.
132
- // https://angular.io/guide/browser-support
133
- browserslist_1.default.defaults = [
134
- 'last 2 Chrome versions',
135
- 'last 1 Firefox version',
136
- 'last 2 Edge major versions',
137
- 'last 2 Safari major versions',
138
- 'last 2 iOS major versions',
139
- 'Firefox ESR',
140
- ];
141
- }
142
- async process({ filePath, content, }) {
143
- await this.createRenderWorker();
144
- return this.renderWorker.run({ content, filePath });
145
- }
146
- /** Destory workers in pool. */
147
- destroy() {
148
- void this.renderWorker?.destroy();
149
- }
150
- async createRenderWorker() {
151
- if (this.renderWorker) {
152
- return;
153
- }
154
- const styleIncludePaths = [...this.includePaths];
155
- let prevDir = null;
156
- let currentDir = this.basePath;
157
- while (currentDir !== prevDir) {
158
- const p = (0, path_1.join)(currentDir, 'node_modules');
159
- if ((0, fs_1.existsSync)(p)) {
160
- styleIncludePaths.push(p);
161
- }
162
- prevDir = currentDir;
163
- currentDir = (0, path_1.dirname)(prevDir);
164
- }
165
- const browserslistData = (0, browserslist_1.default)(undefined, { path: this.basePath });
166
- const { version: ngPackagrVersion } = (0, ng_packagr_version_1.getNgPackagrVersionInfo)();
167
- let postcssConfiguration;
168
- if (ngPackagrVersion === '17.2.0') {
169
- const { loadPostcssConfiguration, } = require('ng-packagr/lib/styles/postcss-configuration');
170
- postcssConfiguration = await loadPostcssConfiguration(this.projectBasePath);
171
- }
172
- this.renderWorker = new Piscina({
173
- filename: require.resolve('ng-packagr/lib/styles/stylesheet-processor-worker'),
174
- maxThreads,
175
- recordTiming: false,
176
- env: {
177
- ...process.env,
178
- FORCE_COLOR: '' + color_1.colors.enabled,
179
- },
180
- workerData: {
181
- postcssConfiguration,
182
- tailwindConfigPath: (0, tailwindcss_1.getTailwindConfigPath)(this.projectBasePath, devkit_1.workspaceRoot),
183
- projectBasePath: this.projectBasePath,
184
- browserslistData,
185
- targets: transformSupportedBrowsersToTargets(browserslistData),
186
- cacheDirectory: this.cacheDirectory,
187
- cssUrl: this.cssUrl,
188
- styleIncludePaths,
189
- },
190
- });
191
- }
192
- }
193
- exports.AsyncStylesheetProcessor = AsyncStylesheetProcessor;
194
102
  function transformSupportedBrowsersToTargets(supportedBrowsers) {
195
103
  const transformed = [];
196
104
  // https://esbuild.github.io/api/#target
@@ -221,3 +129,28 @@ function transformSupportedBrowsersToTargets(supportedBrowsers) {
221
129
  }
222
130
  return transformed.length ? transformed : undefined;
223
131
  }
132
+ /**
133
+ * Loads the `piscina` package from the installed `ng-packagr` package.
134
+ */
135
+ function getPiscina() {
136
+ const ngPackagrPath = getInstalledNgPackagrPath();
137
+ try {
138
+ // Resolve the main piscina module entry point
139
+ const piscinaModulePath = require.resolve('piscina', {
140
+ paths: [ngPackagrPath],
141
+ });
142
+ return require(piscinaModulePath);
143
+ }
144
+ catch (error) {
145
+ throw new Error(`Failed to load the \`piscina\` package from \`ng-packagr\` dependencies: ${error.message}`);
146
+ }
147
+ }
148
+ function getInstalledNgPackagrPath() {
149
+ try {
150
+ const ngPackagrPackageJsonPath = require.resolve('ng-packagr/package.json');
151
+ return (0, path_1.dirname)(ngPackagrPackageJsonPath);
152
+ }
153
+ catch (e) {
154
+ throw new Error('The `ng-packagr` package is not installed. The package is required to use this executor. Please install it in your workspace.');
155
+ }
156
+ }
@@ -4,8 +4,8 @@ exports.getStylesheetProcessorFactoryProvider = getStylesheetProcessorFactoryPro
4
4
  const ng_packagr_version_1 = require("./ng-packagr-version");
5
5
  const package_imports_1 = require("./package-imports");
6
6
  function getStylesheetProcessorFactoryProvider() {
7
- const { major: ngPackagrMajorVersion, version: ngPackagrVersion } = (0, ng_packagr_version_1.getNgPackagrVersionInfo)();
8
- const { STYLESHEET_PROCESSOR_TOKEN } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/lib/styles/stylesheet-processor.di', ngPackagrMajorVersion);
7
+ const { major: ngPackagrMajorVersion } = (0, ng_packagr_version_1.getNgPackagrVersionInfo)();
8
+ const { STYLESHEET_PROCESSOR_TOKEN } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/src/lib/styles/stylesheet-processor.di', ngPackagrMajorVersion);
9
9
  return {
10
10
  provide: STYLESHEET_PROCESSOR_TOKEN,
11
11
  useFactory: () => {
@@ -13,12 +13,8 @@ function getStylesheetProcessorFactoryProvider() {
13
13
  const { getStylesheetProcessor, } = require('./v19+/stylesheet-processor');
14
14
  return getStylesheetProcessor();
15
15
  }
16
- if (ngPackagrVersion !== '17.2.0') {
17
- const { StylesheetProcessor, } = require('./pre-v19/stylesheet-processor');
18
- return StylesheetProcessor;
19
- }
20
- const { AsyncStylesheetProcessor, } = require('./pre-v19/stylesheet-processor');
21
- return AsyncStylesheetProcessor;
16
+ const { StylesheetProcessor } = require('./pre-v19/stylesheet-processor');
17
+ return StylesheetProcessor;
22
18
  },
23
19
  deps: [],
24
20
  };
@@ -4,7 +4,7 @@
4
4
  * Changes made:
5
5
  * - Add the project root to the search directories.
6
6
  */
7
- import type { NgPackageEntryConfig } from 'ng-packagr/ng-entrypoint.schema';
7
+ import type { NgPackageEntryConfig } from 'ng-packagr/src/ng-entrypoint.schema';
8
8
  export declare enum CssUrl {
9
9
  inline = "inline",
10
10
  none = "none"
@@ -20,22 +20,29 @@ var CssUrl;
20
20
  })(CssUrl || (exports.CssUrl = CssUrl = {}));
21
21
  function getStylesheetProcessor() {
22
22
  const { major: ngPackagrMajorVersion } = (0, ng_packagr_version_1.getNgPackagrVersionInfo)();
23
- const { ComponentStylesheetBundler } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/lib/styles/component-stylesheets', ngPackagrMajorVersion);
24
- const { generateSearchDirectories, getTailwindConfig, loadPostcssConfiguration, } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/lib/styles/postcss-configuration', ngPackagrMajorVersion);
23
+ const { ComponentStylesheetBundler } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/src/lib/styles/component-stylesheets', ngPackagrMajorVersion);
24
+ const { generateSearchDirectories, getTailwindConfig, loadPostcssConfiguration, } = (0, package_imports_1.importNgPackagrPath)('ng-packagr/src/lib/styles/postcss-configuration', ngPackagrMajorVersion);
25
25
  class StylesheetProcessor extends ComponentStylesheetBundler {
26
26
  constructor(projectBasePath, basePath, cssUrl, includePaths, sass, cacheDirectory, watch) {
27
27
  // By default, browserslist defaults are too inclusive
28
28
  // https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
29
29
  // We change the default query to browsers that Angular support.
30
- // https://angular.io/guide/browser-support
31
- browserslist_1.default.defaults = [
32
- 'last 2 Chrome versions',
33
- 'last 1 Firefox version',
34
- 'last 2 Edge major versions',
35
- 'last 2 Safari major versions',
36
- 'last 2 iOS major versions',
37
- 'Firefox ESR',
38
- ];
30
+ // https://angular.dev/reference/versions#browser-support
31
+ if (ngPackagrMajorVersion >= 20) {
32
+ browserslist_1.default.defaults = (0, browserslist_1.default)(undefined, {
33
+ path: require.resolve('ng-packagr/.browserslistrc'),
34
+ });
35
+ }
36
+ else {
37
+ browserslist_1.default.defaults = [
38
+ 'last 2 Chrome versions',
39
+ 'last 1 Firefox version',
40
+ 'last 2 Edge major versions',
41
+ 'last 2 Safari major versions',
42
+ 'last 2 iOS major versions',
43
+ 'Firefox ESR',
44
+ ];
45
+ }
39
46
  const browserslistData = (0, browserslist_1.default)(undefined, { path: basePath });
40
47
  let searchDirs = generateSearchDirectories([projectBasePath]);
41
48
  const postcssConfiguration = loadPostcssConfiguration(searchDirs);
@@ -55,6 +55,10 @@ async function addLintingGenerator(tree, options) {
55
55
  style: 'kebab-case',
56
56
  },
57
57
  ],
58
+ // Temporary disable these rules until Angular ESLint recommended
59
+ // rules are updated with the new Style Guide
60
+ '@angular-eslint/component-class-suffix': 'off',
61
+ '@angular-eslint/directive-class-suffix': 'off',
58
62
  },
59
63
  });
60
64
  (0, eslint_file_1.addOverrideToLintConfig)(tree, options.projectRoot, {
@@ -95,6 +99,10 @@ async function addLintingGenerator(tree, options) {
95
99
  style: 'kebab-case',
96
100
  },
97
101
  ],
102
+ // Temporary disable these rules until Angular ESLint recommended
103
+ // rules are updated with the new Style Guide
104
+ '@angular-eslint/component-class-suffix': 'off',
105
+ '@angular-eslint/directive-class-suffix': 'off',
98
106
  },
99
107
  },
100
108
  {
@@ -5,11 +5,12 @@ const devkit_1 = require("@nx/devkit");
5
5
  const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
6
6
  const js_1 = require("@nx/js");
7
7
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
8
- const init_1 = require("../init/init");
9
8
  const convert_to_rspack_1 = require("../convert-to-rspack/convert-to-rspack");
9
+ const init_1 = require("../init/init");
10
10
  const setup_ssr_1 = require("../setup-ssr/setup-ssr");
11
11
  const setup_tailwind_1 = require("../setup-tailwind/setup-tailwind");
12
12
  const ensure_angular_dependencies_1 = require("../utils/ensure-angular-dependencies");
13
+ const version_utils_1 = require("../utils/version-utils");
13
14
  const lib_1 = require("./lib");
14
15
  async function applicationGenerator(tree, schema) {
15
16
  (0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'angular', 'application');
@@ -46,7 +47,7 @@ async function applicationGenerator(tree, schema) {
46
47
  await (0, lib_1.addUnitTestRunner)(tree, options);
47
48
  const e2ePort = await (0, lib_1.addE2e)(tree, options);
48
49
  (0, lib_1.addServeStaticTarget)(tree, options, options.e2eTestRunner !== 'none' ? e2ePort : options.port);
49
- (0, lib_1.updateEditorTsConfig)(tree, options);
50
+ (0, lib_1.updateTsconfigFiles)(tree, options);
50
51
  (0, lib_1.setGeneratorDefaults)(tree, options);
51
52
  if (options.rootProject) {
52
53
  const nxJson = (0, devkit_1.readNxJson)(tree);
@@ -56,12 +57,6 @@ async function applicationGenerator(tree, schema) {
56
57
  if (options.backendProject) {
57
58
  (0, lib_1.addProxyConfig)(tree, options);
58
59
  }
59
- if (options.strict) {
60
- (0, lib_1.enableStrictTypeChecking)(tree, options);
61
- }
62
- else {
63
- (0, lib_1.setApplicationStrictDefault)(tree, false);
64
- }
65
60
  if (options.ssr) {
66
61
  await (0, setup_ssr_1.setupSsr)(tree, {
67
62
  project: options.name,
@@ -83,6 +78,25 @@ async function applicationGenerator(tree, schema) {
83
78
  });
84
79
  }
85
80
  }
81
+ if (!options.skipPackageJson) {
82
+ const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
83
+ if (angularMajorVersion >= 20) {
84
+ const angularDevkitVersion = (0, version_utils_1.getInstalledAngularDevkitVersion)(tree) ??
85
+ (0, version_utils_1.versions)(tree).angularDevkitVersion;
86
+ const devDependencies = {};
87
+ if (options.bundler === 'esbuild') {
88
+ devDependencies['@angular/build'] = angularDevkitVersion;
89
+ }
90
+ else if (isRspack) {
91
+ devDependencies['@angular/build'] = angularDevkitVersion;
92
+ devDependencies['@angular-devkit/build-angular'] = angularDevkitVersion;
93
+ }
94
+ else {
95
+ devDependencies['@angular-devkit/build-angular'] = angularDevkitVersion;
96
+ }
97
+ (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, true);
98
+ }
99
+ }
86
100
  if (!options.skipFormat) {
87
101
  await (0, devkit_1.formatFiles)(tree);
88
102
  }
@@ -4,7 +4,16 @@
4
4
  "outDir": "<%= rootOffset %>dist/out-tsc",
5
5
  "types": []
6
6
  },
7
+ <%_ if (angularMajorVersion < 20) { _%>
7
8
  "files": ["src/main.ts"],
8
9
  "include": ["src/**/*.d.ts"],
9
- "exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"]
10
+ <%_ } else { _%>
11
+ "include": ["src/**/*.ts"],
12
+ <%_ } _%>
13
+ "exclude": [
14
+ "jest.config.ts",
15
+ "src/test-setup.ts",
16
+ "src/**/*.test.ts",
17
+ "src/**/*.spec.ts"
18
+ ]
10
19
  }
@@ -1,18 +1,17 @@
1
1
  {
2
- "compilerOptions": {
3
- "target": "es2022"<% if (disableModernClassFieldsBehavior) { %>,
4
- "useDefineForClassFields": false<% } %><% if (isUsingApplicationBuilder) { %>,
5
- "esModuleInterop": true<% } %>
2
+ "extends": "<%= rootTsConfig %>",
3
+ "compilerOptions": {},
4
+ "angularCompilerOptions": {
5
+ "enableI18nLegacyMessageIdFormat": false
6
6
  },
7
7
  "files": [],
8
8
  "include": [],
9
- "references": [
9
+ "references": [<% if (angularMajorVersion < 20) { %>
10
10
  {
11
11
  "path": "./tsconfig.editor.json"
12
- },
12
+ },<% } %>
13
13
  {
14
14
  "path": "./tsconfig.app.json"
15
15
  }
16
- ],
17
- "extends": "<%= rootTsConfig %>"
16
+ ]
18
17
  }
@@ -0,0 +1,28 @@
1
+ import { TestBed } from '@angular/core/testing';
2
+ import { App<%= componentType %> } from './app<%= componentFileSuffix %>';<% if(!minimal) { %>
3
+ import { NxWelcome<%= componentType %> } from './nx-welcome<%= componentFileSuffix %>';<% } %><% if(routing) { %>
4
+ import { RouterModule } from '@angular/router';<% } %>
5
+
6
+ describe('App<%= componentType %>', () => {
7
+ beforeEach(async () => {
8
+ await TestBed.configureTestingModule({
9
+ imports: [<% if(routing) { %>RouterModule.forRoot([])<% } %>],
10
+ declarations: [App<%= componentType %><% if(!minimal) { %>, NxWelcome<%= componentType %><% } %>]
11
+ }).compileComponents();
12
+ });
13
+
14
+ it('should render title', () => {
15
+ const fixture = TestBed.createComponent(App<%= componentType %>);
16
+ fixture.detectChanges();
17
+ const compiled = fixture.nativeElement as HTMLElement;
18
+ expect(compiled.querySelector('h1')?.textContent).toContain(
19
+ 'Welcome <%= appName %>'
20
+ );
21
+ });<% if(!minimal && angularMajorVersion < 20) { %>
22
+
23
+ it(`should have as title '<%= appName %>'`, () => {
24
+ const fixture = TestBed.createComponent(App<%= componentType %>);
25
+ const app = fixture.componentInstance;
26
+ expect(app.title).toEqual('<%= appName %>');
27
+ });<% } %>
28
+ });
@@ -3,12 +3,12 @@ import { Component<% if(viewEncapsulation) { %>, ViewEncapsulation<% } %> } from
3
3
  @Component({
4
4
  selector: '<%= rootSelector %>',<% if (setStandaloneFalse) { %>
5
5
  standalone: false,<% } if(!inlineTemplate) { %>
6
- templateUrl: './app.component.html',<% } else { %>
6
+ templateUrl: './app<%= componentFileSuffix %>.html',<% } else { %>
7
7
  template: `<% if(minimal) { %><h1>Welcome <%= appName %></h1><% } else { %><<%= nxWelcomeSelector %>></<%= nxWelcomeSelector %>><% } %> <% if(routing) { %><router-outlet></router-outlet><% } %>`,<% } %><% if(!inlineStyle) { %>
8
- styleUrl: './app.component.<%= style %>',<% } else { %>
8
+ styleUrl: './app<%= componentFileSuffix %>.<%= style %>',<% } else { %>
9
9
  styles: ``,<% } %><% if(viewEncapsulation) { %>
10
10
  encapsulation: ViewEncapsulation.<%= viewEncapsulation %>,<% } %>
11
11
  })
12
- export class AppComponent {<% if(!minimal) { %>
13
- title = '<%= appName %>';
12
+ export class App<%= componentType %> {<% if(!minimal) { %>
13
+ <% if (angularMajorVersion >= 20) { %>protected <% } %>title = '<%= appName %>';
14
14
  <% } %>}
@@ -0,0 +1,17 @@
1
+ import { NgModule<% if (provideGlobalErrorListener) { %>, provideBrowserGlobalErrorListeners<% } %> } from '@angular/core';
2
+ import { BrowserModule } from '@angular/platform-browser';<% if(routing) { %>
3
+ import { RouterModule } from '@angular/router';<% } %>
4
+ import { App<%= componentType %> } from './app<%= componentFileSuffix %>';<% if(routing) { %>
5
+ import { appRoutes } from './app.routes';<% } %><% if(!minimal) { %>
6
+ import { NxWelcome<%= componentType %> } from './nx-welcome<%= componentFileSuffix %>';<% } %>
7
+
8
+ @NgModule({
9
+ declarations: [App<%= componentType %><% if(!minimal) { %>, NxWelcome<%= componentType %><% } %>],
10
+ imports: [
11
+ BrowserModule,<% if(routing) { %>
12
+ RouterModule.forRoot(appRoutes),<% } %>
13
+ ],
14
+ providers: [<% if (provideGlobalErrorListener) { %>provideBrowserGlobalErrorListeners()<% } %>],
15
+ bootstrap: [App<%= componentType %>],
16
+ })
17
+ export class AppModule {}
@@ -1,8 +1,16 @@
1
+ <%_ if (usePlatformBrowserDynamic) { _%>
1
2
  import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2
- import { AppModule } from './app/app.module';
3
+ <%_ } else { _%>
4
+ import { platformBrowser } from '@angular/platform-browser';
5
+ <%_ } _%>
6
+ import { AppModule } from './app/app<%= moduleTypeSeparator %>module';
3
7
 
8
+ <%_ if (usePlatformBrowserDynamic) { _%>
4
9
  platformBrowserDynamic()
5
- .bootstrapModule(AppModule<% if (useEventCoalescing) { %>, {
10
+ <%_ } else { _%>
11
+ platformBrowser()
12
+ <%_ } _%>
13
+ .bootstrapModule(AppModule, {
6
14
  ngZoneEventCoalescing: true
7
- }<% } %>)
15
+ })
8
16
  .catch((err) => console.error(err));
@@ -806,4 +806,4 @@ nx g &#64;nx/angular:component ui/src/lib/button</pre>
806
806
  styles: [],
807
807
  encapsulation: ViewEncapsulation.None,
808
808
  })
809
- export class NxWelcomeComponent {}
809
+ export class NxWelcome<%= componentType %> {}
@@ -808,4 +808,4 @@ nx g &#64;nx/angular:component ui/src/lib/button</pre>
808
808
  styles: [],
809
809
  encapsulation: ViewEncapsulation.None,
810
810
  })
811
- export class NxWelcomeComponent {}
811
+ export class NxWelcome<%= componentType %> {}
@@ -803,4 +803,4 @@ nx g &#64;nx/angular:component ui/src/lib/button</pre>
803
803
  styles: [],
804
804
  encapsulation: ViewEncapsulation.None,
805
805
  })
806
- export class NxWelcomeComponent {}
806
+ export class NxWelcome<%= componentType %> {}
@@ -805,4 +805,4 @@ nx g &#64;nx/angular:component ui/src/lib/button</pre>
805
805
  styles: [],
806
806
  encapsulation: ViewEncapsulation.None,
807
807
  })
808
- export class NxWelcomeComponent {}
808
+ export class NxWelcome<%= componentType %> {}
@@ -808,4 +808,4 @@ nx g &#64;nx/angular:component ui/src/lib/button</pre>
808
808
  styles: [],
809
809
  encapsulation: ViewEncapsulation.None,
810
810
  })
811
- export class NxWelcomeComponent {}
811
+ export class NxWelcome<%= componentType %> {}