@mouryaamit/nx-polystack 0.0.0-stage → 1.0.0

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 (680) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +77 -2
  3. package/USER-MANUAL.md +1968 -0
  4. package/dist/bin/cli.d.ts +1 -0
  5. package/dist/bin/cli.js +92 -0
  6. package/dist/bin/cli.js.map +1 -0
  7. package/dist/executors.json +32 -0
  8. package/dist/generators.json +47 -0
  9. package/dist/migrations.json +87 -0
  10. package/dist/runtime/env-secret.cjs +736 -0
  11. package/dist/src/cli/args.d.ts +18 -0
  12. package/dist/src/cli/args.js +67 -0
  13. package/dist/src/cli/args.js.map +1 -0
  14. package/dist/src/cli/commands/app.d.ts +3 -0
  15. package/dist/src/cli/commands/app.js +108 -0
  16. package/dist/src/cli/commands/app.js.map +1 -0
  17. package/dist/src/cli/commands/build.d.ts +8 -0
  18. package/dist/src/cli/commands/build.js +132 -0
  19. package/dist/src/cli/commands/build.js.map +1 -0
  20. package/dist/src/cli/commands/csp.d.ts +19 -0
  21. package/dist/src/cli/commands/csp.js +238 -0
  22. package/dist/src/cli/commands/csp.js.map +1 -0
  23. package/dist/src/cli/commands/encryption.d.ts +4 -0
  24. package/dist/src/cli/commands/encryption.js +261 -0
  25. package/dist/src/cli/commands/encryption.js.map +1 -0
  26. package/dist/src/cli/commands/env.d.ts +2 -0
  27. package/dist/src/cli/commands/env.js +74 -0
  28. package/dist/src/cli/commands/env.js.map +1 -0
  29. package/dist/src/cli/commands/hardening.d.ts +2 -0
  30. package/dist/src/cli/commands/hardening.js +176 -0
  31. package/dist/src/cli/commands/hardening.js.map +1 -0
  32. package/dist/src/cli/commands/index.d.ts +3 -0
  33. package/dist/src/cli/commands/index.js +45 -0
  34. package/dist/src/cli/commands/index.js.map +1 -0
  35. package/dist/src/cli/commands/infra.d.ts +25 -0
  36. package/dist/src/cli/commands/infra.js +85 -0
  37. package/dist/src/cli/commands/infra.js.map +1 -0
  38. package/dist/src/cli/commands/internal-migrate.d.ts +3 -0
  39. package/dist/src/cli/commands/internal-migrate.js +65 -0
  40. package/dist/src/cli/commands/internal-migrate.js.map +1 -0
  41. package/dist/src/cli/commands/lib.d.ts +2 -0
  42. package/dist/src/cli/commands/lib.js +70 -0
  43. package/dist/src/cli/commands/lib.js.map +1 -0
  44. package/dist/src/cli/commands/llm.d.ts +2 -0
  45. package/dist/src/cli/commands/llm.js +46 -0
  46. package/dist/src/cli/commands/llm.js.map +1 -0
  47. package/dist/src/cli/commands/migrate.d.ts +2 -0
  48. package/dist/src/cli/commands/migrate.js +230 -0
  49. package/dist/src/cli/commands/migrate.js.map +1 -0
  50. package/dist/src/cli/commands/new.d.ts +6 -0
  51. package/dist/src/cli/commands/new.js +97 -0
  52. package/dist/src/cli/commands/new.js.map +1 -0
  53. package/dist/src/cli/commands/preset.d.ts +2 -0
  54. package/dist/src/cli/commands/preset.js +47 -0
  55. package/dist/src/cli/commands/preset.js.map +1 -0
  56. package/dist/src/cli/commands/release.d.ts +3 -0
  57. package/dist/src/cli/commands/release.js +83 -0
  58. package/dist/src/cli/commands/release.js.map +1 -0
  59. package/dist/src/cli/commands/shared.d.ts +3 -0
  60. package/dist/src/cli/commands/shared.js +55 -0
  61. package/dist/src/cli/commands/shared.js.map +1 -0
  62. package/dist/src/cli/commands/update.d.ts +11 -0
  63. package/dist/src/cli/commands/update.js +120 -0
  64. package/dist/src/cli/commands/update.js.map +1 -0
  65. package/dist/src/cli/context.d.ts +18 -0
  66. package/dist/src/cli/context.js +66 -0
  67. package/dist/src/cli/context.js.map +1 -0
  68. package/dist/src/cli/exec.d.ts +9 -0
  69. package/dist/src/cli/exec.js +34 -0
  70. package/dist/src/cli/exec.js.map +1 -0
  71. package/dist/src/cli/help.d.ts +1 -0
  72. package/dist/src/cli/help.js +291 -0
  73. package/dist/src/cli/help.js.map +1 -0
  74. package/dist/src/cli/install-source.d.ts +16 -0
  75. package/dist/src/cli/install-source.js +49 -0
  76. package/dist/src/cli/install-source.js.map +1 -0
  77. package/dist/src/cli/launcher.d.ts +32 -0
  78. package/dist/src/cli/launcher.js +168 -0
  79. package/dist/src/cli/launcher.js.map +1 -0
  80. package/dist/src/cli/migrations.d.ts +25 -0
  81. package/dist/src/cli/migrations.js +35 -0
  82. package/dist/src/cli/migrations.js.map +1 -0
  83. package/dist/src/cli/run-tree.d.ts +9 -0
  84. package/dist/src/cli/run-tree.js +32 -0
  85. package/dist/src/cli/run-tree.js.map +1 -0
  86. package/dist/src/cli/types.d.ts +18 -0
  87. package/dist/src/cli/types.js +12 -0
  88. package/dist/src/cli/types.js.map +1 -0
  89. package/dist/src/cli/update-plan.d.ts +15 -0
  90. package/dist/src/cli/update-plan.js +40 -0
  91. package/dist/src/cli/update-plan.js.map +1 -0
  92. package/dist/src/cli/versions.d.ts +26 -0
  93. package/dist/src/cli/versions.js +83 -0
  94. package/dist/src/cli/versions.js.map +1 -0
  95. package/dist/src/executors/build/executor.d.ts +19 -0
  96. package/dist/src/executors/build/executor.js +251 -0
  97. package/dist/src/executors/build/executor.js.map +1 -0
  98. package/dist/src/executors/build/schema.d.ts +42 -0
  99. package/dist/src/executors/build/schema.json +104 -0
  100. package/dist/src/executors/capacitor/executor.d.ts +8 -0
  101. package/dist/src/executors/capacitor/executor.js +45 -0
  102. package/dist/src/executors/capacitor/executor.js.map +1 -0
  103. package/dist/src/executors/capacitor/schema.d.ts +10 -0
  104. package/dist/src/executors/capacitor/schema.json +24 -0
  105. package/dist/src/executors/clean/executor.d.ts +19 -0
  106. package/dist/src/executors/clean/executor.js +134 -0
  107. package/dist/src/executors/clean/executor.js.map +1 -0
  108. package/dist/src/executors/clean/schema.d.ts +6 -0
  109. package/dist/src/executors/clean/schema.json +21 -0
  110. package/dist/src/executors/flutter-build/executor.d.ts +8 -0
  111. package/dist/src/executors/flutter-build/executor.js +70 -0
  112. package/dist/src/executors/flutter-build/executor.js.map +1 -0
  113. package/dist/src/executors/flutter-build/schema.d.ts +10 -0
  114. package/dist/src/executors/flutter-build/schema.json +44 -0
  115. package/dist/src/executors/flutter-export/executor.d.ts +8 -0
  116. package/dist/src/executors/flutter-export/executor.js +36 -0
  117. package/dist/src/executors/flutter-export/executor.js.map +1 -0
  118. package/dist/src/executors/flutter-export/schema.d.ts +6 -0
  119. package/dist/src/executors/flutter-export/schema.json +28 -0
  120. package/dist/src/generators/app/files/angular/.eslintrc.json__template__ +28 -0
  121. package/dist/src/generators/app/files/angular/csp-allowlist.json__template__ +1 -0
  122. package/dist/src/generators/app/files/angular/server/README.md__template__ +31 -0
  123. package/dist/src/generators/app/files/angular/src/app/app-routing.module.ts__template__ +10 -0
  124. package/dist/src/generators/app/files/angular/src/app/app.component.html__template__ +4 -0
  125. package/dist/src/generators/app/files/angular/src/app/app.component.scss__template__ +1 -0
  126. package/dist/src/generators/app/files/angular/src/app/app.component.ts__template__ +9 -0
  127. package/dist/src/generators/app/files/angular/src/app/app.module.ts__template__ +13 -0
  128. package/dist/src/generators/app/files/angular/src/index.html__template__ +12 -0
  129. package/dist/src/generators/app/files/angular/src/main.ts__template__ +16 -0
  130. package/dist/src/generators/app/files/angular/src/styles.scss__template__ +1 -0
  131. package/dist/src/generators/app/files/angular/tsconfig.app.json__template__ +10 -0
  132. package/dist/src/generators/app/files/angular/tsconfig.json__template__ +25 -0
  133. package/dist/src/generators/app/files/angular/tsconfig.spec.json__template__ +8 -0
  134. package/dist/src/generators/app/files/flutter/.gitignore__template__ +10 -0
  135. package/dist/src/generators/app/files/flutter/analysis_options.yaml__template__ +8 -0
  136. package/dist/src/generators/app/files/flutter/lib/main.dart__template__ +23 -0
  137. package/dist/src/generators/app/files/flutter/pubspec.yaml__template__ +26 -0
  138. package/dist/src/generators/app/files/flutter/server/nginx.conf__template__ +35 -0
  139. package/dist/src/generators/app/files/ionic/.gitignore__template__ +7 -0
  140. package/dist/src/generators/app/files/ionic/capacitor.config.ts__template__ +19 -0
  141. package/dist/src/generators/app/files/ionic/package.json__template__ +14 -0
  142. package/dist/src/generators/app/files/ionic/src/app/app.component.html__template__ +3 -0
  143. package/dist/src/generators/app/files/ionic/src/app/app.component.scss__template__ +0 -0
  144. package/dist/src/generators/app/files/ionic/src/app/app.module.ts__template__ +16 -0
  145. package/dist/src/generators/app/files/ionic/src/index.html__template__ +17 -0
  146. package/dist/src/generators/app/files/ionic/src/styles.scss__template__ +12 -0
  147. package/dist/src/generators/app/generator.d.ts +15 -0
  148. package/dist/src/generators/app/generator.js +363 -0
  149. package/dist/src/generators/app/generator.js.map +1 -0
  150. package/dist/src/generators/app/schema.d.ts +19 -0
  151. package/dist/src/generators/app/schema.json +77 -0
  152. package/dist/src/generators/env/generator.d.ts +3 -0
  153. package/dist/src/generators/env/generator.js +454 -0
  154. package/dist/src/generators/env/generator.js.map +1 -0
  155. package/dist/src/generators/env/schema.d.ts +18 -0
  156. package/dist/src/generators/env/schema.json +47 -0
  157. package/dist/src/generators/infra/files/ci/commitlint/commitlint.config.js__template__ +6 -0
  158. package/dist/src/generators/infra/files/ci/common/tools/config/allowed-cycles.json__template__ +1 -0
  159. package/dist/src/generators/infra/files/ci/common/tools/scripts/check-cycles.js__template__ +201 -0
  160. package/dist/src/generators/infra/files/ci/github-actions/.github/workflows/ci.yml__template__ +68 -0
  161. package/dist/src/generators/infra/files/ci/github-actions/.github/workflows/pr-title.yml__template__ +36 -0
  162. package/dist/src/generators/infra/files/ci/jenkins/Jenkinsfile__template__ +45 -0
  163. package/dist/src/generators/infra/files/docs/.github/ISSUE_TEMPLATE/bug.yml__template__ +39 -0
  164. package/dist/src/generators/infra/files/docs/.github/ISSUE_TEMPLATE/config.yml__template__ +1 -0
  165. package/dist/src/generators/infra/files/docs/.github/ISSUE_TEMPLATE/feature.yml__template__ +23 -0
  166. package/dist/src/generators/infra/files/docs/.github/PULL_REQUEST_TEMPLATE.md__template__ +23 -0
  167. package/dist/src/generators/infra/files/docs/CODE_OF_CONDUCT.md__template__ +18 -0
  168. package/dist/src/generators/infra/files/docs/CONTRIBUTING.md__template__ +61 -0
  169. package/dist/src/generators/infra/files/docs/SECURITY.md__template__ +25 -0
  170. package/dist/src/generators/infra/files/quality/.husky/pre-push__template__ +2 -0
  171. package/dist/src/generators/infra/files/quality/.secretlintignore__template__ +7 -0
  172. package/dist/src/generators/infra/files/quality/.secretlintrc.json__template__ +7 -0
  173. package/dist/src/generators/infra/files/quality/knip.json__template__ +9 -0
  174. package/dist/src/generators/infra/files/upgrades/.github/workflows/dependency-upgrade.yml__template__ +80 -0
  175. package/dist/src/generators/infra/generator.d.ts +60 -0
  176. package/dist/src/generators/infra/generator.js +356 -0
  177. package/dist/src/generators/infra/generator.js.map +1 -0
  178. package/dist/src/generators/infra/options.d.ts +28 -0
  179. package/dist/src/generators/infra/options.js +80 -0
  180. package/dist/src/generators/infra/options.js.map +1 -0
  181. package/dist/src/generators/infra/schema.d.ts +19 -0
  182. package/dist/src/generators/infra/schema.json +59 -0
  183. package/dist/src/generators/lib/angular-lib.d.ts +27 -0
  184. package/dist/src/generators/lib/angular-lib.js +85 -0
  185. package/dist/src/generators/lib/angular-lib.js.map +1 -0
  186. package/dist/src/generators/lib/files/angular/component/src/index.ts__template__ +2 -0
  187. package/dist/src/generators/lib/files/angular/component/src/lib/__fileName__/__fileName__.component.html__template__ +1 -0
  188. package/dist/src/generators/lib/files/angular/component/src/lib/__fileName__/__fileName__.component.scss__template__ +3 -0
  189. package/dist/src/generators/lib/files/angular/component/src/lib/__fileName__/__fileName__.component.ts__template__ +9 -0
  190. package/dist/src/generators/lib/files/angular/component/src/lib/__fileName__.module.ts__template__ +11 -0
  191. package/dist/src/generators/lib/files/angular/config/.eslintrc.json__template__ +32 -0
  192. package/dist/src/generators/lib/files/angular/config/tsconfig.json__template__ +22 -0
  193. package/dist/src/generators/lib/files/angular/config/tsconfig.lib.json__template__ +12 -0
  194. package/dist/src/generators/lib/files/assets/README.md__template__ +13 -0
  195. package/dist/src/generators/lib/files/design-tokens/README.md__template__ +90 -0
  196. package/dist/src/generators/lib/files/design-tokens/generated/dart/pubspec.yaml__template__ +11 -0
  197. package/dist/src/generators/lib/files/design-tokens/src/index.ts__template__ +1 -0
  198. package/dist/src/generators/lib/files/design-tokens/style-dictionary.config.js__template__ +41 -0
  199. package/dist/src/generators/lib/files/flutter/.gitignore__template__ +7 -0
  200. package/dist/src/generators/lib/files/flutter/analysis_options.yaml__template__ +6 -0
  201. package/dist/src/generators/lib/files/flutter/lib/__snakeName__.dart__template__ +1 -0
  202. package/dist/src/generators/lib/files/flutter/lib/src/__snakeName__.dart__template__ +6 -0
  203. package/dist/src/generators/lib/files/flutter/pubspec.yaml__template__ +18 -0
  204. package/dist/src/generators/lib/files/flutter/test/__snakeName___test.dart__template__ +8 -0
  205. package/dist/src/generators/lib/files/ionic/src/index.ts__template__ +2 -0
  206. package/dist/src/generators/lib/files/ionic/src/lib/__fileName__/__fileName__.page.html__template__ +9 -0
  207. package/dist/src/generators/lib/files/ionic/src/lib/__fileName__/__fileName__.page.scss__template__ +3 -0
  208. package/dist/src/generators/lib/files/ionic/src/lib/__fileName__/__fileName__.page.ts__template__ +9 -0
  209. package/dist/src/generators/lib/files/ionic/src/lib/__fileName__.module.ts__template__ +12 -0
  210. package/dist/src/generators/lib/files/pii/README.md__template__ +35 -0
  211. package/dist/src/generators/lib/files/pii/src/index.ts__template__ +5 -0
  212. package/dist/src/generators/lib/files/pii/src/lib/pii-mask.directive.ts__template__ +30 -0
  213. package/dist/src/generators/lib/files/pii/src/lib/pii-mask.module.ts__template__ +17 -0
  214. package/dist/src/generators/lib/files/pii/src/lib/pii-mask.options.ts__template__ +6 -0
  215. package/dist/src/generators/lib/files/pii/src/lib/pii-mask.pipe.ts__template__ +14 -0
  216. package/dist/src/generators/lib/files/pii/src/lib/pii-mask.ts__template__ +117 -0
  217. package/dist/src/generators/lib/files/session/README.md__template__ +39 -0
  218. package/dist/src/generators/lib/files/session/src/index.ts__template__ +5 -0
  219. package/dist/src/generators/lib/files/session/src/lib/session-clock.ts__template__ +113 -0
  220. package/dist/src/generators/lib/files/session/src/lib/session-timeout.config.ts__template__ +8 -0
  221. package/dist/src/generators/lib/files/session/src/lib/session-timeout.module.ts__template__ +23 -0
  222. package/dist/src/generators/lib/files/session/src/lib/session-timeout.service.ts__template__ +289 -0
  223. package/dist/src/generators/lib/files/session/src/lib/session-warning/session-warning.component.html__template__ +21 -0
  224. package/dist/src/generators/lib/files/session/src/lib/session-warning/session-warning.component.scss__template__ +40 -0
  225. package/dist/src/generators/lib/files/session/src/lib/session-warning/session-warning.component.ts__template__ +105 -0
  226. package/dist/src/generators/lib/files/state/ngrx/README.md__template__ +33 -0
  227. package/dist/src/generators/lib/files/state/ngrx/src/index.ts__template__ +6 -0
  228. package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__-state.module.ts__template__ +18 -0
  229. package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__.actions.ts__template__ +12 -0
  230. package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__.effects.ts__template__ +26 -0
  231. package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__.models.ts__template__ +4 -0
  232. package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__.reducer.ts__template__ +33 -0
  233. package/dist/src/generators/lib/files/state/ngrx/src/lib/__fileName__.selectors.ts__template__ +14 -0
  234. package/dist/src/generators/lib/files/state/simple-service/README.md__template__ +20 -0
  235. package/dist/src/generators/lib/files/state/simple-service/src/index.ts__template__ +2 -0
  236. package/dist/src/generators/lib/files/state/simple-service/src/lib/__fileName__.store.ts__template__ +58 -0
  237. package/dist/src/generators/lib/files/state/simple-service/src/lib/store.ts__template__ +34 -0
  238. package/dist/src/generators/lib/files/styles/README.md__template__ +39 -0
  239. package/dist/src/generators/lib/files/styles/src/_index.scss__template__ +3 -0
  240. package/dist/src/generators/lib/files/styles/src/mixins/_index.scss__template__ +13 -0
  241. package/dist/src/generators/lib/files/styles/src/themes/_index.scss__template__ +20 -0
  242. package/dist/src/generators/lib/files/styles/src/tokens/_index.scss__template__ +27 -0
  243. package/dist/src/generators/lib/files/ts/config/.eslintrc.json__template__ +10 -0
  244. package/dist/src/generators/lib/files/ts/config/tsconfig.json__template__ +14 -0
  245. package/dist/src/generators/lib/files/ts/config/tsconfig.lib.json__template__ +10 -0
  246. package/dist/src/generators/lib/files/ts/sample/src/index.ts__template__ +1 -0
  247. package/dist/src/generators/lib/files/ts/sample/src/lib/__fileName__.ts__template__ +4 -0
  248. package/dist/src/generators/lib/generator.d.ts +3 -0
  249. package/dist/src/generators/lib/generator.js +53 -0
  250. package/dist/src/generators/lib/generator.js.map +1 -0
  251. package/dist/src/generators/lib/lib-utils.d.ts +72 -0
  252. package/dist/src/generators/lib/lib-utils.js +170 -0
  253. package/dist/src/generators/lib/lib-utils.js.map +1 -0
  254. package/dist/src/generators/lib/schema.d.ts +31 -0
  255. package/dist/src/generators/lib/schema.json +63 -0
  256. package/dist/src/generators/lib/style-dictionary.d.ts +36 -0
  257. package/dist/src/generators/lib/style-dictionary.js +183 -0
  258. package/dist/src/generators/lib/style-dictionary.js.map +1 -0
  259. package/dist/src/generators/lib/types/angular.d.ts +2 -0
  260. package/dist/src/generators/lib/types/angular.js +20 -0
  261. package/dist/src/generators/lib/types/angular.js.map +1 -0
  262. package/dist/src/generators/lib/types/assets.d.ts +2 -0
  263. package/dist/src/generators/lib/types/assets.js +20 -0
  264. package/dist/src/generators/lib/types/assets.js.map +1 -0
  265. package/dist/src/generators/lib/types/design-tokens.d.ts +10 -0
  266. package/dist/src/generators/lib/types/design-tokens.js +78 -0
  267. package/dist/src/generators/lib/types/design-tokens.js.map +1 -0
  268. package/dist/src/generators/lib/types/flutter.d.ts +2 -0
  269. package/dist/src/generators/lib/types/flutter.js +28 -0
  270. package/dist/src/generators/lib/types/flutter.js.map +1 -0
  271. package/dist/src/generators/lib/types/index.d.ts +8 -0
  272. package/dist/src/generators/lib/types/index.js +31 -0
  273. package/dist/src/generators/lib/types/index.js.map +1 -0
  274. package/dist/src/generators/lib/types/ionic.d.ts +4 -0
  275. package/dist/src/generators/lib/types/ionic.js +35 -0
  276. package/dist/src/generators/lib/types/ionic.js.map +1 -0
  277. package/dist/src/generators/lib/types/pii.d.ts +3 -0
  278. package/dist/src/generators/lib/types/pii.js +19 -0
  279. package/dist/src/generators/lib/types/pii.js.map +1 -0
  280. package/dist/src/generators/lib/types/session.d.ts +3 -0
  281. package/dist/src/generators/lib/types/session.js +21 -0
  282. package/dist/src/generators/lib/types/session.js.map +1 -0
  283. package/dist/src/generators/lib/types/state.d.ts +5 -0
  284. package/dist/src/generators/lib/types/state.js +48 -0
  285. package/dist/src/generators/lib/types/state.js.map +1 -0
  286. package/dist/src/generators/lib/types/styles.d.ts +2 -0
  287. package/dist/src/generators/lib/types/styles.js +19 -0
  288. package/dist/src/generators/lib/types/styles.js.map +1 -0
  289. package/dist/src/generators/lib/types/ts.d.ts +5 -0
  290. package/dist/src/generators/lib/types/ts.js +30 -0
  291. package/dist/src/generators/lib/types/ts.js.map +1 -0
  292. package/dist/src/generators/llm/generator.d.ts +8 -0
  293. package/dist/src/generators/llm/generator.js +13 -0
  294. package/dist/src/generators/llm/generator.js.map +1 -0
  295. package/dist/src/generators/llm/schema.d.ts +4 -0
  296. package/dist/src/generators/llm/schema.json +16 -0
  297. package/dist/src/generators/migrate/adapters/angular-cli.d.ts +82 -0
  298. package/dist/src/generators/migrate/adapters/angular-cli.js +439 -0
  299. package/dist/src/generators/migrate/adapters/angular-cli.js.map +1 -0
  300. package/dist/src/generators/migrate/adapters/angular-workspace.d.ts +28 -0
  301. package/dist/src/generators/migrate/adapters/angular-workspace.js +397 -0
  302. package/dist/src/generators/migrate/adapters/angular-workspace.js.map +1 -0
  303. package/dist/src/generators/migrate/adapters/external.d.ts +23 -0
  304. package/dist/src/generators/migrate/adapters/external.js +230 -0
  305. package/dist/src/generators/migrate/adapters/external.js.map +1 -0
  306. package/dist/src/generators/migrate/adapters/flutter.d.ts +26 -0
  307. package/dist/src/generators/migrate/adapters/flutter.js +176 -0
  308. package/dist/src/generators/migrate/adapters/flutter.js.map +1 -0
  309. package/dist/src/generators/migrate/adapters/index.d.ts +34 -0
  310. package/dist/src/generators/migrate/adapters/index.js +136 -0
  311. package/dist/src/generators/migrate/adapters/index.js.map +1 -0
  312. package/dist/src/generators/migrate/adapters/ionic.d.ts +17 -0
  313. package/dist/src/generators/migrate/adapters/ionic.js +137 -0
  314. package/dist/src/generators/migrate/adapters/ionic.js.map +1 -0
  315. package/dist/src/generators/migrate/adapters/npm-workspaces.d.ts +23 -0
  316. package/dist/src/generators/migrate/adapters/npm-workspaces.js +734 -0
  317. package/dist/src/generators/migrate/adapters/npm-workspaces.js.map +1 -0
  318. package/dist/src/generators/migrate/adapters/nx-workspace.d.ts +47 -0
  319. package/dist/src/generators/migrate/adapters/nx-workspace.js +1037 -0
  320. package/dist/src/generators/migrate/adapters/nx-workspace.js.map +1 -0
  321. package/dist/src/generators/migrate/adapters/scaffold.d.ts +2 -0
  322. package/dist/src/generators/migrate/adapters/scaffold.js +200 -0
  323. package/dist/src/generators/migrate/adapters/scaffold.js.map +1 -0
  324. package/dist/src/generators/migrate/adapters/types.d.ts +184 -0
  325. package/dist/src/generators/migrate/adapters/types.js +63 -0
  326. package/dist/src/generators/migrate/adapters/types.js.map +1 -0
  327. package/dist/src/generators/migrate/angular-code-scan.d.ts +6 -0
  328. package/dist/src/generators/migrate/angular-code-scan.js +150 -0
  329. package/dist/src/generators/migrate/angular-code-scan.js.map +1 -0
  330. package/dist/src/generators/migrate/angular-config-files.d.ts +49 -0
  331. package/dist/src/generators/migrate/angular-config-files.js +158 -0
  332. package/dist/src/generators/migrate/angular-config-files.js.map +1 -0
  333. package/dist/src/generators/migrate/angular-project-json.d.ts +73 -0
  334. package/dist/src/generators/migrate/angular-project-json.js +352 -0
  335. package/dist/src/generators/migrate/angular-project-json.js.map +1 -0
  336. package/dist/src/generators/migrate/angular-workspace/aliases.d.ts +30 -0
  337. package/dist/src/generators/migrate/angular-workspace/aliases.js +73 -0
  338. package/dist/src/generators/migrate/angular-workspace/aliases.js.map +1 -0
  339. package/dist/src/generators/migrate/angular-workspace/eslint.d.ts +8 -0
  340. package/dist/src/generators/migrate/angular-workspace/eslint.js +38 -0
  341. package/dist/src/generators/migrate/angular-workspace/eslint.js.map +1 -0
  342. package/dist/src/generators/migrate/angular-workspace/ng-package.d.ts +4 -0
  343. package/dist/src/generators/migrate/angular-workspace/ng-package.js +16 -0
  344. package/dist/src/generators/migrate/angular-workspace/ng-package.js.map +1 -0
  345. package/dist/src/generators/migrate/angular-workspace/source.d.ts +15 -0
  346. package/dist/src/generators/migrate/angular-workspace/source.js +108 -0
  347. package/dist/src/generators/migrate/angular-workspace/source.js.map +1 -0
  348. package/dist/src/generators/migrate/angular17.d.ts +45 -0
  349. package/dist/src/generators/migrate/angular17.js +495 -0
  350. package/dist/src/generators/migrate/angular17.js.map +1 -0
  351. package/dist/src/generators/migrate/batch.d.ts +29 -0
  352. package/dist/src/generators/migrate/batch.js +211 -0
  353. package/dist/src/generators/migrate/batch.js.map +1 -0
  354. package/dist/src/generators/migrate/copy.d.ts +60 -0
  355. package/dist/src/generators/migrate/copy.js +224 -0
  356. package/dist/src/generators/migrate/copy.js.map +1 -0
  357. package/dist/src/generators/migrate/dependencies.d.ts +38 -0
  358. package/dist/src/generators/migrate/dependencies.js +196 -0
  359. package/dist/src/generators/migrate/dependencies.js.map +1 -0
  360. package/dist/src/generators/migrate/generator.d.ts +9 -0
  361. package/dist/src/generators/migrate/generator.js +347 -0
  362. package/dist/src/generators/migrate/generator.js.map +1 -0
  363. package/dist/src/generators/migrate/imports/rewrite.d.ts +46 -0
  364. package/dist/src/generators/migrate/imports/rewrite.js +382 -0
  365. package/dist/src/generators/migrate/imports/rewrite.js.map +1 -0
  366. package/dist/src/generators/migrate/ionic/capacitor-config.d.ts +24 -0
  367. package/dist/src/generators/migrate/ionic/capacitor-config.js +113 -0
  368. package/dist/src/generators/migrate/ionic/capacitor-config.js.map +1 -0
  369. package/dist/src/generators/migrate/ionic/packages.d.ts +34 -0
  370. package/dist/src/generators/migrate/ionic/packages.js +92 -0
  371. package/dist/src/generators/migrate/ionic/packages.js.map +1 -0
  372. package/dist/src/generators/migrate/ionic/shape.d.ts +32 -0
  373. package/dist/src/generators/migrate/ionic/shape.js +221 -0
  374. package/dist/src/generators/migrate/ionic/shape.js.map +1 -0
  375. package/dist/src/generators/migrate/ionic/skip.d.ts +3 -0
  376. package/dist/src/generators/migrate/ionic/skip.js +25 -0
  377. package/dist/src/generators/migrate/ionic/skip.js.map +1 -0
  378. package/dist/src/generators/migrate/names.d.ts +3 -0
  379. package/dist/src/generators/migrate/names.js +21 -0
  380. package/dist/src/generators/migrate/names.js.map +1 -0
  381. package/dist/src/generators/migrate/npm-deps.d.ts +28 -0
  382. package/dist/src/generators/migrate/npm-deps.js +63 -0
  383. package/dist/src/generators/migrate/npm-deps.js.map +1 -0
  384. package/dist/src/generators/migrate/npm-workspaces/pnpm-yaml.d.ts +10 -0
  385. package/dist/src/generators/migrate/npm-workspaces/pnpm-yaml.js +246 -0
  386. package/dist/src/generators/migrate/npm-workspaces/pnpm-yaml.js.map +1 -0
  387. package/dist/src/generators/migrate/npm-workspaces/source.d.ts +46 -0
  388. package/dist/src/generators/migrate/npm-workspaces/source.js +253 -0
  389. package/dist/src/generators/migrate/npm-workspaces/source.js.map +1 -0
  390. package/dist/src/generators/migrate/nx/build-scripts.d.ts +22 -0
  391. package/dist/src/generators/migrate/nx/build-scripts.js +147 -0
  392. package/dist/src/generators/migrate/nx/build-scripts.js.map +1 -0
  393. package/dist/src/generators/migrate/nx/detect.d.ts +3 -0
  394. package/dist/src/generators/migrate/nx/detect.js +43 -0
  395. package/dist/src/generators/migrate/nx/detect.js.map +1 -0
  396. package/dist/src/generators/migrate/nx/env-encryption.d.ts +35 -0
  397. package/dist/src/generators/migrate/nx/env-encryption.js +423 -0
  398. package/dist/src/generators/migrate/nx/env-encryption.js.map +1 -0
  399. package/dist/src/generators/migrate/nx/rewrite.d.ts +27 -0
  400. package/dist/src/generators/migrate/nx/rewrite.js +223 -0
  401. package/dist/src/generators/migrate/nx/rewrite.js.map +1 -0
  402. package/dist/src/generators/migrate/nx/selection.d.ts +25 -0
  403. package/dist/src/generators/migrate/nx/selection.js +173 -0
  404. package/dist/src/generators/migrate/nx/selection.js.map +1 -0
  405. package/dist/src/generators/migrate/nx/shared-folders.d.ts +58 -0
  406. package/dist/src/generators/migrate/nx/shared-folders.js +239 -0
  407. package/dist/src/generators/migrate/nx/shared-folders.js.map +1 -0
  408. package/dist/src/generators/migrate/nx/workspace-source.d.ts +58 -0
  409. package/dist/src/generators/migrate/nx/workspace-source.js +275 -0
  410. package/dist/src/generators/migrate/nx/workspace-source.js.map +1 -0
  411. package/dist/src/generators/migrate/pnpm.d.ts +42 -0
  412. package/dist/src/generators/migrate/pnpm.js +132 -0
  413. package/dist/src/generators/migrate/pnpm.js.map +1 -0
  414. package/dist/src/generators/migrate/report.d.ts +21 -0
  415. package/dist/src/generators/migrate/report.js +243 -0
  416. package/dist/src/generators/migrate/report.js.map +1 -0
  417. package/dist/src/generators/migrate/rollback/manifest.d.ts +84 -0
  418. package/dist/src/generators/migrate/rollback/manifest.js +162 -0
  419. package/dist/src/generators/migrate/rollback/manifest.js.map +1 -0
  420. package/dist/src/generators/migrate/rollback/recording-tree.d.ts +19 -0
  421. package/dist/src/generators/migrate/rollback/recording-tree.js +87 -0
  422. package/dist/src/generators/migrate/rollback/recording-tree.js.map +1 -0
  423. package/dist/src/generators/migrate/rollback/rollback.d.ts +29 -0
  424. package/dist/src/generators/migrate/rollback/rollback.js +271 -0
  425. package/dist/src/generators/migrate/rollback/rollback.js.map +1 -0
  426. package/dist/src/generators/migrate/schema.d.ts +41 -0
  427. package/dist/src/generators/migrate/schema.json +85 -0
  428. package/dist/src/generators/migrate/source.d.ts +26 -0
  429. package/dist/src/generators/migrate/source.js +70 -0
  430. package/dist/src/generators/migrate/source.js.map +1 -0
  431. package/dist/src/generators/preset/files/root/.editorconfig__template__ +15 -0
  432. package/dist/src/generators/preset/files/root/.eslintignore__template__ +2 -0
  433. package/dist/src/generators/preset/files/root/.eslintrc.json__template__ +38 -0
  434. package/dist/src/generators/preset/files/root/.gitattributes__template__ +12 -0
  435. package/dist/src/generators/preset/files/root/.gitignore__template__ +9 -0
  436. package/dist/src/generators/preset/files/root/.husky/commit-msg__template__ +1 -0
  437. package/dist/src/generators/preset/files/root/.husky/pre-commit__template__ +1 -0
  438. package/dist/src/generators/preset/files/root/.npmrc__template__ +4 -0
  439. package/dist/src/generators/preset/files/root/.nvmrc__template__ +1 -0
  440. package/dist/src/generators/preset/files/root/.prettierignore__template__ +6 -0
  441. package/dist/src/generators/preset/files/root/.prettierrc__template__ +7 -0
  442. package/dist/src/generators/preset/files/root/commitlint.config.js__template__ +6 -0
  443. package/dist/src/generators/preset/files/root/nx.json__template__ +30 -0
  444. package/dist/src/generators/preset/files/root/package.json__template__ +34 -0
  445. package/dist/src/generators/preset/files/root/tools/config/sri-cdn-allowlist.json__template__ +1 -0
  446. package/dist/src/generators/preset/files/root/tsconfig.base.json__template__ +18 -0
  447. package/dist/src/generators/preset/generator.d.ts +11 -0
  448. package/dist/src/generators/preset/generator.js +91 -0
  449. package/dist/src/generators/preset/generator.js.map +1 -0
  450. package/dist/src/generators/preset/schema.d.ts +20 -0
  451. package/dist/src/generators/preset/schema.json +86 -0
  452. package/dist/src/generators/shared-libs/generator.d.ts +4 -0
  453. package/dist/src/generators/shared-libs/generator.js +60 -0
  454. package/dist/src/generators/shared-libs/generator.js.map +1 -0
  455. package/dist/src/generators/shared-libs/schema.d.ts +6 -0
  456. package/dist/src/generators/shared-libs/schema.json +21 -0
  457. package/dist/src/index.d.ts +16 -0
  458. package/dist/src/index.js +20 -0
  459. package/dist/src/index.js.map +1 -0
  460. package/dist/src/lib/csp/allowlist.d.ts +64 -0
  461. package/dist/src/lib/csp/allowlist.js +126 -0
  462. package/dist/src/lib/csp/allowlist.js.map +1 -0
  463. package/dist/src/lib/csp/import.d.ts +52 -0
  464. package/dist/src/lib/csp/import.js +291 -0
  465. package/dist/src/lib/csp/import.js.map +1 -0
  466. package/dist/src/lib/csp/render.d.ts +19 -0
  467. package/dist/src/lib/csp/render.js +116 -0
  468. package/dist/src/lib/csp/render.js.map +1 -0
  469. package/dist/src/lib/env/derive.d.ts +38 -0
  470. package/dist/src/lib/env/derive.js +115 -0
  471. package/dist/src/lib/env/derive.js.map +1 -0
  472. package/dist/src/lib/env-encryption/backup.d.ts +40 -0
  473. package/dist/src/lib/env-encryption/backup.js +234 -0
  474. package/dist/src/lib/env-encryption/backup.js.map +1 -0
  475. package/dist/src/lib/env-encryption/config.d.ts +50 -0
  476. package/dist/src/lib/env-encryption/config.js +173 -0
  477. package/dist/src/lib/env-encryption/config.js.map +1 -0
  478. package/dist/src/lib/env-encryption/domains.d.ts +9 -0
  479. package/dist/src/lib/env-encryption/domains.js +52 -0
  480. package/dist/src/lib/env-encryption/domains.js.map +1 -0
  481. package/dist/src/lib/env-encryption/encrypt.d.ts +48 -0
  482. package/dist/src/lib/env-encryption/encrypt.js +407 -0
  483. package/dist/src/lib/env-encryption/encrypt.js.map +1 -0
  484. package/dist/src/lib/env-encryption/env-file.d.ts +72 -0
  485. package/dist/src/lib/env-encryption/env-file.js +395 -0
  486. package/dist/src/lib/env-encryption/env-file.js.map +1 -0
  487. package/dist/src/lib/env-encryption/gcm.d.ts +51 -0
  488. package/dist/src/lib/env-encryption/gcm.js +76 -0
  489. package/dist/src/lib/env-encryption/gcm.js.map +1 -0
  490. package/dist/src/lib/env-encryption/key-material.d.ts +53 -0
  491. package/dist/src/lib/env-encryption/key-material.js +148 -0
  492. package/dist/src/lib/env-encryption/key-material.js.map +1 -0
  493. package/dist/src/lib/env-encryption/placeholders.d.ts +15 -0
  494. package/dist/src/lib/env-encryption/placeholders.js +93 -0
  495. package/dist/src/lib/env-encryption/placeholders.js.map +1 -0
  496. package/dist/src/lib/env-encryption/prepare.d.ts +43 -0
  497. package/dist/src/lib/env-encryption/prepare.js +245 -0
  498. package/dist/src/lib/env-encryption/prepare.js.map +1 -0
  499. package/dist/src/lib/env-encryption/sensitive.d.ts +2 -0
  500. package/dist/src/lib/env-encryption/sensitive.js +180 -0
  501. package/dist/src/lib/env-encryption/sensitive.js.map +1 -0
  502. package/dist/src/lib/env-encryption/stamp.d.ts +2 -0
  503. package/dist/src/lib/env-encryption/stamp.js +52 -0
  504. package/dist/src/lib/env-encryption/stamp.js.map +1 -0
  505. package/dist/src/lib/env-encryption/switch-gcm.d.ts +43 -0
  506. package/dist/src/lib/env-encryption/switch-gcm.js +371 -0
  507. package/dist/src/lib/env-encryption/switch-gcm.js.map +1 -0
  508. package/dist/src/lib/env-encryption/workspace.d.ts +10 -0
  509. package/dist/src/lib/env-encryption/workspace.js +48 -0
  510. package/dist/src/lib/env-encryption/workspace.js.map +1 -0
  511. package/dist/src/lib/hardening/files.d.ts +17 -0
  512. package/dist/src/lib/hardening/files.js +43 -0
  513. package/dist/src/lib/hardening/files.js.map +1 -0
  514. package/dist/src/lib/hardening/integrity.d.ts +24 -0
  515. package/dist/src/lib/hardening/integrity.js +112 -0
  516. package/dist/src/lib/hardening/integrity.js.map +1 -0
  517. package/dist/src/lib/hardening/leak-check.d.ts +15 -0
  518. package/dist/src/lib/hardening/leak-check.js +100 -0
  519. package/dist/src/lib/hardening/leak-check.js.map +1 -0
  520. package/dist/src/lib/hardening/ngsw.d.ts +7 -0
  521. package/dist/src/lib/hardening/ngsw.js +55 -0
  522. package/dist/src/lib/hardening/ngsw.js.map +1 -0
  523. package/dist/src/lib/hardening/obfuscate.d.ts +36 -0
  524. package/dist/src/lib/hardening/obfuscate.js +153 -0
  525. package/dist/src/lib/hardening/obfuscate.js.map +1 -0
  526. package/dist/src/lib/hardening/options.d.ts +36 -0
  527. package/dist/src/lib/hardening/options.js +143 -0
  528. package/dist/src/lib/hardening/options.js.map +1 -0
  529. package/dist/src/lib/hardening/source-maps.d.ts +7 -0
  530. package/dist/src/lib/hardening/source-maps.js +37 -0
  531. package/dist/src/lib/hardening/source-maps.js.map +1 -0
  532. package/dist/src/lib/hardening/strip.d.ts +55 -0
  533. package/dist/src/lib/hardening/strip.js +178 -0
  534. package/dist/src/lib/hardening/strip.js.map +1 -0
  535. package/dist/src/lib/helpers/encrypt-env.d.ts +13 -0
  536. package/dist/src/lib/helpers/encrypt-env.js +33 -0
  537. package/dist/src/lib/helpers/encrypt-env.js.map +1 -0
  538. package/dist/src/lib/helpers/inject-meta.d.ts +14 -0
  539. package/dist/src/lib/helpers/inject-meta.js +49 -0
  540. package/dist/src/lib/helpers/inject-meta.js.map +1 -0
  541. package/dist/src/lib/helpers/inject-nonce.d.ts +7 -0
  542. package/dist/src/lib/helpers/inject-nonce.js +59 -0
  543. package/dist/src/lib/helpers/inject-nonce.js.map +1 -0
  544. package/dist/src/lib/helpers/inject-sri.d.ts +11 -0
  545. package/dist/src/lib/helpers/inject-sri.js +92 -0
  546. package/dist/src/lib/helpers/inject-sri.js.map +1 -0
  547. package/dist/src/lib/helpers/strip-exif.d.ts +9 -0
  548. package/dist/src/lib/helpers/strip-exif.js +52 -0
  549. package/dist/src/lib/helpers/strip-exif.js.map +1 -0
  550. package/dist/src/lib/release/plan.d.ts +45 -0
  551. package/dist/src/lib/release/plan.js +76 -0
  552. package/dist/src/lib/release/plan.js.map +1 -0
  553. package/dist/src/lib/release/run.d.ts +46 -0
  554. package/dist/src/lib/release/run.js +160 -0
  555. package/dist/src/lib/release/run.js.map +1 -0
  556. package/dist/src/lib/utils/angular-deps.d.ts +22 -0
  557. package/dist/src/lib/utils/angular-deps.js +108 -0
  558. package/dist/src/lib/utils/angular-deps.js.map +1 -0
  559. package/dist/src/lib/utils/angular-project.d.ts +52 -0
  560. package/dist/src/lib/utils/angular-project.js +168 -0
  561. package/dist/src/lib/utils/angular-project.js.map +1 -0
  562. package/dist/src/lib/utils/app-dir.d.ts +17 -0
  563. package/dist/src/lib/utils/app-dir.js +52 -0
  564. package/dist/src/lib/utils/app-dir.js.map +1 -0
  565. package/dist/src/lib/utils/base-href.d.ts +26 -0
  566. package/dist/src/lib/utils/base-href.js +60 -0
  567. package/dist/src/lib/utils/base-href.js.map +1 -0
  568. package/dist/src/lib/utils/ci-resolve.d.ts +10 -0
  569. package/dist/src/lib/utils/ci-resolve.js +50 -0
  570. package/dist/src/lib/utils/ci-resolve.js.map +1 -0
  571. package/dist/src/lib/utils/csp-nonce.d.ts +34 -0
  572. package/dist/src/lib/utils/csp-nonce.js +142 -0
  573. package/dist/src/lib/utils/csp-nonce.js.map +1 -0
  574. package/dist/src/lib/utils/dependencies.d.ts +25 -0
  575. package/dist/src/lib/utils/dependencies.js +71 -0
  576. package/dist/src/lib/utils/dependencies.js.map +1 -0
  577. package/dist/src/lib/utils/devkit-deps.d.ts +19 -0
  578. package/dist/src/lib/utils/devkit-deps.js +34 -0
  579. package/dist/src/lib/utils/devkit-deps.js.map +1 -0
  580. package/dist/src/lib/utils/env-files.d.ts +18 -0
  581. package/dist/src/lib/utils/env-files.js +41 -0
  582. package/dist/src/lib/utils/env-files.js.map +1 -0
  583. package/dist/src/lib/utils/filesystem.d.ts +7 -0
  584. package/dist/src/lib/utils/filesystem.js +20 -0
  585. package/dist/src/lib/utils/filesystem.js.map +1 -0
  586. package/dist/src/lib/utils/flutter-web.d.ts +7 -0
  587. package/dist/src/lib/utils/flutter-web.js +56 -0
  588. package/dist/src/lib/utils/flutter-web.js.map +1 -0
  589. package/dist/src/lib/utils/knip.d.ts +16 -0
  590. package/dist/src/lib/utils/knip.js +71 -0
  591. package/dist/src/lib/utils/knip.js.map +1 -0
  592. package/dist/src/lib/utils/lint-staged.d.ts +5 -0
  593. package/dist/src/lib/utils/lint-staged.js +34 -0
  594. package/dist/src/lib/utils/lint-staged.js.map +1 -0
  595. package/dist/src/lib/utils/llm-block.d.ts +88 -0
  596. package/dist/src/lib/utils/llm-block.js +457 -0
  597. package/dist/src/lib/utils/llm-block.js.map +1 -0
  598. package/dist/src/lib/utils/node-engine.d.ts +9 -0
  599. package/dist/src/lib/utils/node-engine.js +63 -0
  600. package/dist/src/lib/utils/node-engine.js.map +1 -0
  601. package/dist/src/lib/utils/npm-scripts.d.ts +7 -0
  602. package/dist/src/lib/utils/npm-scripts.js +28 -0
  603. package/dist/src/lib/utils/npm-scripts.js.map +1 -0
  604. package/dist/src/lib/utils/nx-targets.d.ts +3 -0
  605. package/dist/src/lib/utils/nx-targets.js +25 -0
  606. package/dist/src/lib/utils/nx-targets.js.map +1 -0
  607. package/dist/src/lib/utils/project-json-files.d.ts +23 -0
  608. package/dist/src/lib/utils/project-json-files.js +73 -0
  609. package/dist/src/lib/utils/project-json-files.js.map +1 -0
  610. package/dist/src/lib/utils/quality.d.ts +71 -0
  611. package/dist/src/lib/utils/quality.js +295 -0
  612. package/dist/src/lib/utils/quality.js.map +1 -0
  613. package/dist/src/lib/utils/serve-port.d.ts +28 -0
  614. package/dist/src/lib/utils/serve-port.js +73 -0
  615. package/dist/src/lib/utils/serve-port.js.map +1 -0
  616. package/dist/src/lib/utils/shared-libs.d.ts +37 -0
  617. package/dist/src/lib/utils/shared-libs.js +152 -0
  618. package/dist/src/lib/utils/shared-libs.js.map +1 -0
  619. package/dist/src/lib/utils/ts-paths.d.ts +3 -0
  620. package/dist/src/lib/utils/ts-paths.js +31 -0
  621. package/dist/src/lib/utils/ts-paths.js.map +1 -0
  622. package/dist/src/lib/utils/workspace.d.ts +3 -0
  623. package/dist/src/lib/utils/workspace.js +15 -0
  624. package/dist/src/lib/utils/workspace.js.map +1 -0
  625. package/dist/src/migrate-sdk.d.ts +31 -0
  626. package/dist/src/migrate-sdk.js +35 -0
  627. package/dist/src/migrate-sdk.js.map +1 -0
  628. package/dist/src/migrations/add-csp-nonce-import/add-csp-nonce-import.d.ts +2 -0
  629. package/dist/src/migrations/add-csp-nonce-import/add-csp-nonce-import.js +40 -0
  630. package/dist/src/migrations/add-csp-nonce-import/add-csp-nonce-import.js.map +1 -0
  631. package/dist/src/migrations/add-executor-peers/add-executor-peers.d.ts +6 -0
  632. package/dist/src/migrations/add-executor-peers/add-executor-peers.js +21 -0
  633. package/dist/src/migrations/add-executor-peers/add-executor-peers.js.map +1 -0
  634. package/dist/src/migrations/add-lib-build-dependencies/add-lib-build-dependencies.d.ts +7 -0
  635. package/dist/src/migrations/add-lib-build-dependencies/add-lib-build-dependencies.js +47 -0
  636. package/dist/src/migrations/add-lib-build-dependencies/add-lib-build-dependencies.js.map +1 -0
  637. package/dist/src/migrations/add-lint-dependencies/add-lint-dependencies.d.ts +6 -0
  638. package/dist/src/migrations/add-lint-dependencies/add-lint-dependencies.js +27 -0
  639. package/dist/src/migrations/add-lint-dependencies/add-lint-dependencies.js.map +1 -0
  640. package/dist/src/migrations/add-lint-staged-config/add-lint-staged-config.d.ts +7 -0
  641. package/dist/src/migrations/add-lint-staged-config/add-lint-staged-config.js +22 -0
  642. package/dist/src/migrations/add-lint-staged-config/add-lint-staged-config.js.map +1 -0
  643. package/dist/src/migrations/angular-release-target/angular-release-target.d.ts +3 -0
  644. package/dist/src/migrations/angular-release-target/angular-release-target.js +80 -0
  645. package/dist/src/migrations/angular-release-target/angular-release-target.js.map +1 -0
  646. package/dist/src/migrations/app-clean-and-port/app-clean-and-port.d.ts +7 -0
  647. package/dist/src/migrations/app-clean-and-port/app-clean-and-port.js +89 -0
  648. package/dist/src/migrations/app-clean-and-port/app-clean-and-port.js.map +1 -0
  649. package/dist/src/migrations/env-encryption-config/env-encryption-config.d.ts +7 -0
  650. package/dist/src/migrations/env-encryption-config/env-encryption-config.js +42 -0
  651. package/dist/src/migrations/env-encryption-config/env-encryption-config.js.map +1 -0
  652. package/dist/src/migrations/env-encryption-key-sources/env-encryption-key-sources.d.ts +3 -0
  653. package/dist/src/migrations/env-encryption-key-sources/env-encryption-key-sources.js +15 -0
  654. package/dist/src/migrations/env-encryption-key-sources/env-encryption-key-sources.js.map +1 -0
  655. package/dist/src/migrations/fix-lint-script/fix-lint-script.d.ts +7 -0
  656. package/dist/src/migrations/fix-lint-script/fix-lint-script.js +27 -0
  657. package/dist/src/migrations/fix-lint-script/fix-lint-script.js.map +1 -0
  658. package/dist/src/migrations/flutter-web-platform/flutter-web-platform.d.ts +8 -0
  659. package/dist/src/migrations/flutter-web-platform/flutter-web-platform.js +35 -0
  660. package/dist/src/migrations/flutter-web-platform/flutter-web-platform.js.map +1 -0
  661. package/dist/src/migrations/plugin-repo-dev/plugin-repo-dev.d.ts +9 -0
  662. package/dist/src/migrations/plugin-repo-dev/plugin-repo-dev.js +42 -0
  663. package/dist/src/migrations/plugin-repo-dev/plugin-repo-dev.js.map +1 -0
  664. package/dist/src/migrations/prepush-audit-warn-only/prepush-audit-warn-only.d.ts +8 -0
  665. package/dist/src/migrations/prepush-audit-warn-only/prepush-audit-warn-only.js +30 -0
  666. package/dist/src/migrations/prepush-audit-warn-only/prepush-audit-warn-only.js.map +1 -0
  667. package/dist/src/migrations/quality-checks/quality-checks.d.ts +7 -0
  668. package/dist/src/migrations/quality-checks/quality-checks.js +46 -0
  669. package/dist/src/migrations/quality-checks/quality-checks.js.map +1 -0
  670. package/dist/src/migrations/release-hardening/release-hardening.d.ts +8 -0
  671. package/dist/src/migrations/release-hardening/release-hardening.js +98 -0
  672. package/dist/src/migrations/release-hardening/release-hardening.js.map +1 -0
  673. package/dist/src/migrations/sharp-security-update/sharp-security-update.d.ts +10 -0
  674. package/dist/src/migrations/sharp-security-update/sharp-security-update.js +40 -0
  675. package/dist/src/migrations/sharp-security-update/sharp-security-update.js.map +1 -0
  676. package/migrate/package.json +5 -0
  677. package/package.json +119 -4
  678. package/runtime/csp-nonce.js +109 -0
  679. package/runtime/env-secret.d.ts +63 -0
  680. package/runtime/env-secret.mjs +698 -0
@@ -0,0 +1,1037 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rewriteScript = exports.nxWorkspaceAdapter = exports.classifyWorkspaceSpec = exports.dependencyFields = exports.treeProjectNames = exports.planNxImport = exports.workspacePaths = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fs = tslib_1.__importStar(require("fs"));
6
+ const path = tslib_1.__importStar(require("path"));
7
+ const devkit_1 = require("@nx/devkit");
8
+ const angular_deps_1 = require("../../../lib/utils/angular-deps");
9
+ const csp_nonce_1 = require("../../../lib/utils/csp-nonce");
10
+ const dependencies_1 = require("../../../lib/utils/dependencies");
11
+ const env_files_1 = require("../../../lib/utils/env-files");
12
+ const node_engine_1 = require("../../../lib/utils/node-engine");
13
+ const npm_scripts_1 = require("../../../lib/utils/npm-scripts");
14
+ const serve_port_1 = require("../../../lib/utils/serve-port");
15
+ const generator_1 = require("../../app/generator");
16
+ const angular_project_json_1 = require("../angular-project-json");
17
+ const copy_1 = require("../copy");
18
+ const dependencies_2 = require("../dependencies");
19
+ const packages_1 = require("../ionic/packages");
20
+ const shape_1 = require("../ionic/shape");
21
+ const skip_1 = require("../ionic/skip");
22
+ const npm_deps_1 = require("../npm-deps");
23
+ const build_scripts_1 = require("../nx/build-scripts");
24
+ const detect_1 = require("../nx/detect");
25
+ const env_encryption_1 = require("../nx/env-encryption");
26
+ const rewrite_1 = require("../nx/rewrite");
27
+ const selection_1 = require("../nx/selection");
28
+ const shared_folders_1 = require("../nx/shared-folders");
29
+ const workspace_source_1 = require("../nx/workspace-source");
30
+ const pnpm_1 = require("../pnpm");
31
+ const source_1 = require("../source");
32
+ const angular_cli_1 = require("./angular-cli");
33
+ const flutter_1 = require("./flutter");
34
+ const types_1 = require("./types");
35
+ const code = (s) => `\`${s}\``;
36
+ /** Kinds whose packages come from the source's root package.json. */
37
+ const NPM_KINDS = new Set(['angular-app', 'ionic-app', 'lib']);
38
+ const normalizePath = (p) => path.posix.normalize(p).replace(/^\.\//, '');
39
+ function workspacePaths(tree) {
40
+ if (!tree.exists('tsconfig.base.json'))
41
+ return {};
42
+ const paths = (0, devkit_1.readJson)(tree, 'tsconfig.base.json')?.compilerOptions?.paths;
43
+ if (!(0, workspace_source_1.isObject)(paths))
44
+ return {};
45
+ return Object.fromEntries(Object.entries(paths).map(([alias, targets]) => [
46
+ alias,
47
+ Array.isArray(targets) ? targets.map((t) => normalizePath(String(t))) : [],
48
+ ]));
49
+ }
50
+ exports.workspacePaths = workspacePaths;
51
+ /** Selection, names and every check; throws (writing nothing) when something is in the way. */
52
+ function planNxImport(tree, ctx) {
53
+ const all = (0, workspace_source_1.discoverProjects)(ctx.sourceDir);
54
+ const chosen = (0, selection_1.selectProjects)({
55
+ sourceDir: ctx.sourceDir,
56
+ projects: all,
57
+ requested: ctx.projects,
58
+ noDeps: ctx.noDeps,
59
+ });
60
+ const renames = new Map([...chosen.keys()].map((n) => [n, ctx.prefix ? `${ctx.prefix}-${n}` : n]));
61
+ const byName = new Map(all.map((p) => [p.name, p]));
62
+ const projects = [...chosen]
63
+ .map(([n, neededBy]) => {
64
+ const source = byName.get(n);
65
+ if (!source)
66
+ throw new Error(`migrate: unknown source project "${n}".`);
67
+ return { source, name: renames.get(n) ?? n, neededBy };
68
+ })
69
+ .sort((a, b) => (a.source.root < b.source.root ? -1 : 1));
70
+ const copied = projects.map((p) => p.source);
71
+ const copiedAliases = {};
72
+ const otherAliases = [];
73
+ for (const [alias, targets] of Object.entries((0, selection_1.readSourceAliases)(ctx.sourceDir))) {
74
+ const inside = (t) => t.includes('*') ? copied.some((p) => wildcardCovers(t, p.root)) : !!(0, workspace_source_1.ownerOf)(copied, t);
75
+ if (targets.length > 0 && targets.every(inside))
76
+ copiedAliases[alias] = targets;
77
+ else
78
+ otherAliases.push(alias);
79
+ }
80
+ const errors = [];
81
+ const existing = new Set(treeProjectNames(tree));
82
+ for (const p of projects) {
83
+ if (tree.exists(p.source.root)) {
84
+ errors.push(`${code(p.source.root)} already exists in the workspace (source project ${p.source.name}).`);
85
+ }
86
+ if (existing.has(p.name)) {
87
+ errors.push(`a project named "${p.name}" already exists in the workspace.` +
88
+ (ctx.prefix ? '' : ' Rename the migrated projects with --prefix=<p>.'));
89
+ }
90
+ }
91
+ const wsPaths = workspacePaths(tree);
92
+ for (const [alias, targets] of Object.entries(copiedAliases)) {
93
+ const ws = wsPaths[alias];
94
+ if (ws && JSON.stringify(ws) !== JSON.stringify(targets)) {
95
+ errors.push(`the path alias "${alias}" maps to ${ws.join(', ')} in the workspace but to ` +
96
+ `${targets.join(', ')} in the source; imports would resolve to the wrong code.`);
97
+ }
98
+ }
99
+ const npmProjects = projects.some((p) => NPM_KINDS.has(p.source.kind));
100
+ const rootPkg = (0, pnpm_1.sourceRootPackage)(ctx.sourceDir);
101
+ if (rootPkg.unresolved.length > 0) {
102
+ errors.push((0, pnpm_1.catalogMissMessage)('the source root package.json', rootPkg.unresolved));
103
+ }
104
+ const mismatch = (0, dependencies_2.angularMismatch)(tree, rootPkg.pkg);
105
+ if (mismatch && npmProjects && !ctx.forceAngular)
106
+ errors.push((0, dependencies_2.angularMismatchMessage)(mismatch));
107
+ if (errors.length > 0) {
108
+ throw new Error([
109
+ `migrate: cannot import from ${ctx.sourceDir}. Nothing was written.`,
110
+ ...errors.map((e) => `- ${e}`),
111
+ ].join('\n'));
112
+ }
113
+ return { all, projects, renames, copiedAliases, otherAliases: otherAliases.sort() };
114
+ }
115
+ exports.planNxImport = planNxImport;
116
+ /** A wildcard alias target (with a `*` segment) that can resolve inside `root`. */
117
+ function wildcardCovers(target, root) {
118
+ const prefix = target.slice(0, target.indexOf('*'));
119
+ return root.startsWith(prefix) || `${root}/`.startsWith(prefix) || prefix.startsWith(`${root}/`);
120
+ }
121
+ const WALK_SKIP = new Set(['node_modules', 'dist', 'tmp', 'coverage']);
122
+ /** Names of every project in the workspace tree (project.json `name`, else the folder name). */
123
+ function treeProjectNames(tree) {
124
+ const names = [];
125
+ const visit = (dir) => {
126
+ for (const child of tree.children(dir)) {
127
+ const rel = dir ? `${dir}/${child}` : child;
128
+ if (child === 'project.json' && tree.isFile(rel)) {
129
+ let name;
130
+ try {
131
+ name = (0, devkit_1.readJson)(tree, rel)?.name;
132
+ }
133
+ catch {
134
+ name = undefined;
135
+ }
136
+ names.push(typeof name === 'string' ? name : path.posix.basename(dir));
137
+ }
138
+ else if (!tree.isFile(rel) && !WALK_SKIP.has(child) && !child.startsWith('.')) {
139
+ visit(rel);
140
+ }
141
+ }
142
+ };
143
+ visit('');
144
+ return names;
145
+ }
146
+ exports.treeProjectNames = treeProjectNames;
147
+ const NX_IMPORT = /^@(nrwl|nx)\/([^/]+)/;
148
+ const CODE_FILE = /\.(ts|tsx|mts|js|mjs|cjs)$/;
149
+ const schemaPath = (root) => `${'../'.repeat(root.split('/').length)}node_modules/nx/schemas/project-schema.json`;
150
+ const writeJson = (tree, file, value) => tree.write(file, JSON.stringify(value, null, 2) + '\n');
151
+ const ESLINTRC = /(^|\/)\.eslintrc\.json$/;
152
+ const TOO_MANY = 'migrate: the source has more than';
153
+ function dependencyFields(tree) {
154
+ const pkg = (0, devkit_1.readJson)(tree, 'package.json');
155
+ return JSON.stringify([pkg.dependencies, pkg.devDependencies, pkg.optionalDependencies]);
156
+ }
157
+ exports.dependencyFields = dependencyFields;
158
+ /** file:/link: specs keep their path when they point into a copied project. */
159
+ function classifyWorkspaceSpec(spec, sourceDir, roots) {
160
+ const kind = (0, npm_deps_1.classifyDependencySpec)(spec, { sourceDir, copiedDir: sourceDir, projectRoot: '' });
161
+ if (kind.kind !== 'rebased')
162
+ return kind;
163
+ const rel = kind.spec.slice('file:'.length);
164
+ return roots.some((r) => rel === r || rel.startsWith(`${r}/`))
165
+ ? kind
166
+ : { kind: 'outside', target: path.join(sourceDir, rel) };
167
+ }
168
+ exports.classifyWorkspaceSpec = classifyWorkspaceSpec;
169
+ function copyProject(tree, ctx, plan, p, alreadyCopied) {
170
+ const { root, kind } = p.source;
171
+ const nested = plan.all
172
+ .map((o) => o.root)
173
+ .filter((r) => r !== root && r.startsWith(`${root}/`))
174
+ .map((r) => r.slice(root.length + 1));
175
+ const base = kind === 'flutter-app' || kind === 'flutter-lib'
176
+ ? flutter_1.FLUTTER_SKIP
177
+ : kind === 'ionic-app'
178
+ ? (0, skip_1.withIonicSkip)(angular_cli_1.ANGULAR_SKIP_NESTED)
179
+ : angular_cli_1.ANGULAR_SKIP_NESTED;
180
+ const rules = { ...base, paths: [...(base.paths ?? []), ...nested] };
181
+ const maxFiles = ctx.maxFiles ?? copy_1.DEFAULT_MAX_FILES;
182
+ try {
183
+ return (0, copy_1.copyIntoTree)(tree, path.join(ctx.sourceDir, ...root.split('/')), root, rules, {
184
+ ignoreFrom: ctx.sourceDir,
185
+ maxFiles: maxFiles - alreadyCopied,
186
+ });
187
+ }
188
+ catch (err) {
189
+ if (err instanceof Error && err.message.startsWith(TOO_MANY)) {
190
+ throw new Error(`migrate: the selected projects have more than ${maxFiles} files to copy after the skip ` +
191
+ 'lists. Narrow --projects, clean up the source, or raise --max-files.');
192
+ }
193
+ throw err;
194
+ }
195
+ }
196
+ function migrateNxWorkspace(tree, ctx) {
197
+ const plan = planNxImport(tree, ctx);
198
+ const { sourceDir } = ctx;
199
+ const data = { ...(0, types_1.emptyReportData)(), projects: [], unsupported: [] };
200
+ const roots = plan.projects.map((p) => p.source.root);
201
+ const pluginPackages = new Set();
202
+ const usedInputs = new Set();
203
+ let usesJest = false;
204
+ let usesNgPackagr = false;
205
+ if (!tree.exists('package.json'))
206
+ writeJson(tree, 'package.json', {});
207
+ const depsBefore = dependencyFields(tree);
208
+ const namesBefore = (0, dependencies_2.packageNames)(tree);
209
+ const isNative = (0, packages_1.nativeClassifier)(sourceDir);
210
+ /** Native packages each copied project's code imports. */
211
+ const nativeImportsOf = new Map();
212
+ const ionicApps = [];
213
+ const sourcePkg = (0, pnpm_1.sourceRootPackage)(sourceDir).pkg;
214
+ const npmProjects = plan.projects.some((p) => NPM_KINDS.has(p.source.kind));
215
+ // Folders the projects use that are not projects (assets, styles, environments, tools).
216
+ const shared = findSharedFolders(ctx, plan, npmProjects ? sourcePkg?.scripts : undefined);
217
+ copySharedFolders(tree, ctx, shared, data);
218
+ const buildScripts = (0, build_scripts_1.readBuildScripts)(sourceDir, npmProjects ? sourcePkg?.scripts : undefined, plan.projects.map((p) => p.source.name));
219
+ const mains = [];
220
+ for (const p of plan.projects) {
221
+ const { root, kind } = p.source;
222
+ const copy = copyProject(tree, ctx, plan, p, data.copied);
223
+ (0, types_1.recordCopy)(data, copy, root);
224
+ const dropped = new Set();
225
+ let config = (0, rewrite_1.rewriteProjectConfig)(p.source.config, p.name, plan.renames, (n) => dropped.add(n));
226
+ if (p.source.origin !== 'project.json') {
227
+ const rest = { ...config };
228
+ delete rest['name'];
229
+ delete rest['root'];
230
+ delete rest['$schema'];
231
+ config = { name: config['name'], $schema: schemaPath(root), ...rest };
232
+ }
233
+ if (!(0, workspace_source_1.isObject)(config['targets']))
234
+ config['targets'] = {};
235
+ const targets = config['targets'];
236
+ const tags = Array.isArray(config['tags']) ? [...config['tags']] : [];
237
+ const addTag = (prefix, tag) => {
238
+ if (!tags.some((t) => t.startsWith(prefix)))
239
+ tags.push(tag);
240
+ };
241
+ const notes = [];
242
+ if (kind === 'angular-app' || kind === 'ionic-app') {
243
+ const releases = (0, angular_project_json_1.addReleaseTarget)(targets, p.name, (w) => notes.push(w), root);
244
+ // Only the release target this run added; a source's own release target stays as it was.
245
+ if (releases.length > 0)
246
+ shapeReleaseTarget(targets, p, buildScripts, notes);
247
+ const main = mainOf(targets);
248
+ if (main)
249
+ mains.push(main);
250
+ addTag('type:', 'type:app');
251
+ addTag('platform:', kind === 'ionic-app' ? 'platform:mobile' : 'platform:web');
252
+ // The source's own scripts of the same name (custom build pipelines) win.
253
+ const appScripts = (0, angular_project_json_1.angularAppNpmScripts)(p.name, targets['serve'] !== undefined, releases);
254
+ for (const k of Object.keys(npmProjects ? sourcePkg?.scripts ?? {} : {}))
255
+ delete appScripts[k];
256
+ (0, npm_scripts_1.addNpmScripts)(tree, appScripts, { force: false });
257
+ data.nextSteps.push(`\`npx nx build ${p.name}\``);
258
+ if (kind === 'ionic-app')
259
+ ionicApps.push({ p, releases });
260
+ }
261
+ else if (kind === 'lib') {
262
+ addTag('type:', 'type:lib');
263
+ }
264
+ else if (kind === 'flutter-app') {
265
+ const polystack = (0, generator_1.buildProjectJson)(p.name, {
266
+ exportTarget: false,
267
+ root,
268
+ port: (0, serve_port_1.nextFreePort)((0, serve_port_1.usedServePorts)(tree).map((u) => u.port)),
269
+ }).targets;
270
+ // A clean target of the source is kept.
271
+ if (targets['clean'] !== undefined)
272
+ delete polystack['clean'];
273
+ const replaced = Object.keys(polystack)
274
+ .filter((t) => targets[t] !== undefined)
275
+ .sort();
276
+ Object.assign(targets, polystack);
277
+ if (replaced.length > 0) {
278
+ notes.push(`source targets replaced by the polystack Flutter targets: ${replaced.join(', ')}`);
279
+ }
280
+ addTag('type:', 'type:app');
281
+ addTag('platform:', 'platform:flutter');
282
+ const created = (0, env_files_1.generateFlutterEnvFiles)(tree, p.name, {
283
+ keepExisting: true,
284
+ empty: true,
285
+ root,
286
+ });
287
+ if (created.length > 0) {
288
+ notes.push(`created empty ${created.map(code).join(', ')}; fill them (they are passed to Flutter ` +
289
+ 'with `--dart-define-from-file`)');
290
+ }
291
+ (0, npm_scripts_1.addNpmScripts)(tree, (0, generator_1.buildNpmScripts)(p.name, { exportTarget: false }), { force: false });
292
+ data.nextSteps.push(`\`cd ${root} && flutter pub get\``, `\`npx nx run ${p.name}:build-web:dev\``);
293
+ }
294
+ config['tags'] = tags;
295
+ for (const executor of (0, rewrite_1.executorsOf)(config)) {
296
+ const pkg = (0, rewrite_1.nxPluginPackage)(executor);
297
+ if (pkg)
298
+ pluginPackages.add(pkg);
299
+ if (executor === '@nx/jest:jest')
300
+ usesJest = true;
301
+ if (/^@nx\/angular:(package|ng-packagr-lite)$/.test(executor))
302
+ usesNgPackagr = true;
303
+ }
304
+ for (const input of namedInputsOf(targets))
305
+ usedInputs.add(input);
306
+ writeJson(tree, `${root}/project.json`, config);
307
+ if (dropped.size > 0) {
308
+ notes.push(`dropped references to projects that were not copied: ${[...dropped]
309
+ .sort()
310
+ .map(code)
311
+ .join(', ')} (implicitDependencies / dependsOn); Nx fails on unknown projects`);
312
+ }
313
+ const nrwlImports = [];
314
+ for (const f of copy.copied.filter((c) => CODE_FILE.test(c))) {
315
+ const text = tree.read(`${root}/${f}`, 'utf8') ?? '';
316
+ let nrwl = false;
317
+ for (const spec of (0, selection_1.importSpecifiers)(text)) {
318
+ const pkgName = (0, packages_1.packageOfSpecifier)(spec);
319
+ if ((0, packages_1.isWebCodeFile)(f) && isNative(pkgName)) {
320
+ const set = nativeImportsOf.get(p.name) ?? new Set();
321
+ set.add(pkgName);
322
+ nativeImportsOf.set(p.name, set);
323
+ }
324
+ const m = NX_IMPORT.exec(spec);
325
+ if (!m)
326
+ continue;
327
+ pluginPackages.add(`@nx/${m[2]}`);
328
+ if (m[1] === 'nrwl')
329
+ nrwl = true;
330
+ }
331
+ if (nrwl)
332
+ nrwlImports.push(`${root}/${f}`);
333
+ }
334
+ if (nrwlImports.length > 0 && !ctx.rewriteImports) {
335
+ notes.push(`these files import \`@nrwl/*\` packages; rename the imports to \`@nx/*\`: ` +
336
+ nrwlImports.map(code).join(', '));
337
+ }
338
+ if (kind === 'flutter-app' && !/^apps\/[^/]+$/.test(root)) {
339
+ notes.push(`\`pstack env\` only updates apps directly under \`apps/\`; add new env files to ` +
340
+ `${code(`${root}/env`)} and configurations to its build targets by hand`);
341
+ }
342
+ for (const f of copy.copied.filter((c) => ESLINTRC.test(c))) {
343
+ const file = `${root}/${f}`;
344
+ writeJson(tree, file, (0, rewrite_1.rewriteEslintConfig)((0, source_1.parseJsonStrict)(tree.read(file, 'utf8') ?? '', file)));
345
+ }
346
+ if (targets['lint'] !== undefined)
347
+ data.nextSteps.push(`\`npx nx lint ${p.name}\``);
348
+ const outside = (0, rewrite_1.outsidePaths)(config, roots, (first) => (0, source_1.sourceExists)(sourceDir, first) || tree.exists(first)).filter((o) => !tree.exists(o));
349
+ if (outside.length > 0) {
350
+ notes.push(`options point outside the copied projects, at paths the workspace does not have: ` +
351
+ `${outside.map(code).join(', ')}. Copy them or change the options.`);
352
+ }
353
+ data.notes.push(...notes.map((n) => `${code(p.name)}: ${n}`));
354
+ data.projects.push({
355
+ name: p.name,
356
+ sourceName: p.source.name,
357
+ kind,
358
+ root,
359
+ why: p.neededBy.length === 0
360
+ ? 'selected'
361
+ : `needed by ${p.neededBy.map((n) => plan.renames.get(n) ?? n).join(', ')}`,
362
+ });
363
+ }
364
+ data.unsupported = plan.all
365
+ .filter((p) => !(0, workspace_source_1.isSupportedKind)(p.kind))
366
+ .map((p) => ({ name: p.name, kind: p.kind, root: p.root || '.' }));
367
+ // tsconfig.base.json: aliases of copied projects, as they were.
368
+ const aliasNames = Object.keys(plan.copiedAliases).sort();
369
+ if (aliasNames.length > 0) {
370
+ if (!tree.exists('tsconfig.base.json'))
371
+ writeJson(tree, 'tsconfig.base.json', { compilerOptions: {} });
372
+ (0, devkit_1.updateJson)(tree, 'tsconfig.base.json', (json) => {
373
+ const co = json.compilerOptions ?? {};
374
+ const paths = { ...(co.paths ?? {}) };
375
+ for (const alias of aliasNames) {
376
+ if (paths[alias] !== undefined)
377
+ continue;
378
+ paths[alias] = plan.copiedAliases[alias];
379
+ data.tsPathsAdded.push(alias);
380
+ }
381
+ json.compilerOptions = { ...co, paths };
382
+ return json;
383
+ });
384
+ }
385
+ if (plan.otherAliases.length > 0) {
386
+ data.notes.push(`Path aliases of projects that were not copied (not added): ${plan.otherAliases
387
+ .map(code)
388
+ .join(', ')}.`);
389
+ }
390
+ const sourceTs = (0, source_1.readSourceJson)(sourceDir, 'tsconfig.base.json');
391
+ const sourceCo = (0, workspace_source_1.objectField)(sourceTs, 'compilerOptions');
392
+ const workspaceCo = (tree.exists('tsconfig.base.json')
393
+ ? (0, devkit_1.readJson)(tree, 'tsconfig.base.json').compilerOptions ?? {}
394
+ : {});
395
+ // Options the workspace base does not set are added, so the copied code compiles as before
396
+ // (allowJs for imported .js files, strict: false, …); options it sets differently are listed.
397
+ const NOT_CARRIED = new Set(['paths', 'baseUrl', 'rootDir', 'outDir']);
398
+ const missing = Object.keys(sourceCo)
399
+ .filter((k) => !NOT_CARRIED.has(k) && workspaceCo[k] === undefined)
400
+ .sort();
401
+ const differing = Object.keys(sourceCo)
402
+ .filter((k) => !NOT_CARRIED.has(k) && workspaceCo[k] !== undefined)
403
+ .filter((k) => JSON.stringify(sourceCo[k]) !== JSON.stringify(workspaceCo[k]))
404
+ .sort();
405
+ const sourceNg = (0, workspace_source_1.objectField)(sourceTs, 'angularCompilerOptions');
406
+ const workspaceNg = (tree.exists('tsconfig.base.json')
407
+ ? (0, devkit_1.readJson)(tree, 'tsconfig.base.json').angularCompilerOptions ?? {}
408
+ : {});
409
+ const missingNg = Object.keys(sourceNg)
410
+ .filter((k) => workspaceNg[k] === undefined)
411
+ .sort();
412
+ if ((missing.length > 0 || missingNg.length > 0) && tree.exists('tsconfig.base.json')) {
413
+ (0, devkit_1.updateJson)(tree, 'tsconfig.base.json', (json) => {
414
+ json.compilerOptions = { ...(json.compilerOptions ?? {}) };
415
+ for (const k of missing)
416
+ json.compilerOptions[k] = sourceCo[k];
417
+ if (missingNg.length > 0) {
418
+ json.angularCompilerOptions = { ...(json.angularCompilerOptions ?? {}) };
419
+ for (const k of missingNg)
420
+ json.angularCompilerOptions[k] = sourceNg[k];
421
+ }
422
+ return json;
423
+ });
424
+ data.notes.push('Added to `tsconfig.base.json` from the source (the workspace did not set them): ' +
425
+ [
426
+ ...missing.map((k) => code(`${k}: ${JSON.stringify(sourceCo[k])}`)),
427
+ ...missingNg.map((k) => code(`angularCompilerOptions.${k}: ${JSON.stringify(sourceNg[k])}`)),
428
+ ].join(', ') +
429
+ '. They apply to every project of the workspace.');
430
+ }
431
+ if (differing.length > 0) {
432
+ data.notes.push('The source `tsconfig.base.json` sets compilerOptions the workspace has with other ' +
433
+ `values: ${differing
434
+ .map((k) => code(`${k}: ${JSON.stringify(sourceCo[k])}`))
435
+ .join(', ')}. ` +
436
+ "The workspace values were kept; set them in the projects' tsconfig files if the code " +
437
+ 'needs them.');
438
+ }
439
+ // package.json: only when npm projects were copied.
440
+ const ionicNames = new Set(ionicApps.map((a) => a.p.name));
441
+ const importedAnywhere = new Set([...nativeImportsOf.values()].flatMap((s) => [...s]));
442
+ const importedByShared = new Set([...nativeImportsOf].filter(([n]) => !ionicNames.has(n)).flatMap(([, set]) => [...set]));
443
+ data.npmProject = plan.projects.some((p) => NPM_KINDS.has(p.source.kind));
444
+ if (data.npmProject) {
445
+ (0, dependencies_2.mergeDependencies)(tree, {
446
+ sourceDir,
447
+ sourcePkg,
448
+ classify: (spec) => classifyWorkspaceSpec(spec, sourceDir, roots),
449
+ copiedLabel: 'copied projects',
450
+ angular: (0, source_1.sourceDependency)(sourcePkg, '@angular/core') !== undefined,
451
+ skip: {
452
+ test: (pkgName) => /^(@nrwl\/|@nx\/|@nxext\/|nx$)/.test(pkgName) ||
453
+ (ionicApps.length > 0 && isNative(pkgName) && !importedAnywhere.has(pkgName)),
454
+ reason: ionicApps.length > 0
455
+ ? "the source's Nx packages (the workspace keeps its own Nx version) and native " +
456
+ "packages no copied code imports (they are in the Ionic apps' own package.json)"
457
+ : "the source's Nx packages; the workspace keeps its own Nx version",
458
+ },
459
+ }, data);
460
+ data.sourceScripts = carryRootPackageFields(tree, sourcePkg, data, scriptContext(plan));
461
+ }
462
+ const nonceNote = (0, csp_nonce_1.noncePatchMains)(tree, mains);
463
+ if (nonceNote)
464
+ data.notes.push(nonceNote);
465
+ // The source's own env encryption: same output from the release build, library runtime module.
466
+ const envEncryption = (0, env_encryption_1.applySourceEnvEncryption)(tree, sourceDir, data.notes, plan.projects.map((p) => p.source.root));
467
+ (0, env_encryption_1.swapEnvSecretModules)(tree, [...plan.projects.map((p) => p.source.root), ...shared.folders.map((f) => f.path)], data.notes, sourceDir);
468
+ noteBuildScripts(buildScripts, data, envEncryption?.applied === true);
469
+ if (shared.usedBaseUrl)
470
+ baseUrlForImports(tree, sourceDir, data);
471
+ // Ionic apps: after every project.json is written and the root merge ran.
472
+ const installApps = [];
473
+ if (ionicApps.length > 0)
474
+ data.ionic = [];
475
+ for (const { p, releases } of ionicApps) {
476
+ const { report, installApp } = (0, shape_1.applyIonicShape)(tree, {
477
+ name: p.name,
478
+ appRoot: p.source.root,
479
+ sourcePkg,
480
+ isNative,
481
+ // Several Ionic apps: each gets the platform packages, what it or the shared code imports,
482
+ // and what no copied code imports.
483
+ forThisApp: ionicApps.length > 1
484
+ ? (n) => packages_1.PLATFORM_PACKAGES.has(n) ||
485
+ (nativeImportsOf.get(p.name)?.has(n) ?? false) ||
486
+ importedByShared.has(n) ||
487
+ !importedAnywhere.has(n)
488
+ : undefined,
489
+ alsoAtRoot: importedAnywhere,
490
+ releaseConfigurations: releases,
491
+ });
492
+ data.ionic?.push(report);
493
+ if (installApp)
494
+ installApps.push(installApp);
495
+ data.nextSteps.push(`\`npx nx run ${p.name}:release:prod\``, `\`npx nx run ${p.name}:cap-sync --platform=android\``);
496
+ }
497
+ const nx = (0, dependencies_1.nxVersion)(tree);
498
+ (0, dependencies_1.addMissingDependencies)(tree, {}, Object.fromEntries([...pluginPackages].sort().map((pkg) => [pkg, nx])));
499
+ if (usesNgPackagr) {
500
+ (0, dependencies_1.addMissingDependencies)(tree, {}, (0, angular_deps_1.ngPackagrDependencies)((0, dependencies_1.declaredVersion)(tree, '@angular/core')));
501
+ }
502
+ addNamedInputs(tree, sourceDir, usedInputs, data);
503
+ if (usesJest) {
504
+ const sourceJest = (0, source_1.sourceDependency)(sourcePkg, 'jest');
505
+ const jestMajor = sourceJest ? (0, dependencies_1.majorOf)(sourceJest) : undefined;
506
+ if (jestMajor !== undefined && jestMajor < 29) {
507
+ data.notes.push(`The source used Jest ${sourceJest}; the workspace's \`@nx/jest\` ${(0, dependencies_1.nxVersion)(tree)} ` +
508
+ 'needs Jest 29. Update `jest`, `jest-environment-jsdom`, `ts-jest` and `@types/jest` to ' +
509
+ '29, and `jest-preset-angular` to 13 (Angular 15), before running the tests.');
510
+ }
511
+ for (const file of ['jest.preset.js', 'jest.config.ts']) {
512
+ if (tree.exists(file))
513
+ continue;
514
+ const text = (0, source_1.readSourceText)(sourceDir, file);
515
+ if (text === undefined || (file === 'jest.config.ts' && !text.includes('getJestProjects'))) {
516
+ continue;
517
+ }
518
+ tree.write(file, text.replace(/@nrwl\/jest/g, '@nx/jest'));
519
+ data.notes.push(`Copied ${code(file)} from the source (the copied projects' Jest configs use it).`);
520
+ }
521
+ }
522
+ const rootEslint = (0, source_1.readSourceJson)(sourceDir, '.eslintrc.json');
523
+ const constraints = rootEslint ? (0, rewrite_1.depConstraints)(rootEslint) : [];
524
+ if (constraints.length > 0) {
525
+ data.notes.push("The source's root ESLint config was not copied. Its module-boundary rules " +
526
+ `(\`depConstraints\`) were: ${constraints.map(code).join(', ')}. Add the ones you want ` +
527
+ 'to the workspace `.eslintrc.json`.');
528
+ }
529
+ const sourceNx = (0, workspace_source_1.sourceNxVersion)(sourceDir);
530
+ const workspaceNx = (0, dependencies_1.declaredVersion)(tree, 'nx');
531
+ if (sourceNx && workspaceNx && (0, dependencies_1.majorOf)(sourceNx) !== (0, dependencies_1.majorOf)(workspaceNx)) {
532
+ data.notes.push(`The source used Nx ${sourceNx}; the workspace has Nx ${workspaceNx}. \`@nrwl/*\` ` +
533
+ 'executors were renamed to `@nx/*`; check each target with `npx nx show project <name>`.');
534
+ }
535
+ data.nextSteps.push('`pstack env --name=<env>` adds an environment to every app; migrated Angular apps keep ' +
536
+ 'their own environment files and fileReplacements');
537
+ // Everything this run added (source dependencies, @nx plugins, build packages), sorted.
538
+ data.dependenciesAdded = [...(0, dependencies_2.packageNames)(tree)].filter((n) => !namesBefore.has(n)).sort();
539
+ const rootInstall = dependencyFields(tree) !== depsBefore ? () => (0, devkit_1.installPackagesTask)(tree) : undefined;
540
+ data.installTask =
541
+ rootInstall || installApps.length > 0
542
+ ? async () => {
543
+ if (rootInstall)
544
+ rootInstall();
545
+ for (const install of installApps)
546
+ await install();
547
+ }
548
+ : undefined;
549
+ return data;
550
+ }
551
+ /** A named input reference: not a file set ({…}), negation, path or dependency object. */
552
+ function inputName(entry) {
553
+ if (typeof entry !== 'string')
554
+ return undefined;
555
+ const name = entry.replace(/^\^/, '');
556
+ return /^[A-Za-z0-9_-]+$/.test(name) ? name : undefined;
557
+ }
558
+ /** Named inputs referenced by the targets' `inputs`. */
559
+ function namedInputsOf(targets) {
560
+ const out = [];
561
+ for (const target of Object.values(targets)) {
562
+ const inputs = (0, workspace_source_1.isObject)(target) ? target['inputs'] : undefined;
563
+ if (!Array.isArray(inputs))
564
+ continue;
565
+ for (const entry of inputs) {
566
+ const name = inputName(entry);
567
+ if (name)
568
+ out.push(name);
569
+ }
570
+ }
571
+ return out;
572
+ }
573
+ /**
574
+ * Named inputs the copied targets use but the workspace nx.json lacks: copied from the source
575
+ * nx.json (with the ones they refer to), the rest listed.
576
+ */
577
+ function addNamedInputs(tree, sourceDir, used, data) {
578
+ if (used.size === 0)
579
+ return;
580
+ const workspaceNx = tree.exists('nx.json') ? (0, devkit_1.readJson)(tree, 'nx.json') : {};
581
+ const workspaceNamed = ((0, workspace_source_1.isObject)(workspaceNx.namedInputs) ? workspaceNx.namedInputs : {});
582
+ const sourceNx = (0, source_1.readSourceJson)(sourceDir, 'nx.json');
583
+ const sourceNamed = (0, workspace_source_1.objectField)(sourceNx, 'namedInputs');
584
+ const added = {};
585
+ const unknown = new Set();
586
+ const queue = [...used];
587
+ for (let name = queue.shift(); name !== undefined; name = queue.shift()) {
588
+ if (workspaceNamed[name] !== undefined || added[name] !== undefined || unknown.has(name)) {
589
+ continue;
590
+ }
591
+ const definition = sourceNamed[name];
592
+ if (definition === undefined) {
593
+ unknown.add(name);
594
+ continue;
595
+ }
596
+ added[name] = definition;
597
+ if (Array.isArray(definition)) {
598
+ for (const entry of definition) {
599
+ const ref = inputName(entry);
600
+ if (ref)
601
+ queue.push(ref);
602
+ }
603
+ }
604
+ }
605
+ const addedNames = Object.keys(added).sort();
606
+ if (addedNames.length > 0) {
607
+ if (!tree.exists('nx.json'))
608
+ writeJson(tree, 'nx.json', {});
609
+ (0, devkit_1.updateJson)(tree, 'nx.json', (json) => {
610
+ json.namedInputs = { ...(json.namedInputs ?? {}), ...added };
611
+ return json;
612
+ });
613
+ data.notes.push(`Added named inputs to \`nx.json\`: ${addedNames.map(code).join(', ')} (from the source, ` +
614
+ 'used by the copied targets).');
615
+ }
616
+ if (unknown.size > 0) {
617
+ data.notes.push('The copied targets use named inputs that neither `nx.json` defines: ' +
618
+ `${[...unknown].sort().map(code).join(', ')}. Define them under \`namedInputs\` in ` +
619
+ '`nx.json`, or remove them from the targets.');
620
+ }
621
+ }
622
+ exports.nxWorkspaceAdapter = {
623
+ kind: 'workspace',
624
+ id: 'nx-workspace',
625
+ label: 'Nx workspace (Angular, Ionic and Flutter projects)',
626
+ detect: detect_1.detectNxWorkspace,
627
+ defaultName(sourceDir) {
628
+ const name = (0, source_1.readSourcePackageJson)(sourceDir)?.name;
629
+ return name ? name.replace(/^@[^/]+\//, '') : path.basename(sourceDir);
630
+ },
631
+ preflight(tree, ctx) {
632
+ planNxImport(tree, ctx);
633
+ },
634
+ migrate: migrateNxWorkspace,
635
+ };
636
+ // ── Shared folders, release targets and root package.json (multi-app sources) ──────────────────
637
+ const SHARED_SKIP = { anyDepth: ['node_modules', '.git'], topLevel: [] };
638
+ function findSharedFolders(ctx, plan, scripts) {
639
+ const { sourceDir } = ctx;
640
+ const sourceTs = (0, source_1.readSourceJson)(sourceDir, 'tsconfig.base.json');
641
+ const baseUrl = (0, workspace_source_1.objectField)(sourceTs, 'compilerOptions')['baseUrl'];
642
+ const baseUrlRoot = baseUrl === '.' || baseUrl === './';
643
+ const finder = new shared_folders_1.SharedFolderFinder({
644
+ sourceDir,
645
+ projectRoots: plan.all.map((p) => p.root),
646
+ selectedRoots: plan.projects.map((p) => p.source.root),
647
+ });
648
+ const scanCode = (root) => {
649
+ for (const file of (0, workspace_source_1.listProjectFiles)(sourceDir, root)) {
650
+ if (!(CODE_FILE.test(file) || STYLE_FILE.test(file)) || file.endsWith('.d.ts'))
651
+ continue;
652
+ const full = root ? `${root}/${file}` : file;
653
+ const text = (0, source_1.readSourceText)(sourceDir, full);
654
+ if (text !== undefined)
655
+ finder.addCode(full, text, baseUrlRoot);
656
+ }
657
+ };
658
+ for (const p of plan.projects) {
659
+ finder.addProjectConfig(p.source.name, p.source.config);
660
+ scanCode(p.source.root);
661
+ }
662
+ finder.addTsconfig(sourceTs);
663
+ finder.addScripts(scripts);
664
+ // Shared folders may import further ones (an env file importing a config folder).
665
+ const scanned = new Set();
666
+ for (let round = 0; round < 3; round++) {
667
+ const next = finder.folders().filter((f) => !scanned.has(f.path));
668
+ if (next.length === 0)
669
+ break;
670
+ for (const f of next) {
671
+ scanned.add(f.path);
672
+ scanCode(f.path);
673
+ }
674
+ }
675
+ return {
676
+ folders: finder.folders(),
677
+ rootFiles: finder.rootFiles(),
678
+ usedBaseUrl: finder.usedBaseUrl,
679
+ unselected: finder.unselectedReferences(),
680
+ };
681
+ }
682
+ const STYLE_FILE = /\.(scss|sass|css|less)$/;
683
+ function copySharedFolders(tree, ctx, finding, data) {
684
+ copyRootFiles(tree, ctx, finding.rootFiles, data);
685
+ // Code imports into those projects are reported by the import rewriting; options are not.
686
+ const unselected = finding.unselected
687
+ .map(([root, why]) => [
688
+ root,
689
+ why.filter((w) => !w.startsWith('imported by')),
690
+ ])
691
+ .filter(([, why]) => why.length > 0);
692
+ if (unselected.length > 0) {
693
+ data.notes.push(`Options of the copied projects reach into projects that were not selected: ${unselected
694
+ .map(([root, why]) => `${code(root)} (${why.slice(0, 2).join('; ')})`)
695
+ .join(', ')}. Add them with \`--projects\` or change those paths.`);
696
+ }
697
+ const folders = finding.folders;
698
+ if (folders.length === 0)
699
+ return;
700
+ const maxFiles = ctx.maxFiles ?? copy_1.DEFAULT_MAX_FILES;
701
+ const lines = [];
702
+ const kept = [];
703
+ for (const f of folders) {
704
+ let copy;
705
+ try {
706
+ copy = (0, copy_1.copyIntoTree)(tree, path.join(ctx.sourceDir, ...f.path.split('/')), f.path, SHARED_SKIP, {
707
+ ignoreFrom: ctx.sourceDir,
708
+ maxFiles: maxFiles - data.copied,
709
+ keepExisting: true,
710
+ });
711
+ }
712
+ catch (err) {
713
+ if (err instanceof Error && err.message.startsWith(TOO_MANY)) {
714
+ throw new Error(`migrate: the selected projects and the folders they use have more than ${maxFiles} ` +
715
+ 'files to copy after the skip lists. Narrow --projects, clean up the source, or raise ' +
716
+ '--max-files.');
717
+ }
718
+ throw err;
719
+ }
720
+ (0, types_1.recordCopy)(data, copy, f.path);
721
+ kept.push(...(copy.existing ?? []).map((e) => `${f.path}/${e}`));
722
+ const why = f.reasons.slice(0, 3).join('; ') + (f.reasons.length > 3 ? '; …' : '');
723
+ lines.push(`${code(f.path)} (${copy.copied.length} file${copy.copied.length === 1 ? '' : 's'}; ${why})`);
724
+ }
725
+ data.notes.push(`Copied folders the projects use that are not Nx projects, at the same paths: ${lines.join(', ')}.`);
726
+ if (kept.length > 0) {
727
+ data.notes.push(`Files the workspace already had were kept, not overwritten: ${kept
728
+ .slice(0, 10)
729
+ .map(code)
730
+ .join(', ')}${kept.length > 10 ? ` and ${kept.length - 10} more` : ''}. Compare them ` +
731
+ 'with the source.');
732
+ }
733
+ }
734
+ /** Root files that options or npm scripts use (not secrets, not already in the workspace). */
735
+ function copyRootFiles(tree, ctx, files, data) {
736
+ const copied = [];
737
+ const existing = [];
738
+ for (const f of files) {
739
+ if ((0, copy_1.isPossibleSecret)(f.path)) {
740
+ if (!data.secrets.includes(f.path))
741
+ data.secrets.push(f.path);
742
+ continue;
743
+ }
744
+ if (tree.exists(f.path)) {
745
+ existing.push(f.path);
746
+ continue;
747
+ }
748
+ const abs = path.join(ctx.sourceDir, f.path);
749
+ tree.write(f.path, fs.readFileSync(abs), { mode: fs.statSync(abs).mode & 0o777 });
750
+ data.copied += 1;
751
+ copied.push(`${code(f.path)} (${f.reasons.slice(0, 2).join('; ')})`);
752
+ }
753
+ if (copied.length > 0) {
754
+ data.notes.push(`Copied root files the projects or npm scripts use: ${copied.join(', ')}.`);
755
+ }
756
+ if (existing.length > 0) {
757
+ data.notes.push(`Root files the workspace already had were kept: ${existing.map(code).join(', ')}. ` +
758
+ 'Compare them with the source.');
759
+ }
760
+ }
761
+ const mainOf = (targets) => {
762
+ const main = (0, workspace_source_1.objectField)(targets, 'build')['options']?.['main'];
763
+ return typeof main === 'string' ? main : undefined;
764
+ };
765
+ /**
766
+ * The release target of a migrated app: the env folder its fileReplacements use
767
+ * (environments/<x>/…), and base hrefs from the source's build scripts.
768
+ */
769
+ function shapeReleaseTarget(targets, p, scripts, notes) {
770
+ const release = targets['release'];
771
+ if (!(0, workspace_source_1.isObject)(release) || !(0, workspace_source_1.isObject)(release['options']))
772
+ return;
773
+ const options = release['options'];
774
+ const envProject = envFolderOf((0, workspace_source_1.objectField)(targets, 'build'));
775
+ if (envProject && envProject !== options['envProject'])
776
+ options['envProject'] = envProject;
777
+ const hrefs = scripts.baseHrefs.get(p.source.name);
778
+ if (!hrefs)
779
+ return;
780
+ const configurations = (0, workspace_source_1.isObject)(release['configurations'])
781
+ ? release['configurations']
782
+ : {};
783
+ const applied = [];
784
+ for (const [name, config] of Object.entries(configurations)) {
785
+ const href = hrefs[name] ?? hrefs['*'];
786
+ if (!href || href === '/' || !(0, workspace_source_1.isObject)(config))
787
+ continue;
788
+ config['baseHref'] = href;
789
+ applied.push(`${name}: ${href}`);
790
+ }
791
+ if (applied.length > 0) {
792
+ notes.push(`release target base hrefs from the source build scripts: ${applied.join(', ')}`);
793
+ }
794
+ }
795
+ /** "environments/<x>/environment.prod.ts" in the build's fileReplacements → "<x>". */
796
+ function envFolderOf(build) {
797
+ const sets = [build['options'], ...Object.values((0, workspace_source_1.objectField)(build, 'configurations'))];
798
+ for (const set of sets) {
799
+ const replacements = (0, workspace_source_1.isObject)(set) ? set['fileReplacements'] : undefined;
800
+ if (!Array.isArray(replacements))
801
+ continue;
802
+ for (const r of replacements) {
803
+ const w = (0, workspace_source_1.isObject)(r) ? r['with'] ?? r['replaceWith'] : undefined;
804
+ const m = typeof w === 'string' ? /^(?:\.\/)?environments\/([^/]+)\/[^/]+$/.exec(w) : null;
805
+ if (m)
806
+ return m[1];
807
+ }
808
+ }
809
+ return undefined;
810
+ }
811
+ const scriptContext = (plan) => ({
812
+ renames: plan.renames,
813
+ all: new Set(plan.all.map((p) => p.name)),
814
+ });
815
+ /** Project names a script command refers to, with where each one is (for renaming). */
816
+ const SCRIPT_PROJECT_REFS = [
817
+ // nx/ng <verb> <project> (not run, run-many, affected, graph, …)
818
+ /\b(?:nx|ng)\s+(?!run\b|run-many\b|affected\b|graph\b|g\b|generate\b|migrate\b|reset\b|show\b)[\w:-]+\s+(?!-)([\w.-]+)/g,
819
+ // nx run <project>:<target>
820
+ /\bnx\s+run\s+([\w.-]+):/g,
821
+ // --project=<p>, --projects=<a,b>, --app=<p>
822
+ /--(?:projects?|app)[=\s]+(['"]?)([\w.,-]+)\1/g,
823
+ ];
824
+ /**
825
+ * The script with project names renamed, or why it is not carried (a project not imported).
826
+ * `--project=`/`--app=` are renamed only in nx/ng commands: a custom script (`node build.js
827
+ * --project=web`) looks the name up itself (base-href maps, env folders), so it keeps the source
828
+ * name and is listed in `sourceNames`.
829
+ */
830
+ function rewriteScript(command, ctx) {
831
+ const missing = new Set();
832
+ const sourceNames = new Set();
833
+ const rename = (name) => {
834
+ if (!ctx.all.has(name))
835
+ return name;
836
+ const to = ctx.renames.get(name);
837
+ if (to === undefined)
838
+ missing.add(name);
839
+ return to ?? name;
840
+ };
841
+ const segments = command.split(/(&&|\|\||;|\|)/);
842
+ const out = segments
843
+ .map((seg) => {
844
+ if (/^(&&|\|\||;|\|)$/.test(seg))
845
+ return seg;
846
+ let s = seg.replace(SCRIPT_PROJECT_REFS[0], (m, name) => m.slice(0, m.length - name.length) + rename(name));
847
+ s = s.replace(SCRIPT_PROJECT_REFS[1], (m, name) => m.replace(name, rename(name)));
848
+ const nxCommand = /^\s*(?:npx\s+)?(?:nx|ng)\s/.test(s);
849
+ s = s.replace(SCRIPT_PROJECT_REFS[2], (m, _q, list) => {
850
+ const names = list.split(',');
851
+ if (nxCommand)
852
+ return m.replace(list, names.map(rename).join(','));
853
+ for (const n of names) {
854
+ const to = rename(n);
855
+ if (to !== n)
856
+ sourceNames.add(n);
857
+ }
858
+ return m;
859
+ });
860
+ return s;
861
+ })
862
+ .join('');
863
+ return missing.size > 0
864
+ ? { missing: [...missing].sort() }
865
+ : { command: out, sourceNames: [...sourceNames].sort() };
866
+ }
867
+ exports.rewriteScript = rewriteScript;
868
+ function carryRootPackageFields(tree, sourcePkg, data, scriptCtx) {
869
+ if (!sourcePkg)
870
+ return {};
871
+ const added = [];
872
+ const clashes = [];
873
+ const notCarried = {};
874
+ const keptScripts = [];
875
+ const renamedScripts = [];
876
+ const lifecycle = [];
877
+ const forMissing = [];
878
+ const sourceNamed = [];
879
+ const nodeMajor = (0, node_engine_1.workspaceNodeMajor)(tree);
880
+ let nodeKept;
881
+ (0, devkit_1.updateJson)(tree, 'package.json', (json) => {
882
+ for (const field of ['overrides', 'engines', 'browser']) {
883
+ const from = sourcePkg[field];
884
+ if (from === undefined)
885
+ continue;
886
+ if ((0, workspace_source_1.isObject)(from)) {
887
+ const into = (0, workspace_source_1.isObject)(json[field]) ? json[field] : {};
888
+ for (const [k, v] of Object.entries(from)) {
889
+ // A Node range the workspace's own Node (.nvmrc) is outside of would stop npm install
890
+ // (engine-strict) or the workspace tooling, so it is reported instead.
891
+ const allows = field === 'engines' && k === 'node' && nodeMajor !== undefined && into[k] === undefined
892
+ ? (0, node_engine_1.nodeRangeAllowsMajor)(String(v), nodeMajor)
893
+ : true;
894
+ if (allows !== true) {
895
+ nodeKept = { range: String(v), unreadable: allows === undefined };
896
+ continue;
897
+ }
898
+ if (into[k] === undefined) {
899
+ into[k] = v;
900
+ added.push(`${field}.${k}`);
901
+ }
902
+ else if (JSON.stringify(into[k]) !== JSON.stringify(v)) {
903
+ clashes.push(`${field}.${k}`);
904
+ }
905
+ }
906
+ json[field] = into;
907
+ }
908
+ else if (json[field] === undefined) {
909
+ json[field] = from;
910
+ added.push(field);
911
+ }
912
+ else if (JSON.stringify(json[field]) !== JSON.stringify(from)) {
913
+ clashes.push(field);
914
+ }
915
+ }
916
+ const scripts = (0, workspace_source_1.isObject)(json.scripts) ? json.scripts : {};
917
+ for (const [k, v] of Object.entries((0, workspace_source_1.isObject)(sourcePkg['scripts']) ? sourcePkg['scripts'] : {})) {
918
+ if (shared_folders_1.LIFECYCLE_SCRIPTS.has(k)) {
919
+ if (scripts[k] !== v)
920
+ lifecycle.push(k);
921
+ continue;
922
+ }
923
+ const rewritten = typeof v === 'string' ? rewriteScript(v, scriptCtx) : { command: v, sourceNames: [] };
924
+ if ('missing' in rewritten) {
925
+ forMissing.push(`${code(k)} (${rewritten.missing.map(code).join(', ')})`);
926
+ continue;
927
+ }
928
+ if (scripts[k] === undefined) {
929
+ scripts[k] = rewritten.command;
930
+ keptScripts.push(k);
931
+ if (rewritten.command !== v)
932
+ renamedScripts.push(k);
933
+ for (const n of rewritten.sourceNames) {
934
+ sourceNamed.push(`${code(k)} (\`${n}\` → \`${scriptCtx.renames.get(n)}\`)`);
935
+ }
936
+ }
937
+ else if (scripts[k] !== rewritten.command) {
938
+ notCarried[k] = v;
939
+ }
940
+ }
941
+ json.scripts = scripts;
942
+ return json;
943
+ });
944
+ const lockfile = ['pnpm-lock.yaml', 'yarn.lock'].find((f) => tree.exists(f));
945
+ if (lockfile && added.some((a) => a.startsWith('overrides.'))) {
946
+ data.notes.push(`The workspace uses ${lockfile === 'yarn.lock' ? 'Yarn' : 'pnpm'} (\`${lockfile}\`), which ` +
947
+ `ignores npm \`overrides\`: move them to \`${lockfile === 'yarn.lock' ? 'resolutions' : 'pnpm.overrides'}\`.`);
948
+ }
949
+ // Carried, so no longer listed under "Other package.json fields".
950
+ data.packageFields = data.packageFields.filter((f) => f.field !== 'overrides');
951
+ if (added.length > 0) {
952
+ data.notes.push(`Carried from the source root \`package.json\`: ${added.map(code).join(', ')} (dependency ` +
953
+ 'overrides, browser field and engines the install and build rely on).');
954
+ }
955
+ if (nodeKept !== undefined) {
956
+ data.notes.push(nodeKept.unreadable
957
+ ? `The source root \`package.json\` sets \`engines.node\` to ${code(nodeKept.range)}, which could not be checked against the workspace's Node ${nodeMajor} ` +
958
+ '(`.nvmrc`); it was not carried over (npm installs with `engine-strict`). Add it by ' +
959
+ `hand if it allows Node ${nodeMajor}.`
960
+ : `The source root \`package.json\` sets \`engines.node\` to ${code(nodeKept.range)}; it was not carried over because the workspace runs Node ${nodeMajor} ` +
961
+ '(`.nvmrc`), which its tooling needs. Check that the migrated apps build on that Node.');
962
+ }
963
+ if (clashes.length > 0) {
964
+ data.notes.push(`The source root \`package.json\` sets ${clashes.map(code).join(', ')} differently from ` +
965
+ 'the workspace; the workspace values were kept. Compare them.');
966
+ }
967
+ if (lifecycle.length > 0) {
968
+ data.notes.push(`npm lifecycle scripts of the source were not carried over (they run on every install): ` +
969
+ `${lifecycle
970
+ .sort()
971
+ .map((k) => `${code(k)}: ${code(String(sourcePkg['scripts'][k]))}`)
972
+ .join(', ')}. Add what the workspace still needs by hand.`);
973
+ }
974
+ if (forMissing.length > 0) {
975
+ data.notes.push(`npm scripts for projects that were not imported were not carried over: ${forMissing.join(', ')}.`);
976
+ }
977
+ if (sourceNamed.length > 0) {
978
+ data.notes.push(`These kept npm scripts pass the source project name to a custom script, which looks it ` +
979
+ `up itself (base hrefs, env folders): ${sourceNamed.join(', ')}. The Nx project has the ` +
980
+ 'new name: update the `nx build`/`nx run` calls inside the script.');
981
+ }
982
+ if (renamedScripts.length > 0) {
983
+ data.notes.push(`Project names were renamed (\`--prefix\`) in the kept npm scripts ${renamedScripts
984
+ .sort()
985
+ .map(code)
986
+ .join(', ')}. Scripts they run (e.g. a custom build script) may still use the old names ` +
987
+ 'inside; update them by hand.');
988
+ }
989
+ if (keptScripts.length > 0) {
990
+ data.notes.push(`Source npm scripts kept in the workspace \`package.json\`: ${keptScripts
991
+ .sort()
992
+ .slice(0, 12)
993
+ .map(code)
994
+ .join(', ')}${keptScripts.length > 12 ? ` and ${keptScripts.length - 12} more` : ''}.`);
995
+ }
996
+ return notCarried;
997
+ }
998
+ function noteBuildScripts(info, data, envEncryptionApplied = false) {
999
+ const names = Object.keys(info.customBuilds).sort();
1000
+ if (names.length === 0)
1001
+ return;
1002
+ data.notes.push(`The source builds its apps through ${info.customScripts.map(code).join(', ')} ` +
1003
+ `(npm scripts ${names.slice(0, 6).map(code).join(', ')}${names.length > 6 ? ` and ${names.length - 6} more` : ''}). Those scripts ` +
1004
+ 'were kept and stay the way to build these apps for now: the polystack `release` target ' +
1005
+ 'was added alongside (`npx nx run <app>:release:<env>`), but it does not run their extra ' +
1006
+ (envEncryptionApplied
1007
+ ? 'steps (obfuscation, comment stripping, …); env encryption is set up to match theirs, ' +
1008
+ 'and the stamp fields when they set them (see the env encryption note). '
1009
+ : 'steps (env encryption as they do it, stamping, obfuscation, …). ') +
1010
+ 'Npm scripts of the same name keep the source command.');
1011
+ if (info.unread.length > 0) {
1012
+ data.notes.push(`Base hrefs for ${info.unread.map(code).join(', ')} could not be read from the build ` +
1013
+ "scripts; set `baseHref` on their release target's configurations.");
1014
+ }
1015
+ }
1016
+ /** Non-relative imports through `baseUrl: "."` (e.g. `environments/x/y`) need it in the workspace. */
1017
+ function baseUrlForImports(tree, sourceDir, data) {
1018
+ const sourceCo = (0, workspace_source_1.objectField)((0, source_1.readSourceJson)(sourceDir, 'tsconfig.base.json'), 'compilerOptions');
1019
+ const baseUrl = sourceCo['baseUrl'];
1020
+ if (typeof baseUrl !== 'string' || !tree.exists('tsconfig.base.json'))
1021
+ return;
1022
+ const ws = (0, devkit_1.readJson)(tree, 'tsconfig.base.json');
1023
+ const wsBase = ws?.compilerOptions?.baseUrl;
1024
+ if (wsBase === undefined) {
1025
+ (0, devkit_1.updateJson)(tree, 'tsconfig.base.json', (json) => {
1026
+ json.compilerOptions = { ...(json.compilerOptions ?? {}), baseUrl };
1027
+ return json;
1028
+ });
1029
+ data.notes.push(`Set \`baseUrl: "${baseUrl}"\` in \`tsconfig.base.json\` as the source had it; imports ` +
1030
+ 'such as `environments/<app>/…` resolve through it.');
1031
+ }
1032
+ else if (path.posix.normalize(wsBase) !== path.posix.normalize(baseUrl)) {
1033
+ data.notes.push(`The source \`tsconfig.base.json\` has \`baseUrl: "${baseUrl}"\`, the workspace ` +
1034
+ `\`"${wsBase}"\`. Imports that go through the source baseUrl may not resolve.`);
1035
+ }
1036
+ }
1037
+ //# sourceMappingURL=nx-workspace.js.map