@nx/workspace 16.0.0-beta.1

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 (341) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +22 -0
  3. package/README.md +61 -0
  4. package/executors.json +11 -0
  5. package/generators.d.ts +5 -0
  6. package/generators.js +14 -0
  7. package/generators.js.map +1 -0
  8. package/generators.json +92 -0
  9. package/index.d.ts +21 -0
  10. package/index.js +52 -0
  11. package/index.js.map +1 -0
  12. package/migrations.json +165 -0
  13. package/package.json +90 -0
  14. package/presets/core.json +11 -0
  15. package/presets/npm.json +7 -0
  16. package/src/core/file-utils.d.ts +1 -0
  17. package/src/core/file-utils.js +5 -0
  18. package/src/core/file-utils.js.map +1 -0
  19. package/src/core/project-graph.d.ts +1 -0
  20. package/src/core/project-graph.js +5 -0
  21. package/src/core/project-graph.js.map +1 -0
  22. package/src/executors/counter/counter.impl.d.ts +12 -0
  23. package/src/executors/counter/counter.impl.js +48 -0
  24. package/src/executors/counter/counter.impl.js.map +1 -0
  25. package/src/executors/counter/schema.json +20 -0
  26. package/src/generators/ci-workflow/ci-workflow.d.ts +6 -0
  27. package/src/generators/ci-workflow/ci-workflow.js +46 -0
  28. package/src/generators/ci-workflow/ci-workflow.js.map +1 -0
  29. package/src/generators/ci-workflow/files/azure/azure-pipelines.yml__tmpl__ +58 -0
  30. package/src/generators/ci-workflow/files/bitbucket-pipelines/bitbucket-pipelines.yml__tmpl__ +36 -0
  31. package/src/generators/ci-workflow/files/circleci/.circleci/config.yml__tmpl__ +73 -0
  32. package/src/generators/ci-workflow/files/github/.github/workflows/__workflowFileName__.yml__tmpl__ +29 -0
  33. package/src/generators/ci-workflow/files/gitlab/.gitlab-ci.yml__tmpl__ +47 -0
  34. package/src/generators/ci-workflow/schema.json +38 -0
  35. package/src/generators/convert-to-nx-project/convert-to-nx-project.d.ts +6 -0
  36. package/src/generators/convert-to-nx-project/convert-to-nx-project.js +86 -0
  37. package/src/generators/convert-to-nx-project/convert-to-nx-project.js.map +1 -0
  38. package/src/generators/convert-to-nx-project/schema.d.ts +7 -0
  39. package/src/generators/convert-to-nx-project/schema.json +38 -0
  40. package/src/generators/move/lib/check-destination.d.ts +11 -0
  41. package/src/generators/move/lib/check-destination.js +24 -0
  42. package/src/generators/move/lib/check-destination.js.map +1 -0
  43. package/src/generators/move/lib/create-project-configuration-in-new-destination.d.ts +3 -0
  44. package/src/generators/move/lib/create-project-configuration-in-new-destination.js +17 -0
  45. package/src/generators/move/lib/create-project-configuration-in-new-destination.js.map +1 -0
  46. package/src/generators/move/lib/move-project-files.d.ts +8 -0
  47. package/src/generators/move/lib/move-project-files.js +22 -0
  48. package/src/generators/move/lib/move-project-files.js.map +1 -0
  49. package/src/generators/move/lib/normalize-schema.d.ts +3 -0
  50. package/src/generators/move/lib/normalize-schema.js +17 -0
  51. package/src/generators/move/lib/normalize-schema.js.map +1 -0
  52. package/src/generators/move/lib/update-build-targets.d.ts +6 -0
  53. package/src/generators/move/lib/update-build-targets.js +54 -0
  54. package/src/generators/move/lib/update-build-targets.js.map +1 -0
  55. package/src/generators/move/lib/update-cypress-config.d.ts +10 -0
  56. package/src/generators/move/lib/update-cypress-config.js +39 -0
  57. package/src/generators/move/lib/update-cypress-config.js.map +1 -0
  58. package/src/generators/move/lib/update-default-project.d.ts +10 -0
  59. package/src/generators/move/lib/update-default-project.js +21 -0
  60. package/src/generators/move/lib/update-default-project.js.map +1 -0
  61. package/src/generators/move/lib/update-eslintrc-json.d.ts +8 -0
  62. package/src/generators/move/lib/update-eslintrc-json.js +44 -0
  63. package/src/generators/move/lib/update-eslintrc-json.js.map +1 -0
  64. package/src/generators/move/lib/update-implicit-dependencies.d.ts +6 -0
  65. package/src/generators/move/lib/update-implicit-dependencies.js +20 -0
  66. package/src/generators/move/lib/update-implicit-dependencies.js.map +1 -0
  67. package/src/generators/move/lib/update-imports.d.ts +8 -0
  68. package/src/generators/move/lib/update-imports.js +159 -0
  69. package/src/generators/move/lib/update-imports.js.map +1 -0
  70. package/src/generators/move/lib/update-jest-config.d.ts +10 -0
  71. package/src/generators/move/lib/update-jest-config.js +36 -0
  72. package/src/generators/move/lib/update-jest-config.js.map +1 -0
  73. package/src/generators/move/lib/update-package-json.d.ts +8 -0
  74. package/src/generators/move/lib/update-package-json.js +22 -0
  75. package/src/generators/move/lib/update-package-json.js.map +1 -0
  76. package/src/generators/move/lib/update-project-root-files.d.ts +10 -0
  77. package/src/generators/move/lib/update-project-root-files.js +44 -0
  78. package/src/generators/move/lib/update-project-root-files.js.map +1 -0
  79. package/src/generators/move/lib/update-readme.d.ts +8 -0
  80. package/src/generators/move/lib/update-readme.js +22 -0
  81. package/src/generators/move/lib/update-readme.js.map +1 -0
  82. package/src/generators/move/lib/update-storybook-config.d.ts +10 -0
  83. package/src/generators/move/lib/update-storybook-config.js +44 -0
  84. package/src/generators/move/lib/update-storybook-config.js.map +1 -0
  85. package/src/generators/move/lib/utils.d.ts +22 -0
  86. package/src/generators/move/lib/utils.js +43 -0
  87. package/src/generators/move/lib/utils.js.map +1 -0
  88. package/src/generators/move/move.d.ts +5 -0
  89. package/src/generators/move/move.js +48 -0
  90. package/src/generators/move/move.js.map +1 -0
  91. package/src/generators/move/schema.d.ts +13 -0
  92. package/src/generators/move/schema.json +47 -0
  93. package/src/generators/new/files-integrated-repo/__dot__editorconfig +13 -0
  94. package/src/generators/new/files-integrated-repo/__dot__gitignore +39 -0
  95. package/src/generators/new/files-integrated-repo/__dot__vscode/extensions.json__tmpl__ +9 -0
  96. package/src/generators/new/files-integrated-repo/package.json__tmpl__ +14 -0
  97. package/src/generators/new/files-integrated-repo/tools/generators/.gitkeep +0 -0
  98. package/src/generators/new/files-integrated-repo/tools/tsconfig.tools.json +12 -0
  99. package/src/generators/new/files-package-based-repo/__dot__gitignore +39 -0
  100. package/src/generators/new/files-package-based-repo/__dot__vscode/extensions.json__tmpl__ +8 -0
  101. package/src/generators/new/files-package-based-repo/package.json__tmpl__ +13 -0
  102. package/src/generators/new/files-readme/README.md.template +21 -0
  103. package/src/generators/new/files-root-app/__dot__gitignore +39 -0
  104. package/src/generators/new/files-root-app/__dot__vscode/extensions.json__tmpl__ +6 -0
  105. package/src/generators/new/files-root-app/package.json__tmpl__ +14 -0
  106. package/src/generators/new/generate-preset.d.ts +4 -0
  107. package/src/generators/new/generate-preset.js +129 -0
  108. package/src/generators/new/generate-preset.js.map +1 -0
  109. package/src/generators/new/generate-workspace-files.d.ts +3 -0
  110. package/src/generators/new/generate-workspace-files.js +169 -0
  111. package/src/generators/new/generate-workspace-files.js.map +1 -0
  112. package/src/generators/new/new.d.ts +26 -0
  113. package/src/generators/new/new.js +73 -0
  114. package/src/generators/new/new.js.map +1 -0
  115. package/src/generators/new/schema.json +77 -0
  116. package/src/generators/npm-package/files/index.js.template +1 -0
  117. package/src/generators/npm-package/npm-package.d.ts +6 -0
  118. package/src/generators/npm-package/npm-package.js +42 -0
  119. package/src/generators/npm-package/npm-package.js.map +1 -0
  120. package/src/generators/npm-package/schema.json +21 -0
  121. package/src/generators/preset/files/angular/app.module.d.ts +0 -0
  122. package/src/generators/preset/files/angular/app.module.js +1 -0
  123. package/src/generators/preset/files/angular/app.module.js.map +1 -0
  124. package/src/generators/preset/files/angular/app.module.ts +0 -0
  125. package/src/generators/preset/preset.d.ts +4 -0
  126. package/src/generators/preset/preset.js +152 -0
  127. package/src/generators/preset/preset.js.map +1 -0
  128. package/src/generators/preset/schema.d.ts +17 -0
  129. package/src/generators/preset/schema.json +88 -0
  130. package/src/generators/remove/lib/__fixtures__/jest-project.config.d.ts +14 -0
  131. package/src/generators/remove/lib/__fixtures__/jest-project.config.js +18 -0
  132. package/src/generators/remove/lib/__fixtures__/jest-project.config.js.map +1 -0
  133. package/src/generators/remove/lib/__fixtures__/jest.config.d.ts +0 -0
  134. package/src/generators/remove/lib/__fixtures__/jest.config.js +9 -0
  135. package/src/generators/remove/lib/__fixtures__/jest.config.js.map +1 -0
  136. package/src/generators/remove/lib/check-dependencies.d.ts +7 -0
  137. package/src/generators/remove/lib/check-dependencies.js +27 -0
  138. package/src/generators/remove/lib/check-dependencies.js.map +1 -0
  139. package/src/generators/remove/lib/check-project-is-safe-to-remove.d.ts +3 -0
  140. package/src/generators/remove/lib/check-project-is-safe-to-remove.js +26 -0
  141. package/src/generators/remove/lib/check-project-is-safe-to-remove.js.map +1 -0
  142. package/src/generators/remove/lib/check-targets.d.ts +10 -0
  143. package/src/generators/remove/lib/check-targets.js +72 -0
  144. package/src/generators/remove/lib/check-targets.js.map +1 -0
  145. package/src/generators/remove/lib/remove-project-references-in-config.d.ts +3 -0
  146. package/src/generators/remove/lib/remove-project-references-in-config.js +22 -0
  147. package/src/generators/remove/lib/remove-project-references-in-config.js.map +1 -0
  148. package/src/generators/remove/lib/remove-project.d.ts +5 -0
  149. package/src/generators/remove/lib/remove-project.js +15 -0
  150. package/src/generators/remove/lib/remove-project.js.map +1 -0
  151. package/src/generators/remove/lib/update-jest-config.d.ts +6 -0
  152. package/src/generators/remove/lib/update-jest-config.js +64 -0
  153. package/src/generators/remove/lib/update-jest-config.js.map +1 -0
  154. package/src/generators/remove/lib/update-tsconfig.d.ts +8 -0
  155. package/src/generators/remove/lib/update-tsconfig.js +35 -0
  156. package/src/generators/remove/lib/update-tsconfig.js.map +1 -0
  157. package/src/generators/remove/remove.d.ts +5 -0
  158. package/src/generators/remove/remove.js +31 -0
  159. package/src/generators/remove/remove.js.map +1 -0
  160. package/src/generators/remove/schema.d.ts +10 -0
  161. package/src/generators/remove/schema.json +47 -0
  162. package/src/generators/run-commands/run-commands.d.ts +5 -0
  163. package/src/generators/run-commands/run-commands.js +30 -0
  164. package/src/generators/run-commands/run-commands.js.map +1 -0
  165. package/src/generators/run-commands/schema.d.ts +8 -0
  166. package/src/generators/run-commands/schema.json +49 -0
  167. package/src/generators/utils/get-npm-package-version.d.ts +1 -0
  168. package/src/generators/utils/get-npm-package-version.js +18 -0
  169. package/src/generators/utils/get-npm-package-version.js.map +1 -0
  170. package/src/generators/utils/insert-import.d.ts +2 -0
  171. package/src/generators/utils/insert-import.js +48 -0
  172. package/src/generators/utils/insert-import.js.map +1 -0
  173. package/src/generators/utils/insert-statement.d.ts +5 -0
  174. package/src/generators/utils/insert-statement.js +34 -0
  175. package/src/generators/utils/insert-statement.js.map +1 -0
  176. package/src/generators/utils/presets.d.ts +18 -0
  177. package/src/generators/utils/presets.js +23 -0
  178. package/src/generators/utils/presets.js.map +1 -0
  179. package/src/generators/workspace-generator/files/index.ts__tmpl__ +10 -0
  180. package/src/generators/workspace-generator/files/schema.json__tmpl__ +17 -0
  181. package/src/generators/workspace-generator/schema.d.ts +4 -0
  182. package/src/generators/workspace-generator/schema.json +25 -0
  183. package/src/generators/workspace-generator/workspace-generator.d.ts +3 -0
  184. package/src/generators/workspace-generator/workspace-generator.js +27 -0
  185. package/src/generators/workspace-generator/workspace-generator.js.map +1 -0
  186. package/src/migrations/update-12-5-0/add-target-dependencies.d.ts +3 -0
  187. package/src/migrations/update-12-5-0/add-target-dependencies.js +39 -0
  188. package/src/migrations/update-12-5-0/add-target-dependencies.js.map +1 -0
  189. package/src/migrations/update-13-0-0/config-locations/config-locations.d.ts +2 -0
  190. package/src/migrations/update-13-0-0/config-locations/config-locations.js +34 -0
  191. package/src/migrations/update-13-0-0/config-locations/config-locations.js.map +1 -0
  192. package/src/migrations/update-13-0-0/set-default-base-if-not-set.d.ts +3 -0
  193. package/src/migrations/update-13-0-0/set-default-base-if-not-set.js +30 -0
  194. package/src/migrations/update-13-0-0/set-default-base-if-not-set.js.map +1 -0
  195. package/src/migrations/update-13-10-0/update-decorate-cli.d.ts +3 -0
  196. package/src/migrations/update-13-10-0/update-decorate-cli.js +14 -0
  197. package/src/migrations/update-13-10-0/update-decorate-cli.js.map +1 -0
  198. package/src/migrations/update-13-10-0/update-tasks-runner.d.ts +3 -0
  199. package/src/migrations/update-13-10-0/update-tasks-runner.js +17 -0
  200. package/src/migrations/update-13-10-0/update-tasks-runner.js.map +1 -0
  201. package/src/migrations/update-13-2-0/set-parallel-default.d.ts +3 -0
  202. package/src/migrations/update-13-2-0/set-parallel-default.js +27 -0
  203. package/src/migrations/update-13-2-0/set-parallel-default.js.map +1 -0
  204. package/src/migrations/update-13-3-0/update-tsc-executor-location.d.ts +3 -0
  205. package/src/migrations/update-13-3-0/update-tsc-executor-location.js +31 -0
  206. package/src/migrations/update-13-3-0/update-tsc-executor-location.js.map +1 -0
  207. package/src/migrations/update-13-6-0/remove-old-task-runner-options.d.ts +3 -0
  208. package/src/migrations/update-13-6-0/remove-old-task-runner-options.js +17 -0
  209. package/src/migrations/update-13-6-0/remove-old-task-runner-options.js.map +1 -0
  210. package/src/migrations/update-13-9-0/replace-tao-with-nx.d.ts +3 -0
  211. package/src/migrations/update-13-9-0/replace-tao-with-nx.js +28 -0
  212. package/src/migrations/update-13-9-0/replace-tao-with-nx.js.map +1 -0
  213. package/src/migrations/update-13-9-0/update-decorate-cli.d.ts +3 -0
  214. package/src/migrations/update-13-9-0/update-decorate-cli.js +13 -0
  215. package/src/migrations/update-13-9-0/update-decorate-cli.js.map +1 -0
  216. package/src/migrations/update-14-0-0/change-npm-script-executor.d.ts +3 -0
  217. package/src/migrations/update-14-0-0/change-npm-script-executor.js +20 -0
  218. package/src/migrations/update-14-0-0/change-npm-script-executor.js.map +1 -0
  219. package/src/migrations/update-14-0-0/change-nx-json-presets.d.ts +3 -0
  220. package/src/migrations/update-14-0-0/change-nx-json-presets.js +21 -0
  221. package/src/migrations/update-14-0-0/change-nx-json-presets.js.map +1 -0
  222. package/src/migrations/update-14-2-0/enable-source-analysis.d.ts +3 -0
  223. package/src/migrations/update-14-2-0/enable-source-analysis.js +28 -0
  224. package/src/migrations/update-14-2-0/enable-source-analysis.js.map +1 -0
  225. package/src/migrations/update-14-8-0/change-run-commands-executor.d.ts +3 -0
  226. package/src/migrations/update-14-8-0/change-run-commands-executor.js +20 -0
  227. package/src/migrations/update-14-8-0/change-run-commands-executor.js.map +1 -0
  228. package/src/migrations/update-15-7-0/split-configuration-into-project-json-files.d.ts +3 -0
  229. package/src/migrations/update-15-7-0/split-configuration-into-project-json-files.js +15 -0
  230. package/src/migrations/update-15-7-0/split-configuration-into-project-json-files.js.map +1 -0
  231. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  232. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
  233. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
  234. package/src/tasks-runner/cache.d.ts +1 -0
  235. package/src/tasks-runner/cache.js +6 -0
  236. package/src/tasks-runner/cache.js.map +1 -0
  237. package/src/tasks-runner/default-tasks-runner.d.ts +1 -0
  238. package/src/tasks-runner/default-tasks-runner.js +5 -0
  239. package/src/tasks-runner/default-tasks-runner.js.map +1 -0
  240. package/src/tasks-runner/life-cycle.d.ts +1 -0
  241. package/src/tasks-runner/life-cycle.js +6 -0
  242. package/src/tasks-runner/life-cycle.js.map +1 -0
  243. package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.d.ts +1 -0
  244. package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +5 -0
  245. package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js.map +1 -0
  246. package/src/tasks-runner/tasks-runner-v2.d.ts +1 -0
  247. package/src/tasks-runner/tasks-runner-v2.js +7 -0
  248. package/src/tasks-runner/tasks-runner-v2.js.map +1 -0
  249. package/src/tasks-runner/tasks-runner.d.ts +2 -0
  250. package/src/tasks-runner/tasks-runner.js +5 -0
  251. package/src/tasks-runner/tasks-runner.js.map +1 -0
  252. package/src/tasks-runner/utils.d.ts +1 -0
  253. package/src/tasks-runner/utils.js +5 -0
  254. package/src/tasks-runner/utils.js.map +1 -0
  255. package/src/utilities/app-root.d.ts +1 -0
  256. package/src/utilities/app-root.js +5 -0
  257. package/src/utilities/app-root.js.map +1 -0
  258. package/src/utilities/buildable-libs-utils.d.ts +41 -0
  259. package/src/utilities/buildable-libs-utils.js +316 -0
  260. package/src/utilities/buildable-libs-utils.js.map +1 -0
  261. package/src/utilities/default-base.d.ts +1 -0
  262. package/src/utilities/default-base.js +16 -0
  263. package/src/utilities/default-base.js.map +1 -0
  264. package/src/utilities/fileutils.d.ts +13 -0
  265. package/src/utilities/fileutils.js +52 -0
  266. package/src/utilities/fileutils.js.map +1 -0
  267. package/src/utilities/output.d.ts +1 -0
  268. package/src/utilities/output.js +5 -0
  269. package/src/utilities/output.js.map +1 -0
  270. package/src/utilities/run-tasks-in-serial.d.ts +8 -0
  271. package/src/utilities/run-tasks-in-serial.js +19 -0
  272. package/src/utilities/run-tasks-in-serial.js.map +1 -0
  273. package/src/utilities/ts-config.d.ts +5 -0
  274. package/src/utilities/ts-config.js +40 -0
  275. package/src/utilities/ts-config.js.map +1 -0
  276. package/src/utilities/typescript/compilation.d.ts +22 -0
  277. package/src/utilities/typescript/compilation.js +120 -0
  278. package/src/utilities/typescript/compilation.js.map +1 -0
  279. package/src/utilities/typescript/get-source-nodes.d.ts +5 -0
  280. package/src/utilities/typescript/get-source-nodes.js +22 -0
  281. package/src/utilities/typescript/get-source-nodes.js.map +1 -0
  282. package/src/utilities/typescript.d.ts +22 -0
  283. package/src/utilities/typescript.js +71 -0
  284. package/src/utilities/typescript.js.map +1 -0
  285. package/src/utilities/version-utils.d.ts +4 -0
  286. package/src/utilities/version-utils.js +14 -0
  287. package/src/utilities/version-utils.js.map +1 -0
  288. package/src/utils/ast-utils.d.ts +1 -0
  289. package/src/utils/ast-utils.js +6 -0
  290. package/src/utils/ast-utils.js.map +1 -0
  291. package/src/utils/cli-config-utils.d.ts +16 -0
  292. package/src/utils/cli-config-utils.js +30 -0
  293. package/src/utils/cli-config-utils.js.map +1 -0
  294. package/src/utils/fileutils.d.ts +24 -0
  295. package/src/utils/fileutils.js +67 -0
  296. package/src/utils/fileutils.js.map +1 -0
  297. package/src/utils/lint.d.ts +4 -0
  298. package/src/utils/lint.js +3 -0
  299. package/src/utils/lint.js.map +1 -0
  300. package/src/utils/output.d.ts +52 -0
  301. package/src/utils/output.js +134 -0
  302. package/src/utils/output.js.map +1 -0
  303. package/src/utils/perf-logging.d.ts +1 -0
  304. package/src/utils/perf-logging.js +11 -0
  305. package/src/utils/perf-logging.js.map +1 -0
  306. package/src/utils/project-type.d.ts +5 -0
  307. package/src/utils/project-type.js +18 -0
  308. package/src/utils/project-type.js.map +1 -0
  309. package/src/utils/rules/add-install-task.d.ts +7 -0
  310. package/src/utils/rules/add-install-task.js +18 -0
  311. package/src/utils/rules/add-install-task.js.map +1 -0
  312. package/src/utils/rules/deleteFile.d.ts +6 -0
  313. package/src/utils/rules/deleteFile.js +12 -0
  314. package/src/utils/rules/deleteFile.js.map +1 -0
  315. package/src/utils/rules/format-files.d.ts +7 -0
  316. package/src/utils/rules/format-files.js +58 -0
  317. package/src/utils/rules/format-files.js.map +1 -0
  318. package/src/utils/rules/visit-not-ignored-files.d.ts +6 -0
  319. package/src/utils/rules/visit-not-ignored-files.js +39 -0
  320. package/src/utils/rules/visit-not-ignored-files.js.map +1 -0
  321. package/src/utils/strings.d.ts +107 -0
  322. package/src/utils/strings.js +160 -0
  323. package/src/utils/strings.js.map +1 -0
  324. package/src/utils/testing-utils.d.ts +54 -0
  325. package/src/utils/testing-utils.js +147 -0
  326. package/src/utils/testing-utils.js.map +1 -0
  327. package/src/utils/version-utils.d.ts +1 -0
  328. package/src/utils/version-utils.js +5 -0
  329. package/src/utils/version-utils.js.map +1 -0
  330. package/src/utils/versions.d.ts +7 -0
  331. package/src/utils/versions.js +13 -0
  332. package/src/utils/versions.js.map +1 -0
  333. package/src/utils/workspace.d.ts +20 -0
  334. package/src/utils/workspace.js +97 -0
  335. package/src/utils/workspace.js.map +1 -0
  336. package/tasks-runners/default.d.ts +1 -0
  337. package/tasks-runners/default.js +6 -0
  338. package/tasks-runners/default.js.map +1 -0
  339. package/testing.d.ts +1 -0
  340. package/testing.js +8 -0
  341. package/testing.js.map +1 -0
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.moveProjectFiles = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const path_1 = require("path");
6
+ /**
7
+ * Moves a project to the given destination path
8
+ *
9
+ * @param schema The options provided to the schematic
10
+ */
11
+ function moveProjectFiles(tree, schema, project) {
12
+ (0, devkit_1.visitNotIgnoredFiles)(tree, project.root, (file) => {
13
+ // This is a rename but Angular Devkit isn't capable of writing to a file after it's renamed so this is a workaround
14
+ const content = tree.read(file);
15
+ const relativeFromOriginalSource = (0, path_1.relative)(project.root, file);
16
+ const newFilePath = (0, path_1.join)(schema.relativeToRootDestination, relativeFromOriginalSource);
17
+ tree.write(newFilePath, content);
18
+ tree.delete(file);
19
+ });
20
+ }
21
+ exports.moveProjectFiles = moveProjectFiles;
22
+ //# sourceMappingURL=move-project-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-project-files.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/move-project-files.ts"],"names":[],"mappings":";;;AAAA,uCAA8E;AAC9E,+BAAsC;AAGtC;;;;GAIG;AACH,SAAgB,gBAAgB,CAC9B,IAAU,EACV,MAAwB,EACxB,OAA6B;IAE7B,IAAA,6BAAoB,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;QAChD,oHAAoH;QACpH,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChC,MAAM,0BAA0B,GAAG,IAAA,eAAQ,EAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAChE,MAAM,WAAW,GAAG,IAAA,WAAI,EACtB,MAAM,CAAC,yBAAyB,EAChC,0BAA0B,CAC3B,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;AACL,CAAC;AAhBD,4CAgBC"}
@@ -0,0 +1,3 @@
1
+ import { ProjectConfiguration, Tree } from '@nx/devkit';
2
+ import type { NormalizedSchema, Schema } from '../schema';
3
+ export declare function normalizeSchema(tree: Tree, schema: Schema, projectConfiguration: ProjectConfiguration): NormalizedSchema;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeSchema = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const path_1 = require("nx/src/utils/path");
6
+ const utils_1 = require("./utils");
7
+ function normalizeSchema(tree, schema, projectConfiguration) {
8
+ var _a;
9
+ const destination = schema.destination.startsWith('/')
10
+ ? (0, utils_1.normalizeSlashes)(schema.destination.slice(1))
11
+ : schema.destination;
12
+ const newProjectName = (0, utils_1.getNewProjectName)(destination);
13
+ const { npmScope } = (0, devkit_1.getWorkspaceLayout)(tree);
14
+ return Object.assign(Object.assign({}, schema), { destination, importPath: (_a = schema.importPath) !== null && _a !== void 0 ? _a : (0, utils_1.normalizeSlashes)((0, path_1.getImportPath)(npmScope, destination)), newProjectName, relativeToRootDestination: (0, utils_1.getDestination)(tree, schema, projectConfiguration) });
15
+ }
16
+ exports.normalizeSchema = normalizeSchema;
17
+ //# sourceMappingURL=normalize-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-schema.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/normalize-schema.ts"],"names":[],"mappings":";;;AAAA,uCAA4E;AAC5E,4CAAkD;AAElD,mCAA8E;AAE9E,SAAgB,eAAe,CAC7B,IAAU,EACV,MAAc,EACd,oBAA0C;;IAE1C,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC;QACpD,CAAC,CAAC,IAAA,wBAAgB,EAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;IACvB,MAAM,cAAc,GAAG,IAAA,yBAAiB,EAAC,WAAW,CAAC,CAAC;IACtD,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;IAE9C,uCACK,MAAM,KACT,WAAW,EACX,UAAU,EACR,MAAA,MAAM,CAAC,UAAU,mCACjB,IAAA,wBAAgB,EAAC,IAAA,oBAAa,EAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,EACxD,cAAc,EACd,yBAAyB,EAAE,IAAA,sBAAc,EACvC,IAAI,EACJ,MAAM,EACN,oBAAoB,CACrB,IACD;AACJ,CAAC;AAxBD,0CAwBC"}
@@ -0,0 +1,6 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from '../schema';
3
+ /**
4
+ * Update other references to the source project's targets
5
+ */
6
+ export declare function updateBuildTargets(tree: Tree, schema: NormalizedSchema): void;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateBuildTargets = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ /**
6
+ * Update other references to the source project's targets
7
+ */
8
+ function updateBuildTargets(tree, schema) {
9
+ (0, devkit_1.getProjects)(tree).forEach((projectConfig, project) => {
10
+ let changed = false;
11
+ Object.entries(projectConfig.targets || {}).forEach(([target, targetConfig]) => {
12
+ changed =
13
+ updateJsonValue(targetConfig, (value) => {
14
+ const [project, target, configuration] = value.split(':');
15
+ if (project === schema.projectName && target) {
16
+ return configuration
17
+ ? `${schema.newProjectName}:${target}:${configuration}`
18
+ : `${schema.newProjectName}:${target}`;
19
+ }
20
+ }) || changed;
21
+ });
22
+ if (changed) {
23
+ (0, devkit_1.updateProjectConfiguration)(tree, project, projectConfig);
24
+ }
25
+ });
26
+ }
27
+ exports.updateBuildTargets = updateBuildTargets;
28
+ function updateJsonValue(config, callback) {
29
+ function recur(obj, key, value) {
30
+ let changed = false;
31
+ if (typeof value === 'string') {
32
+ const result = callback(value);
33
+ if (result && obj[key] !== result) {
34
+ obj[key] = result;
35
+ changed = true;
36
+ }
37
+ }
38
+ else if (Array.isArray(value)) {
39
+ value.forEach((x, idx) => recur(value, idx, x));
40
+ }
41
+ else if (typeof value === 'object') {
42
+ Object.entries(value).forEach(([k, v]) => {
43
+ changed = recur(value, k, v) || changed;
44
+ });
45
+ }
46
+ return changed;
47
+ }
48
+ let changed = false;
49
+ Object.entries(config).forEach(([k, v]) => {
50
+ changed = recur(config, k, v) || changed;
51
+ });
52
+ return changed;
53
+ }
54
+ //# sourceMappingURL=update-build-targets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-build-targets.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/update-build-targets.ts"],"names":[],"mappings":";;;AAAA,uCAKoB;AAGpB;;GAEG;AACH,SAAgB,kBAAkB,CAAC,IAAU,EAAE,MAAwB;IACrE,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE;QACnD,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,OAAO,CACjD,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,EAAE;YACzB,OAAO;gBACL,eAAe,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;oBACtC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBAC1D,IAAI,OAAO,KAAK,MAAM,CAAC,WAAW,IAAI,MAAM,EAAE;wBAC5C,OAAO,aAAa;4BAClB,CAAC,CAAC,GAAG,MAAM,CAAC,cAAc,IAAI,MAAM,IAAI,aAA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C,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE;QACxC,OAAO,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,OAAO,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ProjectConfiguration, Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from '../schema';
3
+ /**
4
+ * Updates the videos and screenshots folders in the cypress.json/cypress.config.ts if it exists (i.e. we're moving an e2e project)
5
+ *
6
+ * (assume relative paths have been updated previously)
7
+ *
8
+ * @param schema The options provided to the schematic
9
+ */
10
+ export declare function updateCypressConfig(tree: Tree, schema: NormalizedSchema, project: ProjectConfiguration): Tree;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateCypressConfig = void 0;
4
+ const path = require("path");
5
+ /**
6
+ * Updates the videos and screenshots folders in the cypress.json/cypress.config.ts if it exists (i.e. we're moving an e2e project)
7
+ *
8
+ * (assume relative paths have been updated previously)
9
+ *
10
+ * @param schema The options provided to the schematic
11
+ */
12
+ function updateCypressConfig(tree, schema, project) {
13
+ const cypressJsonPath = path.join(schema.relativeToRootDestination, 'cypress.json');
14
+ if (tree.exists(cypressJsonPath)) {
15
+ const cypressJson = JSON.parse(tree.read(cypressJsonPath).toString('utf-8'));
16
+ // videosFolder is not required because videos can be turned off - it also has a default
17
+ if (cypressJson.videosFolder) {
18
+ cypressJson.videosFolder = cypressJson.videosFolder.replace(project.root, schema.relativeToRootDestination);
19
+ }
20
+ // screenshotsFolder is not required as it has a default
21
+ if (cypressJson.screenshotsFolder) {
22
+ cypressJson.screenshotsFolder = cypressJson.screenshotsFolder.replace(project.root, schema.relativeToRootDestination);
23
+ }
24
+ tree.write(cypressJsonPath, JSON.stringify(cypressJson));
25
+ return tree;
26
+ }
27
+ const cypressConfigPath = path.join(schema.relativeToRootDestination, 'cypress.config.ts');
28
+ if (tree.exists(cypressConfigPath)) {
29
+ const oldContent = tree.read(cypressConfigPath, 'utf-8');
30
+ const findName = new RegExp(`'${schema.projectName}'`, 'g');
31
+ const findDir = new RegExp(project.root, 'g');
32
+ const newContent = oldContent
33
+ .replace(findName, `'${schema.newProjectName}'`)
34
+ .replace(findDir, schema.relativeToRootDestination);
35
+ tree.write(cypressConfigPath, newContent);
36
+ }
37
+ }
38
+ exports.updateCypressConfig = updateCypressConfig;
39
+ //# sourceMappingURL=update-cypress-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-cypress-config.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/update-cypress-config.ts"],"names":[],"mappings":";;;AACA,6BAA6B;AAQ7B;;;;;;GAMG;AACH,SAAgB,mBAAmB,CACjC,IAAU,EACV,MAAwB,EACxB,OAA6B;IAE7B,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAC/B,MAAM,CAAC,yBAAyB,EAChC,cAAc,CACf,CAAC;IAEF,IAAI,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE;QAChC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CACvB,CAAC;QACxB,wFAAwF;QACxF,IAAI,WAAW,CAAC,YAAY,EAAE;YAC5B,WAAW,CAAC,YAAY,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,CACzD,OAAO,CAAC,IAAI,EACZ,MAAM,CAAC,yBAAyB,CACjC,CAAC;SACH;QACD,wDAAwD;QACxD,IAAI,WAAW,CAAC,iBAAiB,EAAE;YACjC,WAAW,CAAC,iBAAiB,GAAG,WAAW,CAAC,iBAAiB,CAAC,OAAO,CACnE,OAAO,CAAC,IAAI,EACZ,MAAM,CAAC,yBAAyB,CACjC,CAAC;SACH;QAED,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC;KACb;IAED,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CACjC,MAAM,CAAC,yBAAyB,EAChC,mBAAmB,CACpB,CAAC;IACF,IAAI,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE;QAClC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,IAAI,MAAM,CAAC,WAAW,GAAG,EAAE,GAAG,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC9C,MAAM,UAAU,GAAG,UAAU;aAC1B,OAAO,CAAC,QAAQ,EAAE,IAAI,MAAM,CAAC,cAAc,GAAG,CAAC;aAC/C,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,yBAAyB,CAAC,CAAC;QAEtD,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;KAC3C;AACH,CAAC;AA/CD,kDA+CC"}
@@ -0,0 +1,10 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from '../schema';
3
+ /**
4
+ * Updates the project in the workspace file
5
+ *
6
+ * - update all references to the old root path
7
+ * - change the project name
8
+ * - change target references
9
+ */
10
+ export declare function updateDefaultProject(tree: Tree, schema: NormalizedSchema): void;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateDefaultProject = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ /**
6
+ * Updates the project in the workspace file
7
+ *
8
+ * - update all references to the old root path
9
+ * - change the project name
10
+ * - change target references
11
+ */
12
+ function updateDefaultProject(tree, schema) {
13
+ const nxJson = (0, devkit_1.readNxJson)(tree);
14
+ // update default project (if necessary)
15
+ if (nxJson.defaultProject && nxJson.defaultProject === schema.projectName) {
16
+ nxJson.defaultProject = schema.newProjectName;
17
+ (0, devkit_1.updateNxJson)(tree, nxJson);
18
+ }
19
+ }
20
+ exports.updateDefaultProject = updateDefaultProject;
21
+ //# sourceMappingURL=update-default-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-default-project.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/update-default-project.ts"],"names":[],"mappings":";;;AAAA,uCAA4D;AAG5D;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAAC,IAAU,EAAE,MAAwB;IACvE,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC;IAEhC,wCAAwC;IACxC,IAAI,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,cAAc,KAAK,MAAM,CAAC,WAAW,EAAE;QACzE,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;QAC9C,IAAA,qBAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;KAC5B;AACH,CAAC;AARD,oDAQC"}
@@ -0,0 +1,8 @@
1
+ import { ProjectConfiguration, Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from '../schema';
3
+ /**
4
+ * Update the .eslintrc file of the project if it exists.
5
+ *
6
+ * @param schema The options provided to the schematic
7
+ */
8
+ export declare function updateEslintrcJson(tree: Tree, schema: NormalizedSchema, project: ProjectConfiguration): void;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateEslintrcJson = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const path_1 = require("path");
6
+ function offsetFilePath(project, pathToFile, offset) {
7
+ if (!pathToFile.startsWith('..')) {
8
+ // not a relative path
9
+ return pathToFile;
10
+ }
11
+ const pathFromRoot = (0, path_1.join)(project.root, pathToFile);
12
+ return (0, devkit_1.joinPathFragments)(offset, pathFromRoot);
13
+ }
14
+ /**
15
+ * Update the .eslintrc file of the project if it exists.
16
+ *
17
+ * @param schema The options provided to the schematic
18
+ */
19
+ function updateEslintrcJson(tree, schema, project) {
20
+ const eslintRcPath = (0, path_1.join)(schema.relativeToRootDestination, '.eslintrc.json');
21
+ if (!tree.exists(eslintRcPath)) {
22
+ // no .eslintrc found. nothing to do
23
+ return;
24
+ }
25
+ const offset = (0, devkit_1.offsetFromRoot)(schema.relativeToRootDestination);
26
+ (0, devkit_1.updateJson)(tree, eslintRcPath, (eslintRcJson) => {
27
+ var _a;
28
+ if (typeof eslintRcJson.extends === 'string') {
29
+ eslintRcJson.extends = offsetFilePath(project, eslintRcJson.extends, offset);
30
+ }
31
+ else {
32
+ eslintRcJson.extends = eslintRcJson.extends.map((extend) => offsetFilePath(project, extend, offset));
33
+ }
34
+ (_a = eslintRcJson.overrides) === null || _a === void 0 ? void 0 : _a.forEach((o) => {
35
+ var _a;
36
+ if ((_a = o.parserOptions) === null || _a === void 0 ? void 0 : _a.project) {
37
+ o.parserOptions.project = o.parserOptions.project.map((p) => p.replace(project.root, schema.relativeToRootDestination));
38
+ }
39
+ });
40
+ return eslintRcJson;
41
+ });
42
+ }
43
+ exports.updateEslintrcJson = updateEslintrcJson;
44
+ //# sourceMappingURL=update-eslintrc-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-eslintrc-json.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/update-eslintrc-json.ts"],"names":[],"mappings":";;;AAAA,uCAMoB;AACpB,+BAA4B;AAc5B,SAAS,cAAc,CACrB,OAA6B,EAC7B,UAAkB,EAClB,MAAc;IAEd,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QAChC,sBAAsB;QACtB,OAAO,UAAU,CAAC;KACnB;IACD,MAAM,YAAY,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE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,CAAC;AACL,CAAC;AArCD,gDAqCC"}
@@ -0,0 +1,6 @@
1
+ import type { Tree } from '@nx/devkit';
2
+ import type { NormalizedSchema } from '../schema';
3
+ /**
4
+ * @param schema The options provided to the schematic
5
+ */
6
+ export declare function updateImplicitDependencies(tree: Tree, schema: NormalizedSchema): void;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateImplicitDependencies = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ /**
6
+ * @param schema The options provided to the schematic
7
+ */
8
+ function updateImplicitDependencies(tree, schema) {
9
+ for (const [projectName, project] of (0, devkit_1.getProjects)(tree)) {
10
+ if (project.implicitDependencies) {
11
+ const index = project.implicitDependencies.indexOf(schema.projectName);
12
+ if (index !== -1) {
13
+ project.implicitDependencies[index] = schema.newProjectName;
14
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
15
+ }
16
+ }
17
+ }
18
+ }
19
+ exports.updateImplicitDependencies = updateImplicitDependencies;
20
+ //# sourceMappingURL=update-implicit-dependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-implicit-dependencies.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/update-implicit-dependencies.ts"],"names":[],"mappings":";;;AACA,uCAAqE;AAGrE;;GAEG;AACH,SAAgB,0BAA0B,CACxC,IAAU,EACV,MAAwB;IAExB,KAAK,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,IAAI,IAAA,oBAAW,EAAC,IAAI,CAAC,EAAE;QACtD,IAAI,OAAO,CAAC,oBAAoB,EAAE;YAChC,MAAM,KAAK,GAAG,OAAO,CAAC,oBAAoB,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;YACvE,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;gBAChB,OAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC;gBAC5D,IAAA,mCAA0B,EAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;aACxD;SACF;KACF;AACH,CAAC;AAbD,gEAaC"}
@@ -0,0 +1,8 @@
1
+ import { ProjectConfiguration, Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from '../schema';
3
+ /**
4
+ * Updates all the imports in the workspace and modifies the tsconfig appropriately.
5
+ *
6
+ * @param schema The options provided to the schematic
7
+ */
8
+ export declare function updateImports(tree: Tree, schema: NormalizedSchema, project: ProjectConfiguration): void;
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateImports = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const ts_config_1 = require("../../../utilities/ts-config");
6
+ const typescript_1 = require("nx/src/utils/typescript");
7
+ const utils_1 = require("./utils");
8
+ const path_1 = require("path");
9
+ const typescript_2 = require("../../../utilities/typescript");
10
+ let tsModule;
11
+ /**
12
+ * Updates all the imports in the workspace and modifies the tsconfig appropriately.
13
+ *
14
+ * @param schema The options provided to the schematic
15
+ */
16
+ function updateImports(tree, schema, project) {
17
+ if (project.projectType === 'application') {
18
+ // These shouldn't be imported anywhere?
19
+ return;
20
+ }
21
+ const { npmScope, libsDir } = (0, devkit_1.getWorkspaceLayout)(tree);
22
+ const projects = (0, devkit_1.getProjects)(tree);
23
+ // use the source root to find the from location
24
+ // this attempts to account for libs that have been created with --importPath
25
+ const tsConfigPath = (0, ts_config_1.getRootTsConfigPathInTree)(tree);
26
+ let tsConfig;
27
+ let fromPath;
28
+ if (tree.exists(tsConfigPath)) {
29
+ tsConfig = (0, devkit_1.readJson)(tree, tsConfigPath);
30
+ fromPath = Object.keys(tsConfig.compilerOptions.paths).find((path) => tsConfig.compilerOptions.paths[path].some((x) => x.startsWith(project.sourceRoot)));
31
+ }
32
+ const projectRef = {
33
+ from: fromPath ||
34
+ (0, utils_1.normalizeSlashes)((0, devkit_1.getImportPath)(npmScope, project.root.slice(libsDir.length).replace(/^\/|\\/, ''))),
35
+ to: schema.importPath,
36
+ };
37
+ if (schema.updateImportPath) {
38
+ const replaceProjectRef = new RegExp(projectRef.from, 'g');
39
+ for (const [name, definition] of Array.from(projects.entries())) {
40
+ if (name === schema.projectName) {
41
+ continue;
42
+ }
43
+ (0, devkit_1.visitNotIgnoredFiles)(tree, definition.root, (file) => {
44
+ const contents = tree.read(file, 'utf-8');
45
+ replaceProjectRef.lastIndex = 0;
46
+ if (!replaceProjectRef.test(contents)) {
47
+ return;
48
+ }
49
+ updateImportPaths(tree, file, projectRef.from, projectRef.to);
50
+ });
51
+ }
52
+ }
53
+ const projectRoot = {
54
+ from: project.root,
55
+ to: schema.relativeToRootDestination,
56
+ };
57
+ if (tsConfig) {
58
+ const path = tsConfig.compilerOptions.paths[projectRef.from];
59
+ if (!path) {
60
+ throw new Error([
61
+ `unable to find "${projectRef.from}" in`,
62
+ `${tsConfigPath} compilerOptions.paths`,
63
+ ].join(' '));
64
+ }
65
+ const updatedPath = path.map((x) => (0, devkit_1.joinPathFragments)(projectRoot.to, (0, path_1.relative)(projectRoot.from, x)));
66
+ if (schema.updateImportPath) {
67
+ tsConfig.compilerOptions.paths[projectRef.to] = updatedPath;
68
+ delete tsConfig.compilerOptions.paths[projectRef.from];
69
+ }
70
+ else {
71
+ tsConfig.compilerOptions.paths[projectRef.from] = updatedPath;
72
+ }
73
+ (0, devkit_1.writeJson)(tree, tsConfigPath, tsConfig);
74
+ }
75
+ }
76
+ exports.updateImports = updateImports;
77
+ /**
78
+ * Changes imports in a file from one import to another
79
+ */
80
+ function updateImportPaths(tree, path, from, to) {
81
+ if (!tsModule) {
82
+ tsModule = (0, typescript_2.ensureTypescript)();
83
+ }
84
+ const contents = tree.read(path, 'utf-8');
85
+ const sourceFile = tsModule.createSourceFile(path, contents, tsModule.ScriptTarget.Latest, true);
86
+ // Apply changes on the various types of imports
87
+ const newContents = (0, devkit_1.applyChangesToString)(contents, [
88
+ ...updateImportDeclarations(sourceFile, from, to),
89
+ ...updateDynamicImports(sourceFile, from, to),
90
+ ]);
91
+ tree.write(path, newContents);
92
+ }
93
+ /**
94
+ * Update the module specifiers on static imports
95
+ */
96
+ function updateImportDeclarations(sourceFile, from, to) {
97
+ if (!tsModule) {
98
+ tsModule = (0, typescript_2.ensureTypescript)();
99
+ }
100
+ const importDecls = (0, typescript_1.findNodes)(sourceFile, tsModule.SyntaxKind.ImportDeclaration);
101
+ const changes = [];
102
+ for (const { moduleSpecifier } of importDecls) {
103
+ if (tsModule.isStringLiteral(moduleSpecifier)) {
104
+ changes.push(...updateModuleSpecifier(moduleSpecifier, from, to));
105
+ }
106
+ }
107
+ return changes;
108
+ }
109
+ /**
110
+ * Update the module specifiers on dynamic imports and require statements
111
+ */
112
+ function updateDynamicImports(sourceFile, from, to) {
113
+ if (!tsModule) {
114
+ tsModule = (0, typescript_2.ensureTypescript)();
115
+ }
116
+ const expressions = (0, typescript_1.findNodes)(sourceFile, tsModule.SyntaxKind.CallExpression);
117
+ const changes = [];
118
+ for (const { expression, arguments: args } of expressions) {
119
+ const moduleSpecifier = args[0];
120
+ // handle dynamic import statements
121
+ if (expression.kind === tsModule.SyntaxKind.ImportKeyword &&
122
+ moduleSpecifier &&
123
+ tsModule.isStringLiteral(moduleSpecifier)) {
124
+ changes.push(...updateModuleSpecifier(moduleSpecifier, from, to));
125
+ }
126
+ // handle require statements
127
+ if (tsModule.isIdentifier(expression) &&
128
+ expression.text === 'require' &&
129
+ moduleSpecifier &&
130
+ tsModule.isStringLiteral(moduleSpecifier)) {
131
+ changes.push(...updateModuleSpecifier(moduleSpecifier, from, to));
132
+ }
133
+ }
134
+ return changes;
135
+ }
136
+ /**
137
+ * Replace the old module specifier with a the new path
138
+ */
139
+ function updateModuleSpecifier(moduleSpecifier, from, to) {
140
+ if (moduleSpecifier.text === from ||
141
+ moduleSpecifier.text.startsWith(`${from}/`)) {
142
+ return [
143
+ {
144
+ type: devkit_1.ChangeType.Delete,
145
+ start: moduleSpecifier.getStart() + 1,
146
+ length: moduleSpecifier.text.length,
147
+ },
148
+ {
149
+ type: devkit_1.ChangeType.Insert,
150
+ index: moduleSpecifier.getStart() + 1,
151
+ text: moduleSpecifier.text.replace(new RegExp(from, 'g'), to),
152
+ },
153
+ ];
154
+ }
155
+ else {
156
+ return [];
157
+ }
158
+ }
159
+ //# sourceMappingURL=update-imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-imports.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/update-imports.ts"],"names":[],"mappings":";;;AAAA,uCAaoB;AAEpB,4DAAyE;AACzE,wDAAoD;AAEpD,mCAA2C;AAC3C,+BAAgC;AAChC,8DAAiE;AAEjE,IAAI,QAAqC,CAAC;AAE1C;;;;GAIG;AACH,SAAgB,aAAa,CAC3B,IAAU,EACV,MAAwB,EACxB,OAA6B;IAE7B,IAAI,OAAO,CAAC,WAAW,KAAK,aAAa,EAAE;QACzC,wCAAwC;QACxC,OAAO;KACR;IAED,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAEnC,gDAAgD;IAChD,6EAA6E;IAC7E,MAAM,YAAY,GAAG,IAAA,qCAAyB,EAAC,IAAI,CAAC,CAAC;IACrD,IAAI,QAAa,CAAC;IAClB,IAAI,QAAgB,CAAC;IACrB,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;QAC7B,QAAQ,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAExC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CACnE,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,C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
@@ -0,0 +1,10 @@
1
+ import { ProjectConfiguration, Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from '../schema';
3
+ /**
4
+ * Updates the project name and coverage folder in the jest.config.js if it exists
5
+ *
6
+ * (assume relative paths have been updated previously)
7
+ *
8
+ * @param schema The options provided to the schematic
9
+ */
10
+ export declare function updateJestConfig(tree: Tree, schema: NormalizedSchema, project: ProjectConfiguration): void;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateJestConfig = void 0;
4
+ const path = require("path");
5
+ /**
6
+ * Updates the project name and coverage folder in the jest.config.js if it exists
7
+ *
8
+ * (assume relative paths have been updated previously)
9
+ *
10
+ * @param schema The options provided to the schematic
11
+ */
12
+ function updateJestConfig(tree, schema, project) {
13
+ const jestConfigPath = path.join(schema.relativeToRootDestination, 'jest.config.ts');
14
+ if (tree.exists(jestConfigPath)) {
15
+ const oldContent = tree.read(jestConfigPath, 'utf-8');
16
+ // ensure both single and double quotes are replaced
17
+ const findName = new RegExp(`'${schema.projectName}'|"${schema.projectName}"|\`${schema.projectName}\``, 'g');
18
+ const findDir = new RegExp(project.root, 'g');
19
+ const newContent = oldContent
20
+ .replace(findName, `'${schema.newProjectName}'`)
21
+ .replace(findDir, schema.relativeToRootDestination);
22
+ tree.write(jestConfigPath, newContent);
23
+ }
24
+ // update root jest.config.ts
25
+ const rootJestConfigPath = '/jest.config.ts';
26
+ if (!tree.exists(rootJestConfigPath)) {
27
+ return;
28
+ }
29
+ const findProject = `'<rootDir>/${project.root}'`;
30
+ const oldRootJestConfigContent = tree.read(rootJestConfigPath, 'utf-8');
31
+ const usingJestProjects = oldRootJestConfigContent.includes('getJestProjects()');
32
+ const newRootJestConfigContent = oldRootJestConfigContent.replace(findProject, usingJestProjects ? `` : `'<rootDir>/${schema.relativeToRootDestination}'`);
33
+ tree.write(rootJestConfigPath, newRootJestConfigContent);
34
+ }
35
+ exports.updateJestConfig = updateJestConfig;
36
+ //# sourceMappingURL=update-jest-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-jest-config.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/update-jest-config.ts"],"names":[],"mappings":";;;AACA,6BAA6B;AAG7B;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAC9B,IAAU,EACV,MAAwB,EACxB,OAA6B;IAE7B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAC9B,MAAM,CAAC,yBAAyB,EAChC,gBAAgB,CACjB,CAAC;IAEF,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE;QAC/B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAEtD,oDAAoD;QACpD,MAAM,QAAQ,GAAG,IAAI,MAAM,CACzB,IAAI,MAAM,CAAC,WAAW,MAAM,MAAM,CAAC,WAAW,OAAO,MAAM,CAAC,WAAW,IAAI,EAC3E,GAAG,CACJ,CAAC;QACF,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAE9C,MAAM,UAAU,GAAG,UAAU;aAC1B,OAAO,CAAC,QAAQ,EAAE,IAAI,MAAM,CAAC,cAAc,GAAG,CAAC;aAC/C,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,yBAAyB,CAAC,CAAC;QACtD,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;KACxC;IAED,6BAA6B;IAC7B,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;IAE7C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE;QACpC,OAAO;KACR;IAED,MAAM,WAAW,GAAG,cAAc,OAAO,CAAC,IAAI,GAAG,CAAC;IAElD,MAAM,wBAAwB,GAAG,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACxE,MAAM,iBAAiB,GACrB,wBAAwB,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;IAEzD,MAAM,wBAAwB,GAAG,wBAAwB,CAAC,OAAO,CAC/D,WAAW,EACX,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,MAAM,CAAC,yBAAyB,GAAG,CAC3E,CAAC;IAEF,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,wBAAwB,CAAC,CAAC;AAC3D,CAAC;AA7CD,4CA6CC"}
@@ -0,0 +1,8 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from '../schema';
3
+ /**
4
+ * Updates the name in the package.json if it exists.
5
+ *
6
+ * @param schema The options provided to the schematic
7
+ */
8
+ export declare function updatePackageJson(tree: Tree, schema: NormalizedSchema): void;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updatePackageJson = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const path = require("path");
6
+ /**
7
+ * Updates the name in the package.json if it exists.
8
+ *
9
+ * @param schema The options provided to the schematic
10
+ */
11
+ function updatePackageJson(tree, schema) {
12
+ const packageJsonPath = path.join(schema.relativeToRootDestination, 'package.json');
13
+ if (!tree.exists(packageJsonPath)) {
14
+ // nothing to do
15
+ return;
16
+ }
17
+ const packageJson = (0, devkit_1.readJson)(tree, packageJsonPath);
18
+ packageJson.name = schema.importPath;
19
+ tree.write(packageJsonPath, JSON.stringify(packageJson));
20
+ }
21
+ exports.updatePackageJson = updatePackageJson;
22
+ //# sourceMappingURL=update-package-json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-package-json.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/update-package-json.ts"],"names":[],"mappings":";;;AAAA,uCAA4C;AAC5C,6BAA6B;AAO7B;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,IAAU,EAAE,MAAwB;IACpE,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAC/B,MAAM,CAAC,yBAAyB,EAChC,cAAc,CACf,CAAC;IAEF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE;QACjC,gBAAgB;QAChB,OAAO;KACR;IAED,MAAM,WAAW,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,eAAe,CAAuB,CAAC;IAC1E,WAAW,CAAC,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;IACrC,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;AAC3D,CAAC;AAdD,8CAcC"}
@@ -0,0 +1,10 @@
1
+ import { ProjectConfiguration, Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from '../schema';
3
+ /**
4
+ * Updates the files in the root of the project
5
+ *
6
+ * Typically these are config files which point outside of the project folder
7
+ *
8
+ * @param schema The options provided to the schematic
9
+ */
10
+ export declare function updateProjectRootFiles(tree: Tree, schema: NormalizedSchema, project: ProjectConfiguration): void;