@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,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.batchCounter = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const os_1 = require("os");
6
+ function wait() {
7
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
+ return new Promise((res) => {
9
+ setTimeout(() => res(), 1000);
10
+ });
11
+ });
12
+ }
13
+ function counter(opts) {
14
+ return tslib_1.__asyncGenerator(this, arguments, function* counter_1() {
15
+ for (let i = 0; i < opts.to; ++i) {
16
+ console.log(i);
17
+ yield yield tslib_1.__await({ success: false });
18
+ yield tslib_1.__await(wait());
19
+ }
20
+ yield yield tslib_1.__await({ success: opts.result });
21
+ });
22
+ }
23
+ exports.default = counter;
24
+ function batchCounter(taskGraph, inputs) {
25
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
26
+ const result = {};
27
+ const results = yield Promise.all(taskGraph.roots
28
+ .map((rootTaskId) => [rootTaskId, inputs[rootTaskId]])
29
+ .map(([taskId, options]) => tslib_1.__awaiter(this, void 0, void 0, function* () {
30
+ let terminalOutput = '';
31
+ for (let i = 0; i < options.to; ++i) {
32
+ console.log(i);
33
+ terminalOutput += i + os_1.EOL;
34
+ yield wait();
35
+ }
36
+ return [taskId, options.result, terminalOutput];
37
+ })));
38
+ for (const [taskId, taskResult, terminalOutput] of results) {
39
+ result[taskId] = {
40
+ success: taskResult,
41
+ terminalOutput,
42
+ };
43
+ }
44
+ return result;
45
+ });
46
+ }
47
+ exports.batchCounter = batchCounter;
48
+ //# sourceMappingURL=counter.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"counter.impl.js","sourceRoot":"","sources":["../../../../../../packages/workspace/src/executors/counter/counter.impl.ts"],"names":[],"mappings":";;;;AAAA,2BAAyB;AAEzB,SAAe,IAAI;;QACjB,OAAO,IAAI,OAAO,CAAO,CAAC,GAAG,EAAE,EA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cAAc,CAAC,IAAI,OAAO,EAAE;YAC1D,MAAM,CAAC,MAAM,CAAC,GAAG;gBACf,OAAO,EAAE,UAAU;gBACnB,cAAc;aACf,CAAC;SACH;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AA9BD,oCA8BC"}
@@ -0,0 +1,20 @@
1
+ {
2
+ "version": 2,
3
+ "title": "Counter",
4
+ "description": "A dummy executor useful for E2E tests.",
5
+ "type": "object",
6
+ "cli": "nx",
7
+ "outputCapture": "pipe",
8
+ "properties": {
9
+ "to": {
10
+ "type": "number",
11
+ "description": "Count to this number."
12
+ },
13
+ "result": {
14
+ "type": "boolean",
15
+ "description": "Final result."
16
+ }
17
+ },
18
+ "additionalProperties": true,
19
+ "required": ["to"]
20
+ }
@@ -0,0 +1,6 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export interface Schema {
3
+ name?: string;
4
+ ci: 'github' | 'azure' | 'circleci' | 'bitbucket-pipelines' | 'gitlab';
5
+ }
6
+ export declare function ciWorkflowGenerator(host: Tree, schema: Schema): Promise<void>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ciWorkflowGenerator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const default_base_1 = require("../../utilities/default-base");
7
+ function ciWorkflowGenerator(host, schema) {
8
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+ const ci = schema.ci;
10
+ const options = normalizeOptions(schema);
11
+ const nxJson = (0, devkit_1.readJson)(host, 'nx.json');
12
+ const nxCloudUsed = Object.values(nxJson.tasksRunnerOptions).find((r) => r.runner == '@nrwl/nx-cloud' || r.runner == 'nx-cloud');
13
+ if (!nxCloudUsed) {
14
+ throw new Error('This workspace is not connected to Nx Cloud.');
15
+ }
16
+ if (ci === 'bitbucket-pipelines' && defaultBranchNeedsOriginPrefix(nxJson)) {
17
+ (0, devkit_1.writeJson)(host, 'nx.json', appendOriginPrefix(nxJson));
18
+ }
19
+ (0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, 'files', ci), '', options);
20
+ yield (0, devkit_1.formatFiles)(host);
21
+ });
22
+ }
23
+ exports.ciWorkflowGenerator = ciWorkflowGenerator;
24
+ function normalizeOptions(options) {
25
+ const { name: workflowName, fileName: workflowFileName } = (0, devkit_1.names)(options.name || 'CI');
26
+ const { exec: packageManagerPrefix, ciInstall: packageManagerInstall } = (0, devkit_1.getPackageManagerCommand)();
27
+ return {
28
+ workflowName,
29
+ workflowFileName,
30
+ packageManagerInstall,
31
+ packageManagerPrefix,
32
+ mainBranch: (0, default_base_1.deduceDefaultBase)(),
33
+ tmpl: '',
34
+ };
35
+ }
36
+ function defaultBranchNeedsOriginPrefix(nxJson) {
37
+ var _a, _b;
38
+ return !((_b = (_a = nxJson.affected) === null || _a === void 0 ? void 0 : _a.defaultBase) === null || _b === void 0 ? void 0 : _b.startsWith('origin/'));
39
+ }
40
+ function appendOriginPrefix(nxJson) {
41
+ var _a, _b;
42
+ return Object.assign(Object.assign({}, nxJson), { affected: Object.assign(Object.assign({}, ((_a = nxJson.affected) !== null && _a !== void 0 ? _a : {})), { defaultBase: ((_b = nxJson.affected) === null || _b === void 0 ? void 0 : _b.defaultBase)
43
+ ? `origin/${nxJson.affected.defaultBase}`
44
+ : 'origin/main' }) });
45
+ }
46
+ //# sourceMappingURL=ci-workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-workflow.js","sourceRoot":"","sources":["../../../../../../packages/workspace/src/generators/ci-workflow/ci-workflow.ts"],"names":[],"mappings":";;;;AAAA,uCAUoB;AACpB,+DAAiE;AAOjE,SAAsB,mBAAmB,CAAC,IAAU,EAAE,MAAc;;QAClE,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACrB,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAEzC,MAAM,MAAM,GAAwB,IAAA,iBAAQ,EA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,0CAAE,UAAU,CAAC,SAAS,CAAC,CAAA,CAAC;AAC9D,CAAC;AAED,SAAS,kBAAkB,CAAC,MAA2B;;IACrD,uCACK,MAAM,KACT,QAAQ,kCACH,CAAC,MAAA,MAAM,CAAC,QAAQ,mCAAI,EAAE,CAAC,KAC1B,WAAW,EAAE,CAAA,MAAA,MAAM,CAAC,QAAQ,0CAAE,WAAW;gBACvC,CAAC,CAAC,UAAU,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE;gBACzC,CAAC,CAAC,aAAa,OAEnB;AACJ,CAAC"}
@@ -0,0 +1,58 @@
1
+ name: <%= workflowName %>
2
+
3
+ trigger:
4
+ - <%= mainBranch %>
5
+ pr:
6
+ - <%= mainBranch %>
7
+
8
+ variables:
9
+ CI: 'true'
10
+ NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
11
+ ${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
12
+ NX_BRANCH: $(System.PullRequest.PullRequestNumber)
13
+ TARGET_BRANCH: $[replace(variables['System.PullRequest.TargetBranch'],'refs/heads/','origin/')]
14
+ BASE_SHA: $(git merge-base $(TARGET_BRANCH) HEAD)
15
+ ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
16
+ NX_BRANCH: $(Build.SourceBranchName)
17
+ BASE_SHA: $(git rev-parse HEAD~1)
18
+ HEAD_SHA: $(git rev-parse HEAD)
19
+
20
+ jobs:
21
+ - job: agents
22
+ strategy:
23
+ parallel: 3
24
+ displayName: Nx Cloud Agent
25
+ pool:
26
+ vmImage: 'ubuntu-latest'
27
+ steps:
28
+ <% if(packageManagerPrefix == 'pnpm exec'){ %>
29
+ - script: npm install --prefix=$HOME/.local -g pnpm@6.32.4
30
+ displayName: Install PNPM
31
+ <% } %>- script: <%= packageManagerInstall %>
32
+ displayName: NPM Install Dependencies
33
+ - script: npx nx-cloud start-agent
34
+ displayName: Start Nx-Cloud agent
35
+
36
+ - job: main
37
+ displayName: Nx Cloud Main
38
+ pool:
39
+ vmImage: 'ubuntu-latest'
40
+ steps:
41
+ <% if(packageManagerPrefix == 'pnpm exec'){ %>
42
+ - script: npm install --prefix=$HOME/.local -g pnpm@6.32.4
43
+ displayName: Install PNPM
44
+ <% } %>- script: <%= packageManagerInstall %>
45
+ displayName: NPM Install Dependencies
46
+ - script: <%= packageManagerPrefix %> nx-cloud start-ci-run --stop-agents-after="build" --agent-count=3
47
+ displayName: Start CI run
48
+ - script: <%= packageManagerPrefix %> nx-cloud record -- <%= packageManagerPrefix %> nx format:check --base=$(BASE_SHA) --head=$(HEAD_SHA)
49
+ displayName: Check format
50
+ - script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) --target=lint --parallel=3
51
+ displayName: Run lint
52
+ - script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) --target=test --parallel=3 --ci --code-coverage
53
+ displayName: Run test
54
+ - script: <%= packageManagerPrefix %> nx affected --base=$(BASE_SHA) --head=$(HEAD_SHA) --target=build --parallel=3
55
+ displayName: Run build
56
+ - script: <%= packageManagerPrefix %> nx-cloud stop-all-agents
57
+ condition: always()
58
+ displayName: Stop all Nx-Cloud agents
@@ -0,0 +1,36 @@
1
+ image: node:16.18
2
+
3
+ clone:
4
+ depth: full
5
+
6
+ definitions:
7
+ steps:
8
+ - step: &agent
9
+ name: Agent
10
+ script:
11
+ - export NX_BRANCH=$BITBUCKET_PR_ID
12
+ <% if(packageManagerPrefix == 'pnpm exec'){ %>
13
+ - npm install --prefix=$HOME/.local -g pnpm@6.32.4
14
+ <% } %>
15
+ - <%= packageManagerInstall %>
16
+ - <%= packageManagerPrefix %> nx-cloud start-agent
17
+
18
+ pipelines:
19
+ pull-requests:
20
+ '**':
21
+ - parallel:
22
+ - step:
23
+ name: <%= workflowName %>
24
+ script:
25
+ - export NX_BRANCH=$BITBUCKET_PR_ID
26
+ <% if(packageManagerPrefix == 'pnpm exec'){ %>
27
+ - npm install --prefix=$HOME/.local -g pnpm@6.32.4
28
+ <% } %>
29
+ - <%= packageManagerInstall %>
30
+ - <%= packageManagerPrefix %> nx-cloud start-ci-run --stop-agents-after="build" --agent-count=3
31
+ - <%= packageManagerPrefix %> nx-cloud record -- yarn nx format:check
32
+ - <%= packageManagerPrefix %> nx affected --target=lint & <%= packageManagerPrefix %> nx affected --target=test & <%= packageManagerPrefix %> nx affected --target=build
33
+ - <%= packageManagerPrefix %> nx-cloud stop-all-agents
34
+ - step: *agent
35
+ - step: *agent
36
+ - step: *agent
@@ -0,0 +1,73 @@
1
+ version: 2.1
2
+
3
+ orbs:
4
+ nx: nrwl/nx@1.6.1
5
+
6
+ jobs:
7
+ agent:
8
+ docker:
9
+ - image: cimg/node:lts-browsers
10
+ parameters:
11
+ ordinal:
12
+ type: integer
13
+ steps:
14
+ - checkout
15
+ <% if(packageManagerPrefix == 'pnpm exec'){ %>
16
+ - run:
17
+ name: Install PNPM
18
+ command: npm install --prefix=$HOME/.local -g pnpm@6.32.4
19
+ <% } %>- run:
20
+ name: Install dependencies
21
+ command: <%= packageManagerInstall %>
22
+ - run:
23
+ name: Start the agent << parameters.ordinal >>
24
+ command: <%= packageManagerPrefix %> nx-cloud start-agent
25
+ no_output_timeout: 60m
26
+ main:
27
+ docker:
28
+ - image: cimg/node:lts-browsers
29
+ environment:
30
+ NX_CLOUD_DISTRIBUTED_EXECUTION: 'true'
31
+ steps:
32
+ - checkout
33
+ <% if(packageManagerPrefix == 'pnpm exec'){ %>
34
+ - run:
35
+ name: Install PNPM
36
+ command: npm install --prefix=$HOME/.local -g pnpm@6.32.4
37
+ <% } %>- run:
38
+ name: Install dependencies
39
+ command: <%= packageManagerInstall %>
40
+ - nx/set-shas:
41
+ main-branch-name: '<%= mainBranch %>'
42
+ - run:
43
+ name: Initialize the Nx Cloud distributed CI run
44
+ command: <%= packageManagerPrefix %> nx-cloud start-ci-run --stop-agents-after="build" --agent-count=3
45
+ - run:
46
+ name: Check format
47
+ command: <%= packageManagerPrefix %> nx-cloud record -- <%= packageManagerPrefix %> nx format:check --base=$NX_BASE --head=$NX_HEAD
48
+ - run:
49
+ name: Run lint
50
+ command: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=lint --parallel=3
51
+ - run:
52
+ name: Run test
53
+ command: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=test --parallel=3 --ci --code-coverage
54
+ - run:
55
+ name: Run build
56
+ command: <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=build --parallel=3
57
+ - run:
58
+ name: Stop all agents
59
+ command: <%= packageManagerPrefix %> nx-cloud stop-all-agents
60
+ when: always
61
+
62
+ workflows:
63
+ version: 2
64
+
65
+ <%= workflowFileName %>:
66
+ jobs:
67
+ - agent:
68
+ name: Nx Cloud Agent << matrix.ordinal >>
69
+ matrix:
70
+ parameters:
71
+ ordinal: [1, 2, 3]
72
+ - main:
73
+ name: Nx Cloud Main
@@ -0,0 +1,29 @@
1
+ name: <%= workflowName %>
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - <%= mainBranch %>
7
+ pull_request:
8
+
9
+ jobs:
10
+ main:
11
+ name: Nx Cloud - Main Job
12
+ uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.11.3
13
+ with:
14
+ main-branch-name: <%= mainBranch %>
15
+ number-of-agents: 3
16
+ init-commands: |
17
+ <%= packageManagerPrefix %> nx-cloud start-ci-run --stop-agents-after="build" --agent-count=3
18
+ parallel-commands: |
19
+ <%= packageManagerPrefix %> nx-cloud record -- <%= packageManagerPrefix %> nx format:check
20
+ parallel-commands-on-agents: |
21
+ <%= packageManagerPrefix %> nx affected --target=lint --parallel=3
22
+ <%= packageManagerPrefix %> nx affected --target=test --parallel=3 --ci --code-coverage
23
+ <%= packageManagerPrefix %> nx affected --target=build --parallel=3
24
+
25
+ agents:
26
+ name: Nx Cloud - Agents
27
+ uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.11.3
28
+ with:
29
+ number-of-agents: 3
@@ -0,0 +1,47 @@
1
+ image: node:18
2
+ variables:
3
+ CI: 'true'
4
+
5
+ # Creating template for DTE agents
6
+ .dte-agent:
7
+ interruptible: true
8
+ script:
9
+ <% if(packageManagerPrefix == 'pnpm exec'){ %>
10
+ - npm install --prefix=$HOME/.local -g pnpm@6.32.4
11
+ <% } %>
12
+ - <%= packageManagerInstall %>
13
+ - <%= packageManagerPrefix %> nx-cloud start-agent
14
+
15
+ # Creating template for a job running DTE (orchestrator)
16
+ .base-pipeline:
17
+ interruptible: true
18
+ only:
19
+ - main
20
+ - merge_requests
21
+ before_script:
22
+ <% if(packageManagerPrefix == 'pnpm exec'){ %>
23
+ - npm install --prefix=$HOME/.local -g pnpm@6.32.4
24
+ <% } %>
25
+ - <%= packageManagerInstall %>
26
+ - NX_HEAD=$CI_COMMIT_SHA
27
+ - NX_BASE=${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$CI_COMMIT_BEFORE_SHA}
28
+
29
+ # Main job running DTE
30
+ <%= workflowName %>:
31
+ stage: affected
32
+ extends: .base-pipeline
33
+ script:
34
+ - <%= packageManagerPrefix %> nx-cloud start-ci-run --stop-agents-after="build"
35
+ - <%= packageManagerPrefix %> nx-cloud record -- <%= packageManagerPrefix %> nx format:check --base=$NX_BASE --head=$NX_HEAD
36
+ - <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=lint --parallel=3 & <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=test --parallel=3 --ci --code-coverage & <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=e2e --parallel=3 --ci --code-coverage & <%= packageManagerPrefix %> nx affected --base=$NX_BASE --head=$NX_HEAD --target=build --parallel=3
37
+
38
+ # Create as many agents as you want
39
+ nx-dte-agent1:
40
+ extends: .dte-agent
41
+ stage: affected
42
+ nx-dte-agent2:
43
+ extends: .dte-agent
44
+ stage: affected
45
+ nx-dte-agent3:
46
+ extends: .dte-agent
47
+ stage: affected
@@ -0,0 +1,38 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "NxWorkspaceCIWorkflow",
4
+ "title": "Generate a CI workflow.",
5
+ "description": "Generate a CI workflow.",
6
+ "cli": "nx",
7
+ "type": "object",
8
+ "properties": {
9
+ "ci": {
10
+ "type": "string",
11
+ "description": "CI provider.",
12
+ "enum": ["github", "circleci", "azure", "bitbucket-pipelines", "gitlab"],
13
+ "x-prompt": {
14
+ "message": "What is your target CI provider?",
15
+ "type": "list",
16
+ "items": [
17
+ { "value": "github", "label": "GitHub Actions" },
18
+ { "value": "circleci", "label": "Circle CI" },
19
+ { "value": "azure", "label": "Azure DevOps" },
20
+ { "value": "bitbucket-pipelines", "label": "BitBucket Pipelines" },
21
+ { "value": "gitlab", "label": "Gitlab" }
22
+ ]
23
+ }
24
+ },
25
+ "name": {
26
+ "type": "string",
27
+ "description": "Workflow name.",
28
+ "$default": {
29
+ "$source": "argv",
30
+ "index": 0
31
+ },
32
+ "default": "CI",
33
+ "x-prompt": "How should we name your workflow?",
34
+ "pattern": "^[a-zA-Z].*$"
35
+ }
36
+ },
37
+ "required": ["ci"]
38
+ }
@@ -0,0 +1,6 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { Schema } from './schema';
3
+ export declare function validateSchema(schema: Schema, configName: string): Promise<void>;
4
+ export declare function convertToNxProjectGenerator(host: Tree, schema: Schema): Promise<void>;
5
+ export default convertToNxProjectGenerator;
6
+ export declare const convertToNxProjectSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertToNxProjectSchematic = exports.convertToNxProjectGenerator = exports.validateSchema = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const path_1 = require("path");
7
+ const angular_json_1 = require("nx/src/adapter/angular-json");
8
+ const output_1 = require("../../utils/output");
9
+ function validateSchema(schema, configName) {
10
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
+ if (schema.project && schema.all) {
12
+ throw new Error('--project and --all are mutually exclusive');
13
+ }
14
+ if (schema.project && schema.reformat) {
15
+ throw new Error('--project and --reformat are mutually exclusive');
16
+ }
17
+ if (schema.all && schema.reformat) {
18
+ throw new Error('--all and --reformat are mutually exclusive');
19
+ }
20
+ if ((configName === 'workspace.json' && schema.project) ||
21
+ (configName === 'workspace.json' && schema.reformat)) {
22
+ throw new Error('workspace.json is no longer supported. Please pass --all to convert all projects and remove workspace.json.');
23
+ }
24
+ if (!schema.project && !schema.all && !schema.reformat) {
25
+ schema.all = true;
26
+ }
27
+ });
28
+ }
29
+ exports.validateSchema = validateSchema;
30
+ function convertToNxProjectGenerator(host, schema) {
31
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
32
+ const configName = host.exists('angular.json')
33
+ ? 'angular.json'
34
+ : 'workspace.json';
35
+ if (!host.exists(configName))
36
+ return;
37
+ yield validateSchema(schema, configName);
38
+ const projects = (0, angular_json_1.toNewFormat)((0, devkit_1.readJson)(host, configName)).projects;
39
+ const leftOverProjects = {};
40
+ for (const projectName of Object.keys(projects)) {
41
+ const config = projects[projectName];
42
+ if ((!schema.project || schema.project === projectName) &&
43
+ !schema.reformat) {
44
+ if (typeof config === 'string') {
45
+ // configuration is in project.json
46
+ const projectConfig = (0, devkit_1.readJson)(host, (0, path_1.join)(config, 'project.json'));
47
+ if (projectConfig.name !== projectName) {
48
+ projectConfig.name = projectName;
49
+ projectConfig.root = config;
50
+ (0, devkit_1.updateProjectConfiguration)(host, projectName, projectConfig);
51
+ }
52
+ }
53
+ else {
54
+ // configuration is an object in workspace.json
55
+ const path = (0, path_1.join)(config.root, 'project.json');
56
+ if (!host.exists(path)) {
57
+ projects[projectName].name = projectName;
58
+ (0, devkit_1.addProjectConfiguration)(host, path, projects[projectName]);
59
+ }
60
+ }
61
+ }
62
+ else {
63
+ leftOverProjects[projectName] = config;
64
+ }
65
+ }
66
+ if (Object.keys(leftOverProjects).length > 0) {
67
+ (0, devkit_1.writeJson)(host, 'angular.json', (0, angular_json_1.toOldFormat)({ version: 1, projects: leftOverProjects }));
68
+ }
69
+ else {
70
+ host.delete(configName);
71
+ }
72
+ if (!schema.skipFormat) {
73
+ yield (0, devkit_1.formatFiles)(host);
74
+ }
75
+ output_1.output.note({
76
+ title: 'Use "nx show projects" to read the list of projects.',
77
+ bodyLines: [
78
+ `If you read the list of projects from ${configName}, use "nx show projects" instead.`,
79
+ ],
80
+ });
81
+ });
82
+ }
83
+ exports.convertToNxProjectGenerator = convertToNxProjectGenerator;
84
+ exports.default = convertToNxProjectGenerator;
85
+ exports.convertToNxProjectSchematic = (0, devkit_1.convertNxGenerator)(convertToNxProjectGenerator);
86
+ //# sourceMappingURL=convert-to-nx-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert-to-nx-project.js","sourceRoot":"","sources":["../../../../../../packages/workspace/src/generators/convert-to-nx-project/convert-to-nx-project.ts"],"names":[],"mappings":";;;;AAAA,uCAQoB;AACpB,+BAA4B;AAE5B,8DAAuE;AACvE,+CAA4C;AAE5C,SAAsB,cAAc,CAAC,MAAc,EAAE,UAAkB;;QACrE,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,GAAG,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;SAC/D;QAED,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE;YACrC,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACpE;QAED,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE;YACjC,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;SAChE;QAED,IACE,CAAC,UAAU,KAAK,gBAAgB,IAAI,MAAM,CAAC,OAAO,CAAC;YACnD,CAAC,UAAU,KAAK,gBAAgB,IAAI,M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
+
5
+ reformat?: boolean;
6
+ skipFormat?: boolean;
7
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "SchematicsConvertToNxProject",
4
+ "title": "@nrwl/workspace:fix-configuration",
5
+ "description": "Migrates v1 config to v2 standalone configuration.",
6
+ "type": "object",
7
+ "cli": "nx",
8
+ "examples": [
9
+ {
10
+ "command": "nx g @nrwl/workspace:convert-to-nx-project --project my-feature-lib",
11
+ "description": "Convert the `my-feature-lib` project to use `project.json` file instead of `workspace.json`"
12
+ },
13
+ {
14
+ "command": "nx g @nrwl/workspace:convert-to-nx-project --all",
15
+ "description": "Convert all projects in `workspace.json` to separate `project.json` files"
16
+ }
17
+ ],
18
+ "properties": {
19
+ "project": {
20
+ "description": "Convert a single project",
21
+ "type": "string"
22
+ },
23
+ "all": {
24
+ "description": "Convert all projects",
25
+ "type": "boolean"
26
+ },
27
+ "reformat": {
28
+ "description": "Just reformats the configuration",
29
+ "type": "boolean"
30
+ },
31
+ "skipFormat": {
32
+ "description": "Skip formatting files",
33
+ "type": "boolean",
34
+ "default": false,
35
+ "x-priority": "internal"
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,11 @@
1
+ import { ProjectConfiguration, Tree } from '@nx/devkit';
2
+ import { Schema } from '../schema';
3
+ /**
4
+ * Checks whether the destination folder is valid
5
+ *
6
+ * - must not be outside the workspace
7
+ * - must be a new folder
8
+ *
9
+ * @param schema The options provided to the schematic
10
+ */
11
+ export declare function checkDestination(tree: Tree, schema: Schema, projectConfig: ProjectConfiguration): void;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkDestination = void 0;
4
+ const utils_1 = require("./utils");
5
+ /**
6
+ * Checks whether the destination folder is valid
7
+ *
8
+ * - must not be outside the workspace
9
+ * - must be a new folder
10
+ *
11
+ * @param schema The options provided to the schematic
12
+ */
13
+ function checkDestination(tree, schema, projectConfig) {
14
+ const INVALID_DESTINATION = `Invalid destination: [${schema.destination}]`;
15
+ if (schema.destination.includes('..')) {
16
+ throw new Error(`${INVALID_DESTINATION} - Please specify explicit path.`);
17
+ }
18
+ const destination = (0, utils_1.getDestination)(tree, schema, projectConfig);
19
+ if (tree.children(destination).length > 0) {
20
+ throw new Error(`${INVALID_DESTINATION} - Path is not empty.`);
21
+ }
22
+ }
23
+ exports.checkDestination = checkDestination;
24
+ //# sourceMappingURL=check-destination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-destination.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/check-destination.ts"],"names":[],"mappings":";;;AAEA,mCAAyC;AAEzC;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAC9B,IAAU,EACV,MAAc,EACd,aAAmC;IAEnC,MAAM,mBAAmB,GAAG,yBAAyB,MAAM,CAAC,WAAW,GAAG,CAAC;IAE3E,IAAI,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QACrC,MAAM,IAAI,KAAK,CAAC,GAAG,mBAAmB,kCAAkC,CAAC,CAAC;KAC3E;IAED,MAAM,WAAW,GAAG,IAAA,sBAAc,EAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;IAEhE,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;QACzC,MAAM,IAAI,KAAK,CAAC,GAAG,mBAAmB,uBAAuB,CAAC,CAAC;KAChE;AACH,CAAC;AAhBD,4CAgBC"}
@@ -0,0 +1,3 @@
1
+ import { ProjectConfiguration, Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from '../schema';
3
+ export declare function createProjectConfigurationInNewDestination(tree: Tree, schema: NormalizedSchema, projectConfig: ProjectConfiguration): void;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createProjectConfigurationInNewDestination = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ function createProjectConfigurationInNewDestination(tree, schema, projectConfig) {
6
+ if (projectConfig.name) {
7
+ projectConfig.name = schema.newProjectName;
8
+ }
9
+ // replace old root path with new one
10
+ const projectString = JSON.stringify(projectConfig);
11
+ const newProjectString = projectString.replace(new RegExp(projectConfig.root, 'g'), schema.relativeToRootDestination);
12
+ const newProject = JSON.parse(newProjectString);
13
+ // Create a new project with the root replaced
14
+ (0, devkit_1.addProjectConfiguration)(tree, schema.newProjectName, newProject);
15
+ }
16
+ exports.createProjectConfigurationInNewDestination = createProjectConfigurationInNewDestination;
17
+ //# sourceMappingURL=create-project-configuration-in-new-destination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-project-configuration-in-new-destination.js","sourceRoot":"","sources":["../../../../../../../packages/workspace/src/generators/move/lib/create-project-configuration-in-new-destination.ts"],"names":[],"mappings":";;;AAAA,uCAIoB;AAGpB,SAAgB,0CAA0C,CACxD,IAAU,EACV,MAAwB,EACxB,aAAmC;IAEnC,IAAI,aAAa,CAAC,IAAI,EAAE;QACtB,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,cAAc,CAAC;KAC5C;IAED,qCAAqC;IACrC,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IACpD,MAAM,gBAAgB,GAAG,aAAa,CAAC,OAAO,CAC5C,IAAI,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,GAAG,CAAC,EACnC,MAAM,CAAC,yBAAyB,CACjC,CAAC;IACF,MAAM,UAAU,GAAyB,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAEtE,8CAA8C;IAC9C,IAAA,gCAAuB,EAAC,IAAI,EAAE,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;AACnE,CAAC;AAnBD,gGAmBC"}
@@ -0,0 +1,8 @@
1
+ import { ProjectConfiguration, Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from '../schema';
3
+ /**
4
+ * Moves a project to the given destination path
5
+ *
6
+ * @param schema The options provided to the schematic
7
+ */
8
+ export declare function moveProjectFiles(tree: Tree, schema: NormalizedSchema, project: ProjectConfiguration): void;