@contember/create 2.1.0-alpha.8 → 2.1.0-alpha.9

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 (270) hide show
  1. package/dist/development/src/commands/WorkspaceCreateCommand.cjs +36 -23
  2. package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  3. package/dist/development/src/commands/WorkspaceCreateCommand.js +36 -23
  4. package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
  5. package/dist/development/src/lib/TemplateInstaller.cjs +4 -6
  6. package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
  7. package/dist/development/src/lib/TemplateInstaller.js +4 -6
  8. package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
  9. package/dist/development/src/lib/packageManagerDetector.cjs +22 -0
  10. package/dist/development/src/lib/packageManagerDetector.cjs.map +1 -0
  11. package/dist/development/src/lib/packageManagerDetector.js +22 -0
  12. package/dist/development/src/lib/packageManagerDetector.js.map +1 -0
  13. package/dist/production/src/commands/WorkspaceCreateCommand.cjs +36 -23
  14. package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  15. package/dist/production/src/commands/WorkspaceCreateCommand.js +36 -23
  16. package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
  17. package/dist/production/src/lib/TemplateInstaller.cjs +4 -6
  18. package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
  19. package/dist/production/src/lib/TemplateInstaller.js +4 -6
  20. package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
  21. package/dist/production/src/lib/packageManagerDetector.cjs +22 -0
  22. package/dist/production/src/lib/packageManagerDetector.cjs.map +1 -0
  23. package/dist/production/src/lib/packageManagerDetector.js +22 -0
  24. package/dist/production/src/lib/packageManagerDetector.js.map +1 -0
  25. package/dist/types/commands/WorkspaceCreateCommand.d.ts +4 -2
  26. package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
  27. package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
  28. package/dist/types/lib/packageManagerDetector.d.ts +3 -0
  29. package/dist/types/lib/packageManagerDetector.d.ts.map +1 -0
  30. package/dist/types/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +3 -3
  32. package/resources/templates/default/.gitignore.dist +154 -0
  33. package/resources/templates/default/README.md +98 -0
  34. package/resources/templates/{template-workspace → default}/admin/.env.development +1 -0
  35. package/resources/templates/{template-workspace → default}/admin/app/components/layout.tsx +7 -3
  36. package/resources/templates/default/admin/app/components/navigation.tsx +85 -0
  37. package/resources/templates/{template-workspace → default}/admin/app/index.tsx +4 -4
  38. package/resources/templates/default/admin/app/pages/tenant.tsx +160 -0
  39. package/resources/templates/default/admin/entrypoint/components/layout.tsx +14 -0
  40. package/resources/templates/default/admin/entrypoint/components/logged-in.tsx +47 -0
  41. package/resources/templates/default/admin/entrypoint/components/login.tsx +103 -0
  42. package/resources/templates/default/admin/entrypoint/config.ts +35 -0
  43. package/resources/templates/default/admin/entrypoint/contexts/login.tsx +18 -0
  44. package/resources/templates/default/admin/entrypoint/index.tsx +12 -0
  45. package/resources/templates/default/admin/entrypoint/login-entrypoint.tsx +24 -0
  46. package/resources/templates/default/admin/entrypoint/pages/index.tsx +48 -0
  47. package/resources/templates/default/admin/entrypoint/pages/magicLink.tsx +56 -0
  48. package/resources/templates/default/admin/entrypoint/pages/magicLintSent.tsx +63 -0
  49. package/resources/templates/default/admin/entrypoint/pages/passwordReset.tsx +44 -0
  50. package/resources/templates/default/admin/entrypoint/pages/resetRequest.tsx +35 -0
  51. package/resources/templates/default/admin/entrypoint/pages/resetRequestSuccess.tsx +34 -0
  52. package/resources/templates/default/admin/index.css +94 -0
  53. package/resources/templates/{template-workspace → default}/admin/index.html +1 -1
  54. package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/block-repeater.tsx +4 -4
  55. package/resources/templates/{template-workspace → default}/admin/lib/board/board.tsx +3 -3
  56. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-header.tsx +1 -1
  57. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/columns.tsx +8 -8
  58. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/elements.tsx +2 -2
  59. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/empty.tsx +1 -1
  60. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/date.tsx +4 -4
  61. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/relation.tsx +1 -1
  62. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/pagination.tsx +1 -1
  63. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/table.tsx +1 -1
  64. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/ui.tsx +4 -4
  65. package/resources/templates/{template-workspace → default}/admin/lib/dimensions/dimensions.tsx +2 -2
  66. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-block-toolbar.tsx +1 -1
  67. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-canvas.tsx +2 -2
  68. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-inline-toolbar.tsx +1 -1
  69. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/BlockElement.tsx +2 -2
  70. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableCellElementRenderer.tsx +1 -1
  71. package/resources/templates/{template-workspace → default}/admin/lib/editor/editor-block.tsx +1 -1
  72. package/resources/templates/{template-workspace → default}/admin/lib/editor/sortable-block.tsx +1 -1
  73. package/resources/templates/{template-workspace → default}/admin/lib/layout/layout-boxed.tsx +4 -4
  74. package/resources/templates/{template-workspace → default}/admin/lib/repeater/repeater.tsx +3 -3
  75. package/resources/templates/{template-workspace → default}/admin/lib/select/ui.tsx +5 -5
  76. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/common.tsx +1 -1
  77. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/memberships-control.tsx +1 -1
  78. package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/otp-setup.tsx +1 -1
  79. package/resources/templates/{template-workspace → default}/admin/lib/toast/toast.tsx +4 -5
  80. package/resources/templates/{template-workspace → default}/admin/lib/ui/button.tsx +6 -6
  81. package/resources/templates/{template-workspace → default}/admin/lib/ui/card.tsx +1 -1
  82. package/resources/templates/{template-workspace → default}/admin/lib/ui/dialog.tsx +2 -2
  83. package/resources/templates/{template-workspace → default}/admin/lib/ui/dropdown.tsx +6 -6
  84. package/resources/templates/{template-workspace → default}/admin/lib/ui/input.tsx +11 -11
  85. package/resources/templates/{template-workspace → default}/admin/lib/ui/overlay.tsx +1 -1
  86. package/resources/templates/{template-workspace → default}/admin/lib/ui/popover.tsx +1 -1
  87. package/resources/templates/{template-workspace → default}/admin/lib/ui/property-list.tsx +3 -3
  88. package/resources/templates/{template-workspace → default}/admin/lib/ui/select.tsx +3 -3
  89. package/resources/templates/{template-workspace → default}/admin/lib/ui/sheet.tsx +4 -4
  90. package/resources/templates/{template-workspace → default}/admin/lib/ui/sidebar.tsx +14 -14
  91. package/resources/templates/{template-workspace → default}/admin/lib/ui/sortable.tsx +1 -1
  92. package/resources/templates/{template-workspace → default}/admin/lib/ui/switch.tsx +1 -1
  93. package/resources/templates/{template-workspace → default}/admin/lib/ui/table.tsx +3 -3
  94. package/resources/templates/{template-workspace → default}/admin/lib/ui/textarea.tsx +3 -3
  95. package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle.tsx +2 -3
  96. package/resources/templates/{template-workspace → default}/admin/lib/ui/tooltip.tsx +2 -2
  97. package/resources/templates/{template-workspace → default}/admin/lib/upload/ui.tsx +4 -4
  98. package/resources/templates/{template-workspace → default}/admin/lib/upload/upload-progress.tsx +1 -1
  99. package/resources/templates/{template-workspace → default}/admin/lib/upload/view.tsx +3 -3
  100. package/resources/templates/{template-workspace → default}/admin/package.json +5 -2
  101. package/resources/templates/default/admin/postcss.config.js +5 -0
  102. package/resources/templates/default/admin/sentry.ts +26 -0
  103. package/resources/templates/{template-workspace → default}/admin/tsconfig.json +1 -9
  104. package/resources/templates/default/admin/vite-env.d.ts +12 -0
  105. package/resources/templates/default/admin/vite.config.ts +11 -0
  106. package/resources/templates/default/api/README.md +87 -0
  107. package/resources/templates/{template-workspace → default}/biome.json +1 -1
  108. package/resources/templates/default/client/README.md +285 -0
  109. package/resources/templates/{template-workspace → default}/contember.template.yaml +5 -0
  110. package/resources/templates/{template-workspace → default}/package.json +1 -1
  111. package/resources/templates/default/scripts/generate-client.sh +7 -0
  112. package/resources/templates/default/scripts/update-ui-lib.sh +344 -0
  113. package/src/commands/WorkspaceCreateCommand.ts +40 -24
  114. package/src/lib/TemplateInstaller.ts +6 -4
  115. package/src/lib/packageManagerDetector.ts +24 -0
  116. package/resources/templates/template-workspace/.gitignore.dist +0 -3
  117. package/resources/templates/template-workspace/admin/app/components/navigation.tsx +0 -1
  118. package/resources/templates/template-workspace/admin/index.css +0 -53
  119. package/resources/templates/template-workspace/admin/index.tsx +0 -268
  120. package/resources/templates/template-workspace/admin/postcss.config.js +0 -6
  121. package/resources/templates/template-workspace/admin/tailwind.config.js +0 -73
  122. package/resources/templates/template-workspace/admin/vite-env.d.ts +0 -7
  123. package/resources/templates/template-workspace/scripts/generate-client.sh +0 -8
  124. /package/resources/templates/{template-workspace → default}/.github/scripts/setup-actions-variables.sh +0 -0
  125. /package/resources/templates/{template-workspace → default}/.github/workflows/deploy.yaml +0 -0
  126. /package/resources/templates/{template-workspace → default}/admin/app/components/logo.tsx +0 -0
  127. /package/resources/templates/{template-workspace → default}/admin/app/config.ts +0 -0
  128. /package/resources/templates/{template-workspace → default}/admin/app/index.html +0 -0
  129. /package/resources/templates/{template-workspace → default}/admin/app/pages/index.tsx +0 -0
  130. /package/resources/templates/{template-workspace → default}/admin/lib/binding/binding.tsx +0 -0
  131. /package/resources/templates/{template-workspace → default}/admin/lib/binding/delete.tsx +0 -0
  132. /package/resources/templates/{template-workspace → default}/admin/lib/binding/hooks.tsx +0 -0
  133. /package/resources/templates/{template-workspace → default}/admin/lib/binding/identity.tsx +0 -0
  134. /package/resources/templates/{template-workspace → default}/admin/lib/binding/index.ts +0 -0
  135. /package/resources/templates/{template-workspace → default}/admin/lib/binding/navigation-guard-dialog.tsx +0 -0
  136. /package/resources/templates/{template-workspace → default}/admin/lib/binding/persist.tsx +0 -0
  137. /package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/index.ts +0 -0
  138. /package/resources/templates/{template-workspace → default}/admin/lib/board/index.ts +0 -0
  139. /package/resources/templates/{template-workspace → default}/admin/lib/buttons/back-button.tsx +0 -0
  140. /package/resources/templates/{template-workspace → default}/admin/lib/buttons/index.ts +0 -0
  141. /package/resources/templates/{template-workspace → default}/admin/lib/buttons/link-back-button.tsx +0 -0
  142. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/cells.tsx +0 -0
  143. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-leaf.tsx +0 -0
  144. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/export.tsx +0 -0
  145. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/boolean.tsx +0 -0
  146. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/common.tsx +0 -0
  147. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/defined.tsx +0 -0
  148. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/enum.tsx +0 -0
  149. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/index.ts +0 -0
  150. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/mobile.tsx +0 -0
  151. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/number.tsx +0 -0
  152. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/text.tsx +0 -0
  153. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/grid.tsx +0 -0
  154. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/index.ts +0 -0
  155. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/labels.tsx +0 -0
  156. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/layout-switcher.tsx +0 -0
  157. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/loader.tsx +0 -0
  158. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/tiles.tsx +0 -0
  159. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/toolbar.tsx +0 -0
  160. /package/resources/templates/{template-workspace → default}/admin/lib/dev/index.ts +0 -0
  161. /package/resources/templates/{template-workspace → default}/admin/lib/dev/login-panel.tsx +0 -0
  162. /package/resources/templates/{template-workspace → default}/admin/lib/dev/todo.tsx +0 -0
  163. /package/resources/templates/{template-workspace → default}/admin/lib/dict.ts +0 -0
  164. /package/resources/templates/{template-workspace → default}/admin/lib/dimensions/index.ts +0 -0
  165. /package/resources/templates/{template-workspace → default}/admin/lib/editor/block-editor.tsx +0 -0
  166. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/baseEditorPlugins.tsx +0 -0
  167. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/buttons.tsx +0 -0
  168. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-editable-canvas.tsx +0 -0
  169. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/AnchorRenderer.tsx +0 -0
  170. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HeadingRenderer.tsx +0 -0
  171. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +0 -0
  172. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ListItemRenderer.tsx +0 -0
  173. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/OrderedListRenderer.tsx +0 -0
  174. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ParagraphRenderer.tsx +0 -0
  175. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ScrollTargetRenderer.tsx +0 -0
  176. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableElementRenderer.tsx +0 -0
  177. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableRowElementRenderer.tsx +0 -0
  178. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +0 -0
  179. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/index.ts +0 -0
  180. /package/resources/templates/{template-workspace → default}/admin/lib/editor/index.ts +0 -0
  181. /package/resources/templates/{template-workspace → default}/admin/lib/editor/plugins.tsx +0 -0
  182. /package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text-view.tsx +0 -0
  183. /package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text.tsx +0 -0
  184. /package/resources/templates/{template-workspace → default}/admin/lib/errors/error-boundary.tsx +0 -0
  185. /package/resources/templates/{template-workspace → default}/admin/lib/errors/index.ts +0 -0
  186. /package/resources/templates/{template-workspace → default}/admin/lib/errors/use-error-formatter.ts +0 -0
  187. /package/resources/templates/{template-workspace → default}/admin/lib/field/formatted-field.tsx +0 -0
  188. /package/resources/templates/{template-workspace → default}/admin/lib/field/index.ts +0 -0
  189. /package/resources/templates/{template-workspace → default}/admin/lib/form/container.tsx +0 -0
  190. /package/resources/templates/{template-workspace → default}/admin/lib/form/index.ts +0 -0
  191. /package/resources/templates/{template-workspace → default}/admin/lib/form/inputs.tsx +0 -0
  192. /package/resources/templates/{template-workspace → default}/admin/lib/form/labels.tsx +0 -0
  193. /package/resources/templates/{template-workspace → default}/admin/lib/form/select.tsx +0 -0
  194. /package/resources/templates/{template-workspace → default}/admin/lib/form/ui.tsx +0 -0
  195. /package/resources/templates/{template-workspace → default}/admin/lib/form/upload-repeaters.tsx +0 -0
  196. /package/resources/templates/{template-workspace → default}/admin/lib/form/upload.tsx +0 -0
  197. /package/resources/templates/{template-workspace → default}/admin/lib/formatting/formatting.ts +0 -0
  198. /package/resources/templates/{template-workspace → default}/admin/lib/formatting/index.ts +0 -0
  199. /package/resources/templates/{template-workspace → default}/admin/lib/images/formatImageResizeUrl.ts +0 -0
  200. /package/resources/templates/{template-workspace → default}/admin/lib/images/index.ts +0 -0
  201. /package/resources/templates/{template-workspace → default}/admin/lib/labels/enum-labels.ts +0 -0
  202. /package/resources/templates/{template-workspace → default}/admin/lib/labels/field-labels.ts +0 -0
  203. /package/resources/templates/{template-workspace → default}/admin/lib/labels/index.ts +0 -0
  204. /package/resources/templates/{template-workspace → default}/admin/lib/layout/index.ts +0 -0
  205. /package/resources/templates/{template-workspace → default}/admin/lib/layout/layout.tsx +0 -0
  206. /package/resources/templates/{template-workspace → default}/admin/lib/layout/slots.tsx +0 -0
  207. /package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/index.ts +0 -0
  208. /package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +0 -0
  209. /package/resources/templates/{template-workspace → default}/admin/lib/repeater/index.ts +0 -0
  210. /package/resources/templates/{template-workspace → default}/admin/lib/select/create-new.tsx +0 -0
  211. /package/resources/templates/{template-workspace → default}/admin/lib/select/filter.tsx +0 -0
  212. /package/resources/templates/{template-workspace → default}/admin/lib/select/highlight.tsx +0 -0
  213. /package/resources/templates/{template-workspace → default}/admin/lib/select/index.ts +0 -0
  214. /package/resources/templates/{template-workspace → default}/admin/lib/select/list.tsx +0 -0
  215. /package/resources/templates/{template-workspace → default}/admin/lib/select/multi-select.tsx +0 -0
  216. /package/resources/templates/{template-workspace → default}/admin/lib/select/select.tsx +0 -0
  217. /package/resources/templates/{template-workspace → default}/admin/lib/select/sortable-select.tsx +0 -0
  218. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/change-my-password.tsx +0 -0
  219. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/create-api-key.tsx +0 -0
  220. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/index.ts +0 -0
  221. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/invite.tsx +0 -0
  222. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/login.tsx +0 -0
  223. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset-request.tsx +0 -0
  224. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset.tsx +0 -0
  225. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin-init.tsx +0 -0
  226. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin.tsx +0 -0
  227. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/update-project-member.tsx +0 -0
  228. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInvite.ts +0 -0
  229. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInviteUser.tsx +0 -0
  230. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/index.ts +0 -0
  231. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/api-key-list.tsx +0 -0
  232. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/index.ts +0 -0
  233. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-delete-dialog.tsx +0 -0
  234. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-list.tsx +0 -0
  235. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/person-list.tsx +0 -0
  236. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/index.ts +0 -0
  237. /package/resources/templates/{template-workspace → default}/admin/lib/toast/index.ts +0 -0
  238. /package/resources/templates/{template-workspace → default}/admin/lib/toast/toaster.tsx +0 -0
  239. /package/resources/templates/{template-workspace → default}/admin/lib/ui/alert-dialog.tsx +0 -0
  240. /package/resources/templates/{template-workspace → default}/admin/lib/ui/avatar.tsx +0 -0
  241. /package/resources/templates/{template-workspace → default}/admin/lib/ui/collapsible.tsx +0 -0
  242. /package/resources/templates/{template-workspace → default}/admin/lib/ui/divider.tsx +0 -0
  243. /package/resources/templates/{template-workspace → default}/admin/lib/ui/label.tsx +0 -0
  244. /package/resources/templates/{template-workspace → default}/admin/lib/ui/loader.tsx +0 -0
  245. /package/resources/templates/{template-workspace → default}/admin/lib/ui/menu.tsx +0 -0
  246. /package/resources/templates/{template-workspace → default}/admin/lib/ui/progress.tsx +0 -0
  247. /package/resources/templates/{template-workspace → default}/admin/lib/ui/scroll-area.tsx +0 -0
  248. /package/resources/templates/{template-workspace → default}/admin/lib/ui/separator.tsx +0 -0
  249. /package/resources/templates/{template-workspace → default}/admin/lib/ui/skeleton.tsx +0 -0
  250. /package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle-group.tsx +0 -0
  251. /package/resources/templates/{template-workspace → default}/admin/lib/upload/dropzone.tsx +0 -0
  252. /package/resources/templates/{template-workspace → default}/admin/lib/upload/index.ts +0 -0
  253. /package/resources/templates/{template-workspace → default}/admin/lib/upload/repeater.tsx +0 -0
  254. /package/resources/templates/{template-workspace → default}/admin/lib/utils/cn.ts +0 -0
  255. /package/resources/templates/{template-workspace → default}/admin/lib/utils/createComponentOpenHooks.tsx +0 -0
  256. /package/resources/templates/{template-workspace → default}/admin/lib/utils/index.ts +0 -0
  257. /package/resources/templates/{template-workspace → default}/admin/lib/utils/uic.tsx +0 -0
  258. /package/resources/templates/{template-workspace → default}/admin/lib/utils/use-mobile.ts +0 -0
  259. /package/resources/templates/{template-workspace → default}/admin/public/favicon.png +0 -0
  260. /package/resources/templates/{template-workspace → default}/api/index.ts +0 -0
  261. /package/resources/templates/{template-workspace → default}/api/migrations/.gitkeep +0 -0
  262. /package/resources/templates/{template-workspace → default}/api/model/index.ts +0 -0
  263. /package/resources/templates/{template-workspace → default}/api/package.json +0 -0
  264. /package/resources/templates/{template-workspace → default}/api/tsconfig.json +0 -0
  265. /package/resources/templates/{template-workspace → default}/client/package.json +0 -0
  266. /package/resources/templates/{template-workspace → default}/client/src/index.ts +0 -0
  267. /package/resources/templates/{template-workspace → default}/client/tsconfig.json +0 -0
  268. /package/resources/templates/{template-workspace → default}/docker-compose.yaml +0 -0
  269. /package/resources/templates/{template-workspace → default}/tsconfig.json +0 -0
  270. /package/resources/templates/{template-workspace → default}/tsconfig.settings.json +0 -0
@@ -4,47 +4,60 @@ const cliCommon = require("@contember/cli-common");
4
4
  const node_path = require("node:path");
5
5
  const chalk = require("chalk");
6
6
  const version = require("../lib/version.cjs");
7
+ const packageManagerDetector = require("../lib/packageManagerDetector.cjs");
7
8
  class WorkspaceCreateCommand extends cliCommon.Command {
8
9
  constructor(templateInstaller) {
9
10
  super();
10
11
  this.templateInstaller = templateInstaller;
11
12
  }
12
13
  configure(configuration) {
13
- configuration.description("Creates a new Contember workspace");
14
- configuration.argument("workspaceName");
14
+ configuration.description("Creates a new Contember project");
15
+ configuration.argument("projectName");
16
+ configuration.option("template").shortcut("t");
15
17
  }
16
18
  async execute(input) {
17
- const workspaceName = input.getArgument("workspaceName");
18
- const workspaceDirectory = node_path.join(process.cwd(), workspaceName);
19
- await this.templateInstaller.installTemplate("@contember/template-workspace", workspaceDirectory, {
19
+ const projectName = input.getArgument("projectName");
20
+ const projectDirectory = node_path.join(process.cwd(), projectName);
21
+ const packageManager = packageManagerDetector.detectPackageManager();
22
+ await this.templateInstaller.installTemplate(input.getOption("template") ?? "default", projectDirectory, {
20
23
  version: await version.getPackageVersion(),
21
- projectName: workspaceName
24
+ projectName,
25
+ packageManager
22
26
  });
23
- console.log(createDocs(workspaceDirectory, workspaceName));
27
+ console.log(createDocs(projectDirectory, projectName, packageManager));
24
28
  }
25
29
  }
26
- const createDocs = (workspaceDirectory, workspaceName) => `
27
- Contember workspace was successfully created inside the directory ${workspaceDirectory}
30
+ const createDocs = (projectDirectory, projectName, packageManager) => `
31
+ Contember project successfully created in ${projectDirectory}
28
32
 
29
- You can now enter this directory:
30
- $ ${chalk.greenBright(`cd ${workspaceName}`)}
33
+ Next steps:
31
34
 
32
- Install NPM dependencies:
33
- $ ${chalk.greenBright(`yarn install`)}
35
+ 1. Navigate to the project directory:
36
+ $ ${chalk.green(`cd ${projectName}`)}
34
37
 
35
- And start the Contember stack:
36
- $ ${chalk.greenBright("yarn start")}
38
+ 2. Install dependencies:
39
+ $ ${chalk.green(`${packageManager} install`)}
37
40
 
38
- The following services will be accessible:
41
+ 3. Start the Contember stack:
42
+ $ ${chalk.green(`${packageManager} start`)}
39
43
 
40
- - Contember Admin at http://localhost:1480
41
- - Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)
42
- - Adminer database management tool at http://localhost:1485
43
- - Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)
44
- - MailHog testing SMTP at http://localhost:1484
45
- - PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)
44
+ Available services:
46
45
 
47
- If you have any issues or questions, just ask here: https://github.com/contember/engine/discussions
46
+ ${chalk.bold("UI & Admin")}
47
+ - Contember Admin ${chalk.blue("http://localhost:1480")}
48
+
49
+ ${chalk.bold("API & Backend")}
50
+ - Contember Engine API ${chalk.blue("http://localhost:1481")}
51
+ Auth token: 0000000000000000000000000000000000000000
52
+
53
+ ${chalk.bold("Development Tools")}
54
+ - PostgreSQL database ${chalk.blue("http://localhost:1482")} ${chalk.grey("credentials: contember / contember")}
55
+ - Minio S3 storage ${chalk.blue("http://localhost:1483")}
56
+ - Mailpit SMTP testing ${chalk.blue("http://localhost:1484")}
57
+ - Adminer DB manager ${chalk.blue("http://localhost:1485")}
58
+ - Minio Dashboard ${chalk.blue("http://localhost:1486")} ${chalk.grey("credentials: contember / contember")}
59
+
60
+ ${chalk.bold("Need help?")} Ask the community: https://github.com/orgs/contember/discussions
48
61
  `;
49
62
  exports.WorkspaceCreateCommand = WorkspaceCreateCommand;
50
63
  //# sourceMappingURL=WorkspaceCreateCommand.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"WorkspaceCreateCommand.cjs","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\n\ntype Args = {\n\tworkspaceName: string\n}\n\ntype Options = {\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember workspace')\n\t\tconfiguration.argument('workspaceName')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst workspaceName = input.getArgument('workspaceName')\n\t\tconst workspaceDirectory = join(process.cwd(), workspaceName)\n\t\tawait this.templateInstaller.installTemplate('@contember/template-workspace', workspaceDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: workspaceName,\n\t\t})\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(workspaceDirectory, workspaceName))\n\t}\n}\n\nconst createDocs = (workspaceDirectory: string, workspaceName: string) => `\nContember workspace was successfully created inside the directory ${workspaceDirectory}\n\nYou can now enter this directory:\n$ ${chalk.greenBright(`cd ${workspaceName}`)}\n\nInstall NPM dependencies:\n$ ${chalk.greenBright(`yarn install`)}\n\nAnd start the Contember stack:\n$ ${chalk.greenBright('yarn start')}\n\nThe following services will be accessible:\n\n- Contember Admin at http://localhost:1480\n- Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)\n- Adminer database management tool at http://localhost:1485\n- Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)\n- MailHog testing SMTP at http://localhost:1484\n- PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)\n\nIf you have any issues or questions, just ask here: https://github.com/contember/engine/discussions\n`\n"],"names":["Command","join","getPackageVersion"],"mappings":";;;;;;AAaO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACK,UAAA;AAFW,SAAA,oBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,mCAAmC;AAC7D,kBAAc,SAAS,eAAe;AAAA,EAAA;AAAA,EAGvC,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,gBAAgB,MAAM,YAAY,eAAe;AACvD,UAAM,qBAAqBC,UAAA,KAAK,QAAQ,IAAA,GAAO,aAAa;AAC5D,UAAM,KAAK,kBAAkB,gBAAgB,iCAAiC,oBAAoB;AAAA,MACjG,SAAS,MAAMC,QAAAA,kBAAkB;AAAA,MACjC,aAAa;AAAA,IAAA,CACb;AAED,YAAQ,IAAI,WAAW,oBAAoB,aAAa,CAAC;AAAA,EAAA;AAE3D;AAEA,MAAM,aAAa,CAAC,oBAA4B,kBAA0B;AAAA,oEACN,kBAAkB;AAAA;AAAA;AAAA,IAGlF,MAAM,YAAY,MAAM,aAAa,EAAE,CAAC;AAAA;AAAA;AAAA,IAGxC,MAAM,YAAY,cAAc,CAAC;AAAA;AAAA;AAAA,IAGjC,MAAM,YAAY,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;"}
1
+ {"version":3,"file":"WorkspaceCreateCommand.cjs","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\nimport { detectPackageManager } from '../lib/packageManagerDetector'\n\ntype Args = {\n\tprojectName: string\n}\n\ntype Options = {\n\ttemplate: string\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember project')\n\t\tconfiguration.argument('projectName')\n\t\tconfiguration.option('template').shortcut('t')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst projectName = input.getArgument('projectName')\n\t\tconst projectDirectory = join(process.cwd(), projectName)\n\t\tconst packageManager = detectPackageManager()\n\n\t\tawait this.templateInstaller.installTemplate(input.getOption('template') ?? 'default', projectDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: projectName,\n\t\t\tpackageManager: packageManager,\n\t\t})\n\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(projectDirectory, projectName, packageManager))\n\t}\n}\n\nconst createDocs = (projectDirectory: string, projectName: string, packageManager: string) => `\nContember project successfully created in ${projectDirectory}\n\nNext steps:\n\n1. Navigate to the project directory:\n $ ${chalk.green(`cd ${projectName}`)}\n\n2. Install dependencies:\n $ ${chalk.green(`${packageManager} install`)}\n\n3. Start the Contember stack:\n $ ${chalk.green(`${packageManager} start`)}\n\nAvailable services:\n\n${chalk.bold('UI & Admin')}\n- Contember Admin ${chalk.blue('http://localhost:1480')}\n\n${chalk.bold('API & Backend')}\n- Contember Engine API ${chalk.blue('http://localhost:1481')}\n Auth token: 0000000000000000000000000000000000000000\n\n${chalk.bold('Development Tools')}\n- PostgreSQL database ${chalk.blue('http://localhost:1482')} ${chalk.grey('credentials: contember / contember')}\n- Minio S3 storage ${chalk.blue('http://localhost:1483')}\n- Mailpit SMTP testing ${chalk.blue('http://localhost:1484')}\n- Adminer DB manager ${chalk.blue('http://localhost:1485')}\n- Minio Dashboard ${chalk.blue('http://localhost:1486')} ${chalk.grey('credentials: contember / contember')}\n\n${chalk.bold('Need help?')} Ask the community: https://github.com/orgs/contember/discussions\n`\n"],"names":["Command","join","detectPackageManager","getPackageVersion"],"mappings":";;;;;;;AAeO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACK,UAAA;AAFW,SAAA,oBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,iCAAiC;AAC3D,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A;AAAA,EAEpH,MAAM,KAAK,YAAY,CAAC;AAAA;;"}
@@ -2,47 +2,60 @@ import { Command } from "@contember/cli-common";
2
2
  import { join } from "node:path";
3
3
  import chalk from "chalk";
4
4
  import { getPackageVersion } from "../lib/version.js";
5
+ import { detectPackageManager } from "../lib/packageManagerDetector.js";
5
6
  class WorkspaceCreateCommand extends Command {
6
7
  constructor(templateInstaller) {
7
8
  super();
8
9
  this.templateInstaller = templateInstaller;
9
10
  }
10
11
  configure(configuration) {
11
- configuration.description("Creates a new Contember workspace");
12
- configuration.argument("workspaceName");
12
+ configuration.description("Creates a new Contember project");
13
+ configuration.argument("projectName");
14
+ configuration.option("template").shortcut("t");
13
15
  }
14
16
  async execute(input) {
15
- const workspaceName = input.getArgument("workspaceName");
16
- const workspaceDirectory = join(process.cwd(), workspaceName);
17
- await this.templateInstaller.installTemplate("@contember/template-workspace", workspaceDirectory, {
17
+ const projectName = input.getArgument("projectName");
18
+ const projectDirectory = join(process.cwd(), projectName);
19
+ const packageManager = detectPackageManager();
20
+ await this.templateInstaller.installTemplate(input.getOption("template") ?? "default", projectDirectory, {
18
21
  version: await getPackageVersion(),
19
- projectName: workspaceName
22
+ projectName,
23
+ packageManager
20
24
  });
21
- console.log(createDocs(workspaceDirectory, workspaceName));
25
+ console.log(createDocs(projectDirectory, projectName, packageManager));
22
26
  }
23
27
  }
24
- const createDocs = (workspaceDirectory, workspaceName) => `
25
- Contember workspace was successfully created inside the directory ${workspaceDirectory}
28
+ const createDocs = (projectDirectory, projectName, packageManager) => `
29
+ Contember project successfully created in ${projectDirectory}
26
30
 
27
- You can now enter this directory:
28
- $ ${chalk.greenBright(`cd ${workspaceName}`)}
31
+ Next steps:
29
32
 
30
- Install NPM dependencies:
31
- $ ${chalk.greenBright(`yarn install`)}
33
+ 1. Navigate to the project directory:
34
+ $ ${chalk.green(`cd ${projectName}`)}
32
35
 
33
- And start the Contember stack:
34
- $ ${chalk.greenBright("yarn start")}
36
+ 2. Install dependencies:
37
+ $ ${chalk.green(`${packageManager} install`)}
35
38
 
36
- The following services will be accessible:
39
+ 3. Start the Contember stack:
40
+ $ ${chalk.green(`${packageManager} start`)}
37
41
 
38
- - Contember Admin at http://localhost:1480
39
- - Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)
40
- - Adminer database management tool at http://localhost:1485
41
- - Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)
42
- - MailHog testing SMTP at http://localhost:1484
43
- - PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)
42
+ Available services:
44
43
 
45
- If you have any issues or questions, just ask here: https://github.com/contember/engine/discussions
44
+ ${chalk.bold("UI & Admin")}
45
+ - Contember Admin ${chalk.blue("http://localhost:1480")}
46
+
47
+ ${chalk.bold("API & Backend")}
48
+ - Contember Engine API ${chalk.blue("http://localhost:1481")}
49
+ Auth token: 0000000000000000000000000000000000000000
50
+
51
+ ${chalk.bold("Development Tools")}
52
+ - PostgreSQL database ${chalk.blue("http://localhost:1482")} ${chalk.grey("credentials: contember / contember")}
53
+ - Minio S3 storage ${chalk.blue("http://localhost:1483")}
54
+ - Mailpit SMTP testing ${chalk.blue("http://localhost:1484")}
55
+ - Adminer DB manager ${chalk.blue("http://localhost:1485")}
56
+ - Minio Dashboard ${chalk.blue("http://localhost:1486")} ${chalk.grey("credentials: contember / contember")}
57
+
58
+ ${chalk.bold("Need help?")} Ask the community: https://github.com/orgs/contember/discussions
46
59
  `;
47
60
  export {
48
61
  WorkspaceCreateCommand
@@ -1 +1 @@
1
- {"version":3,"file":"WorkspaceCreateCommand.js","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\n\ntype Args = {\n\tworkspaceName: string\n}\n\ntype Options = {\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember workspace')\n\t\tconfiguration.argument('workspaceName')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst workspaceName = input.getArgument('workspaceName')\n\t\tconst workspaceDirectory = join(process.cwd(), workspaceName)\n\t\tawait this.templateInstaller.installTemplate('@contember/template-workspace', workspaceDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: workspaceName,\n\t\t})\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(workspaceDirectory, workspaceName))\n\t}\n}\n\nconst createDocs = (workspaceDirectory: string, workspaceName: string) => `\nContember workspace was successfully created inside the directory ${workspaceDirectory}\n\nYou can now enter this directory:\n$ ${chalk.greenBright(`cd ${workspaceName}`)}\n\nInstall NPM dependencies:\n$ ${chalk.greenBright(`yarn install`)}\n\nAnd start the Contember stack:\n$ ${chalk.greenBright('yarn start')}\n\nThe following services will be accessible:\n\n- Contember Admin at http://localhost:1480\n- Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)\n- Adminer database management tool at http://localhost:1485\n- Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)\n- MailHog testing SMTP at http://localhost:1484\n- PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)\n\nIf you have any issues or questions, just ask here: https://github.com/contember/engine/discussions\n`\n"],"names":[],"mappings":";;;;AAaO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACK,UAAA;AAFW,SAAA,oBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,mCAAmC;AAC7D,kBAAc,SAAS,eAAe;AAAA,EAAA;AAAA,EAGvC,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,gBAAgB,MAAM,YAAY,eAAe;AACvD,UAAM,qBAAqB,KAAK,QAAQ,IAAA,GAAO,aAAa;AAC5D,UAAM,KAAK,kBAAkB,gBAAgB,iCAAiC,oBAAoB;AAAA,MACjG,SAAS,MAAM,kBAAkB;AAAA,MACjC,aAAa;AAAA,IAAA,CACb;AAED,YAAQ,IAAI,WAAW,oBAAoB,aAAa,CAAC;AAAA,EAAA;AAE3D;AAEA,MAAM,aAAa,CAAC,oBAA4B,kBAA0B;AAAA,oEACN,kBAAkB;AAAA;AAAA;AAAA,IAGlF,MAAM,YAAY,MAAM,aAAa,EAAE,CAAC;AAAA;AAAA;AAAA,IAGxC,MAAM,YAAY,cAAc,CAAC;AAAA;AAAA;AAAA,IAGjC,MAAM,YAAY,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"WorkspaceCreateCommand.js","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\nimport { detectPackageManager } from '../lib/packageManagerDetector'\n\ntype Args = {\n\tprojectName: string\n}\n\ntype Options = {\n\ttemplate: string\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember project')\n\t\tconfiguration.argument('projectName')\n\t\tconfiguration.option('template').shortcut('t')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst projectName = input.getArgument('projectName')\n\t\tconst projectDirectory = join(process.cwd(), projectName)\n\t\tconst packageManager = detectPackageManager()\n\n\t\tawait this.templateInstaller.installTemplate(input.getOption('template') ?? 'default', projectDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: projectName,\n\t\t\tpackageManager: packageManager,\n\t\t})\n\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(projectDirectory, projectName, packageManager))\n\t}\n}\n\nconst createDocs = (projectDirectory: string, projectName: string, packageManager: string) => `\nContember project successfully created in ${projectDirectory}\n\nNext steps:\n\n1. Navigate to the project directory:\n $ ${chalk.green(`cd ${projectName}`)}\n\n2. Install dependencies:\n $ ${chalk.green(`${packageManager} install`)}\n\n3. Start the Contember stack:\n $ ${chalk.green(`${packageManager} start`)}\n\nAvailable services:\n\n${chalk.bold('UI & Admin')}\n- Contember Admin ${chalk.blue('http://localhost:1480')}\n\n${chalk.bold('API & Backend')}\n- Contember Engine API ${chalk.blue('http://localhost:1481')}\n Auth token: 0000000000000000000000000000000000000000\n\n${chalk.bold('Development Tools')}\n- PostgreSQL database ${chalk.blue('http://localhost:1482')} ${chalk.grey('credentials: contember / contember')}\n- Minio S3 storage ${chalk.blue('http://localhost:1483')}\n- Mailpit SMTP testing ${chalk.blue('http://localhost:1484')}\n- Adminer DB manager ${chalk.blue('http://localhost:1485')}\n- Minio Dashboard ${chalk.blue('http://localhost:1486')} ${chalk.grey('credentials: contember / contember')}\n\n${chalk.bold('Need help?')} Ask the community: https://github.com/orgs/contember/discussions\n`\n"],"names":[],"mappings":";;;;;AAeO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACK,UAAA;AAFW,SAAA,oBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,iCAAiC;AAC3D,kBAAc,SAAS,aAAa;AACpC,kBAAc,OAAO,UAAU,EAAE,SAAS,GAAG;AAAA,EAAA;AAAA,EAG9C,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,cAAc,MAAM,YAAY,aAAa;AACnD,UAAM,mBAAmB,KAAK,QAAQ,IAAA,GAAO,WAAW;AACxD,UAAM,iBAAiB,qBAAqB;AAEtC,UAAA,KAAK,kBAAkB,gBAAgB,MAAM,UAAU,UAAU,KAAK,WAAW,kBAAkB;AAAA,MACxG,SAAS,MAAM,kBAAkB;AAAA,MACjC;AAAA,MACA;AAAA,IAAA,CACA;AAGD,YAAQ,IAAI,WAAW,kBAAkB,aAAa,cAAc,CAAC;AAAA,EAAA;AAEvE;AAEA,MAAM,aAAa,CAAC,kBAA0B,aAAqB,mBAA2B;AAAA,4CAClD,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,OAKrD,MAAM,MAAM,MAAM,WAAW,EAAE,CAAC;AAAA;AAAA;AAAA,OAGhC,MAAM,MAAM,GAAG,cAAc,UAAU,CAAC;AAAA;AAAA;AAAA,OAGxC,MAAM,MAAM,GAAG,cAAc,QAAQ,CAAC;AAAA;AAAA;AAAA;AAAA,EAI3C,MAAM,KAAK,YAAY,CAAC;AAAA,4BACE,MAAM,KAAK,uBAAuB,CAAC;AAAA;AAAA,EAE7D,MAAM,KAAK,eAAe,CAAC;AAAA,4BACD,MAAM,KAAK,uBAAuB,CAAC;AAAA;AAAA;AAAA,EAG7D,MAAM,KAAK,mBAAmB,CAAC;AAAA,4BACL,MAAM,KAAK,uBAAuB,CAAC,OAAO,MAAM,KAAK,oCAAoC,CAAC;AAAA,4BAC1F,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC,OAAO,MAAM,KAAK,oCAAoC,CAAC;AAAA;AAAA,EAEpH,MAAM,KAAK,YAAY,CAAC;AAAA;"}
@@ -9,12 +9,8 @@ class TemplateInstaller {
9
9
  constructor(resourceDir, fs) {
10
10
  this.resourceDir = resourceDir;
11
11
  this.fs = fs;
12
- __publicField(this, "localTemplates", {
13
- ["@contember/template-workspace"]: node_path.join(this.resourceDir, "templates/template-workspace")
14
- });
12
+ __publicField(this, "localTemplates");
15
13
  __publicField(this, "installTemplate", async (template, targetDir, variables = {}) => {
16
- let removeTemplate = () => {
17
- };
18
14
  if (this.localTemplates[template]) {
19
15
  template = this.localTemplates[template];
20
16
  }
@@ -31,7 +27,6 @@ class TemplateInstaller {
31
27
  await this.fs.copy(template, targetDir, {
32
28
  filter: (src) => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src)
33
29
  });
34
- await removeTemplate();
35
30
  if (config.patchPackageJson) {
36
31
  await this.replaceFileContent(node_path.join(targetDir, "package.json"), (content) => {
37
32
  const {
@@ -74,6 +69,9 @@ class TemplateInstaller {
74
69
  const content = await this.fs.readFile(path, { encoding: "utf8" });
75
70
  return jsyaml.load(content);
76
71
  });
72
+ this.localTemplates = {
73
+ ["default"]: node_path.join(this.resourceDir, "templates/default")
74
+ };
77
75
  }
78
76
  }
79
77
  exports.TemplateInstaller = TemplateInstaller;
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateInstaller.cjs","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\n\n\nexport class TemplateInstaller {\n\n\tprivate localTemplates: Record<string, string> = {\n\t\t['@contember/template-workspace']: join(this.resourceDir, 'templates/template-workspace'),\n\t}\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t}\n\n\tinstallTemplate = async (\n\t\ttemplate: string,\n\t\ttargetDir: string,\n\t\tvariables: Record<string, string> = {},\n\t) => {\n\t\tlet removeTemplate = () => {\n\t\t}\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t}\n\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tthrow `${template} is not a Contember template`\n\t\t}\n\t\tconst config = (await this.readYaml(templateConfigFile)) as {\n\t\t\ttype?: string\n\t\t\tremove?: string[]\n\t\t\tpatchPackageJson?: boolean\n\t\t\trename?: Record<string, string>\n\t\t\tcopy?: Record<string, string>\n\t\t\treplaceVariables?: string[]\n\t\t}\n\t\tconst nodeModulesDir = join(template, 'node_modules')\n\t\tconst skippedFiles = new Set([...(config.remove || []).map(it => join(template, it)), templateConfigFile])\n\t\tif (await this.fs.pathExists(targetDir)) {\n\t\t\tthrow `${targetDir} already exists`\n\t\t}\n\t\tawait this.fs.copy(template, targetDir, {\n\t\t\tfilter: src => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src),\n\t\t})\n\t\tawait removeTemplate()\n\n\t\tif (config.patchPackageJson) {\n\t\t\tawait this.replaceFileContent(join(targetDir, 'package.json'), content => {\n\t\t\t\tconst {\n\t\t\t\t\tname,\n\t\t\t\t\tversion,\n\t\t\t\t\t'scripts-template': scripts,\n\t\t\t\t\tscripts: _nullScripts,\n\t\t\t\t\tlicense,\n\t\t\t\t\t...json\n\t\t\t\t} = JSON.parse(content)\n\t\t\t\treturn JSON.stringify({ scripts, ...json }, null, ' ')\n\t\t\t})\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.rename || {})) {\n\t\t\tawait this.fs.rename(join(targetDir, source), join(targetDir, target))\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.copy || {})) {\n\t\t\tawait this.fs.copy(join(targetDir, source), join(targetDir, target))\n\t\t}\n\n\t\tfor (const file of config.replaceVariables || []) {\n\t\t\tconst path = join(targetDir, file)\n\t\t\tif (!(await this.fs.pathExists(path))) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tawait this.replaceFileContent(path, content =>\n\t\t\t\tObject.entries(variables).reduce(\n\t\t\t\t\t(content, [key, value]) => content.replace(new RegExp(`\\{${key}\\}`, 'g'), value),\n\t\t\t\t\tcontent,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\t}\n\n\tprivate replaceFileContent = async (path: string, replacer: (content: string) => string): Promise<void> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\tconst newContent = replacer(content)\n\t\tawait this.fs.writeFile(path, newContent, { encoding: 'utf8' })\n\t}\n\n\tprivate readYaml = async <T = unknown>(path: string): Promise<T> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\treturn jsyaml.load(content) as unknown as T\n\t}\n}\n"],"names":["join","content"],"mappings":";;;;;;;AAKO,MAAM,kBAAkB;AAAA,EAM9B,YACkB,aACA,IAChB;AAFgB,SAAA,cAAA;AACA,SAAA,KAAA;AANlB,kBAAA,MAAQ,kBAAyC;AAAA,MAChD,CAAC,+BAA+B,GAAGA,UAAAA,KAAK,KAAK,aAAa,8BAA8B;AAAA,IAAA,CACzF;AAQA,kBAAA,MAAA,mBAAkB,OACjB,UACA,WACA,YAAoC,OAChC;AACJ,UAAI,iBAAiB,MAAM;AAAA,MAC3B;AACI,UAAA,KAAK,eAAe,QAAQ,GAAG;AACvB,mBAAA,KAAK,eAAe,QAAQ;AAAA,MAAA;AAGlC,YAAA,qBAAqBA,UAAAA,KAAK,UAAU,yBAAyB;AACnE,UAAI,CAAE,MAAM,KAAK,GAAG,WAAW,kBAAkB,GAAI;AACpD,cAAM,GAAG,QAAQ;AAAA,MAAA;AAElB,YAAM,SAAU,MAAM,KAAK,SAAS,kBAAkB;AAQhD,YAAA,iBAAiBA,UAAAA,KAAK,UAAU,cAAc;AACpD,YAAM,eAAmB,oBAAA,IAAI,CAAC,IAAI,OAAO,UAAU,CAAI,GAAA,IAAI,QAAMA,UAAAA,KAAK,UAAU,EAAE,CAAC,GAAG,kBAAkB,CAAC;AACzG,UAAI,MAAM,KAAK,GAAG,WAAW,SAAS,GAAG;AACxC,cAAM,GAAG,SAAS;AAAA,MAAA;AAEnB,YAAM,KAAK,GAAG,KAAK,UAAU,WAAW;AAAA,QACvC,QAAQ,CAAO,QAAA,CAAC,IAAI,WAAW,cAAc,KAAK,CAAC,aAAa,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M,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AAC3D,YAAA,aAAa,SAAS,OAAO;AAC7B,YAAA,KAAK,GAAG,UAAU,MAAM,YAAY,EAAE,UAAU,QAAQ;AAAA,IAAA,CAC/D;AAEQ,kBAAA,MAAA,YAAW,OAAoB,SAA6B;AAC7D,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AAC1D,aAAA,OAAO,KAAK,OAAO;AAAA,IAAA,CAC3B;AAAA,EAAA;AACD;;"}
1
+ {"version":3,"file":"TemplateInstaller.cjs","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\n\n\nexport class TemplateInstaller {\n\n\tprivate localTemplates: Record<string, string>\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t\tthis.localTemplates = {\n\t\t\t['default']: join(this.resourceDir, 'templates/default'),\n\t\t}\n\t}\n\n\tinstallTemplate = async (\n\t\ttemplate: string,\n\t\ttargetDir: string,\n\t\tvariables: Record<string, string> = {},\n\t) => {\n\t\tlet removeTemplate = () => {\n\t\t}\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t}\n\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tthrow `${template} is not a Contember template`\n\t\t}\n\t\tconst config = (await this.readYaml(templateConfigFile)) as {\n\t\t\ttype?: string\n\t\t\tremove?: string[]\n\t\t\tpatchPackageJson?: boolean\n\t\t\trename?: Record<string, string>\n\t\t\tcopy?: Record<string, string>\n\t\t\treplaceVariables?: string[]\n\t\t}\n\t\tconst nodeModulesDir = join(template, 'node_modules')\n\t\tconst skippedFiles = new Set([...(config.remove || []).map(it => join(template, it)), templateConfigFile])\n\t\tif (await this.fs.pathExists(targetDir)) {\n\t\t\tthrow `${targetDir} already exists`\n\t\t}\n\t\tawait this.fs.copy(template, targetDir, {\n\t\t\tfilter: src => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src),\n\t\t})\n\n\t\tremoveTemplate()\n\n\t\tif (config.patchPackageJson) {\n\t\t\tawait this.replaceFileContent(join(targetDir, 'package.json'), content => {\n\t\t\t\tconst {\n\t\t\t\t\tname,\n\t\t\t\t\tversion,\n\t\t\t\t\t'scripts-template': scripts,\n\t\t\t\t\tscripts: _nullScripts,\n\t\t\t\t\tlicense,\n\t\t\t\t\t...json\n\t\t\t\t} = JSON.parse(content)\n\t\t\t\treturn JSON.stringify({ scripts, ...json }, null, ' ')\n\t\t\t})\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.rename || {})) {\n\t\t\tawait this.fs.rename(join(targetDir, source), join(targetDir, target))\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.copy || {})) {\n\t\t\tawait this.fs.copy(join(targetDir, source), join(targetDir, target))\n\t\t}\n\n\t\tfor (const file of config.replaceVariables || []) {\n\t\t\tconst path = join(targetDir, file)\n\t\t\tif (!(await this.fs.pathExists(path))) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tawait this.replaceFileContent(path, content =>\n\t\t\t\tObject.entries(variables).reduce(\n\t\t\t\t\t(content, [key, value]) => content.replace(new RegExp(`\\{${key}\\}`, 'g'), value),\n\t\t\t\t\tcontent,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\t}\n\n\tprivate replaceFileContent = async (path: string, replacer: (content: string) => string): Promise<void> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\tconst newContent = replacer(content)\n\t\tawait this.fs.writeFile(path, newContent, { encoding: 'utf8' })\n\t}\n\n\tprivate readYaml = async <T = unknown>(path: string): Promise<T> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\treturn jsyaml.load(content) as unknown as T\n\t}\n}\n"],"names":["join","content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,IACxD;AAAA,EAAA;AAiFF;;"}
@@ -7,12 +7,8 @@ class TemplateInstaller {
7
7
  constructor(resourceDir, fs) {
8
8
  this.resourceDir = resourceDir;
9
9
  this.fs = fs;
10
- __publicField(this, "localTemplates", {
11
- ["@contember/template-workspace"]: join(this.resourceDir, "templates/template-workspace")
12
- });
10
+ __publicField(this, "localTemplates");
13
11
  __publicField(this, "installTemplate", async (template, targetDir, variables = {}) => {
14
- let removeTemplate = () => {
15
- };
16
12
  if (this.localTemplates[template]) {
17
13
  template = this.localTemplates[template];
18
14
  }
@@ -29,7 +25,6 @@ class TemplateInstaller {
29
25
  await this.fs.copy(template, targetDir, {
30
26
  filter: (src) => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src)
31
27
  });
32
- await removeTemplate();
33
28
  if (config.patchPackageJson) {
34
29
  await this.replaceFileContent(join(targetDir, "package.json"), (content) => {
35
30
  const {
@@ -72,6 +67,9 @@ class TemplateInstaller {
72
67
  const content = await this.fs.readFile(path, { encoding: "utf8" });
73
68
  return jsyaml__default.load(content);
74
69
  });
70
+ this.localTemplates = {
71
+ ["default"]: join(this.resourceDir, "templates/default")
72
+ };
75
73
  }
76
74
  }
77
75
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateInstaller.js","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\n\n\nexport class TemplateInstaller {\n\n\tprivate localTemplates: Record<string, string> = {\n\t\t['@contember/template-workspace']: join(this.resourceDir, 'templates/template-workspace'),\n\t}\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t}\n\n\tinstallTemplate = async (\n\t\ttemplate: string,\n\t\ttargetDir: string,\n\t\tvariables: Record<string, string> = {},\n\t) => {\n\t\tlet removeTemplate = () => {\n\t\t}\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t}\n\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tthrow `${template} is not a Contember template`\n\t\t}\n\t\tconst config = (await this.readYaml(templateConfigFile)) as {\n\t\t\ttype?: string\n\t\t\tremove?: string[]\n\t\t\tpatchPackageJson?: boolean\n\t\t\trename?: Record<string, string>\n\t\t\tcopy?: Record<string, string>\n\t\t\treplaceVariables?: string[]\n\t\t}\n\t\tconst nodeModulesDir = join(template, 'node_modules')\n\t\tconst skippedFiles = new Set([...(config.remove || []).map(it => join(template, it)), templateConfigFile])\n\t\tif (await this.fs.pathExists(targetDir)) {\n\t\t\tthrow `${targetDir} already exists`\n\t\t}\n\t\tawait this.fs.copy(template, targetDir, {\n\t\t\tfilter: src => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src),\n\t\t})\n\t\tawait removeTemplate()\n\n\t\tif (config.patchPackageJson) {\n\t\t\tawait this.replaceFileContent(join(targetDir, 'package.json'), content => {\n\t\t\t\tconst {\n\t\t\t\t\tname,\n\t\t\t\t\tversion,\n\t\t\t\t\t'scripts-template': scripts,\n\t\t\t\t\tscripts: _nullScripts,\n\t\t\t\t\tlicense,\n\t\t\t\t\t...json\n\t\t\t\t} = JSON.parse(content)\n\t\t\t\treturn JSON.stringify({ scripts, ...json }, null, ' ')\n\t\t\t})\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.rename || {})) {\n\t\t\tawait this.fs.rename(join(targetDir, source), join(targetDir, target))\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.copy || {})) {\n\t\t\tawait this.fs.copy(join(targetDir, source), join(targetDir, target))\n\t\t}\n\n\t\tfor (const file of config.replaceVariables || []) {\n\t\t\tconst path = join(targetDir, file)\n\t\t\tif (!(await this.fs.pathExists(path))) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tawait this.replaceFileContent(path, content =>\n\t\t\t\tObject.entries(variables).reduce(\n\t\t\t\t\t(content, [key, value]) => content.replace(new RegExp(`\\{${key}\\}`, 'g'), value),\n\t\t\t\t\tcontent,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\t}\n\n\tprivate replaceFileContent = async (path: string, replacer: (content: string) => string): Promise<void> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\tconst newContent = replacer(content)\n\t\tawait this.fs.writeFile(path, newContent, { encoding: 'utf8' })\n\t}\n\n\tprivate readYaml = async <T = unknown>(path: string): Promise<T> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\treturn jsyaml.load(content) as unknown as T\n\t}\n}\n"],"names":["content","jsyaml"],"mappings":";;;;;AAKO,MAAM,kBAAkB;AAAA,EAM9B,YACkB,aACA,IAChB;AAFgB,SAAA,cAAA;AACA,SAAA,KAAA;AANlB,kBAAA,MAAQ,kBAAyC;AAAA,MAChD,CAAC,+BAA+B,GAAG,KAAK,KAAK,aAAa,8BAA8B;AAAA,IAAA,CACzF;AAQA,kBAAA,MAAA,mBAAkB,OACjB,UACA,WACA,YAAoC,OAChC;AACJ,UAAI,iBAAiB,MAAM;AAAA,MAC3B;AACI,UAAA,KAAK,eAAe,QAAQ,GAAG;AACvB,mBAAA,KAAK,eAAe,QAAQ;AAAA,MAAA;AAGlC,YAAA,qBAAqB,KAAK,UAAU,yBAAyB;AACnE,UAAI,CAAE,MAAM,KAAK,GAAG,WAAW,kBAAkB,GAAI;AACpD,cAAM,GAAG,QAAQ;AAAA,MAAA;AAElB,YAAM,SAAU,MAAM,KAAK,SAAS,kBAAkB;AAQhD,YAAA,iBAAiB,KAAK,UAAU,cAAc;AACpD,YAAM,eAAmB,oBAAA,IAAI,CAAC,IAAI,OAAO,UAAU,CAAI,GAAA,IAAI,QAAM,KAAK,UAAU,EAAE,CAAC,GAAG,kBAAkB,CAAC;AACzG,UAAI,MAAM,KAAK,GAAG,WAAW,SAAS,GAAG;AACxC,cAAM,GAAG,SAAS;AAAA,MAAA;AAEnB,Y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,CACD;AAEQ,kBAAA,MAAA,sBAAqB,OAAO,MAAc,aAAyD;AACpG,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AAC3D,YAAA,aAAa,SAAS,OAAO;AAC7B,YAAA,KAAK,GAAG,UAAU,MAAM,YAAY,EAAE,UAAU,QAAQ;AAAA,IAAA,CAC/D;AAEQ,kBAAA,MAAA,YAAW,OAAoB,SAA6B;AAC7D,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AAC1D,aAAAC,gBAAO,KAAK,OAAO;AAAA,IAAA,CAC3B;AAAA,EAAA;AACD;"}
1
+ {"version":3,"file":"TemplateInstaller.js","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\n\n\nexport class TemplateInstaller {\n\n\tprivate localTemplates: Record<string, string>\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t\tthis.localTemplates = {\n\t\t\t['default']: join(this.resourceDir, 'templates/default'),\n\t\t}\n\t}\n\n\tinstallTemplate = async (\n\t\ttemplate: string,\n\t\ttargetDir: string,\n\t\tvariables: Record<string, string> = {},\n\t) => {\n\t\tlet removeTemplate = () => {\n\t\t}\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t}\n\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tthrow `${template} is not a Contember template`\n\t\t}\n\t\tconst config = (await this.readYaml(templateConfigFile)) as {\n\t\t\ttype?: string\n\t\t\tremove?: string[]\n\t\t\tpatchPackageJson?: boolean\n\t\t\trename?: Record<string, string>\n\t\t\tcopy?: Record<string, string>\n\t\t\treplaceVariables?: string[]\n\t\t}\n\t\tconst nodeModulesDir = join(template, 'node_modules')\n\t\tconst skippedFiles = new Set([...(config.remove || []).map(it => join(template, it)), templateConfigFile])\n\t\tif (await this.fs.pathExists(targetDir)) {\n\t\t\tthrow `${targetDir} already exists`\n\t\t}\n\t\tawait this.fs.copy(template, targetDir, {\n\t\t\tfilter: src => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src),\n\t\t})\n\n\t\tremoveTemplate()\n\n\t\tif (config.patchPackageJson) {\n\t\t\tawait this.replaceFileContent(join(targetDir, 'package.json'), content => {\n\t\t\t\tconst {\n\t\t\t\t\tname,\n\t\t\t\t\tversion,\n\t\t\t\t\t'scripts-template': scripts,\n\t\t\t\t\tscripts: _nullScripts,\n\t\t\t\t\tlicense,\n\t\t\t\t\t...json\n\t\t\t\t} = JSON.parse(content)\n\t\t\t\treturn JSON.stringify({ scripts, ...json }, null, ' ')\n\t\t\t})\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.rename || {})) {\n\t\t\tawait this.fs.rename(join(targetDir, source), join(targetDir, target))\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.copy || {})) {\n\t\t\tawait this.fs.copy(join(targetDir, source), join(targetDir, target))\n\t\t}\n\n\t\tfor (const file of config.replaceVariables || []) {\n\t\t\tconst path = join(targetDir, file)\n\t\t\tif (!(await this.fs.pathExists(path))) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tawait this.replaceFileContent(path, content =>\n\t\t\t\tObject.entries(variables).reduce(\n\t\t\t\t\t(content, [key, value]) => content.replace(new RegExp(`\\{${key}\\}`, 'g'), value),\n\t\t\t\t\tcontent,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\t}\n\n\tprivate replaceFileContent = async (path: string, replacer: (content: string) => string): Promise<void> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\tconst newContent = replacer(content)\n\t\tawait this.fs.writeFile(path, newContent, { encoding: 'utf8' })\n\t}\n\n\tprivate readYaml = async <T = unknown>(path: string): Promise<T> => {\n\t\tconst content = await this.fs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mBAAmB;AAAA,IACxD;AAAA,EAAA;AAiFF;"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const node_fs = require("node:fs");
4
+ const node_path = require("node:path");
5
+ const detectPackageManager = () => {
6
+ const userAgent = process.env.npm_config_user_agent;
7
+ if (userAgent) {
8
+ if (userAgent.startsWith("yarn/")) return "yarn";
9
+ if (userAgent.startsWith("pnpm/")) return "pnpm";
10
+ if (userAgent.startsWith("npm/")) return "npm";
11
+ if (userAgent.startsWith("bun/")) return "bun";
12
+ }
13
+ const cwd = process.cwd();
14
+ if (node_fs.existsSync(node_path.join(cwd, "yarn.lock"))) return "yarn";
15
+ if (node_fs.existsSync(node_path.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
16
+ if (node_fs.existsSync(node_path.join(cwd, "package-lock.json"))) return "npm";
17
+ if (node_fs.existsSync(node_path.join(cwd, "bun.lockb"))) return "bun";
18
+ if (node_fs.existsSync(node_path.join(cwd, "bun.lock"))) return "bun";
19
+ return "npm";
20
+ };
21
+ exports.detectPackageManager = detectPackageManager;
22
+ //# sourceMappingURL=packageManagerDetector.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageManagerDetector.cjs","sources":["../../../../../packages/create/src/lib/packageManagerDetector.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { join } from 'node:path'\n\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun'\n\nexport const detectPackageManager = (): PackageManager => {\n\tconst userAgent = process.env.npm_config_user_agent\n\n\tif (userAgent) {\n\t\tif (userAgent.startsWith('yarn/')) return 'yarn'\n\t\tif (userAgent.startsWith('pnpm/')) return 'pnpm'\n\t\tif (userAgent.startsWith('npm/')) return 'npm'\n\t\tif (userAgent.startsWith('bun/')) return 'bun'\n\t}\n\n\tconst cwd = process.cwd()\n\tif (existsSync(join(cwd, 'yarn.lock'))) return 'yarn'\n\tif (existsSync(join(cwd, 'pnpm-lock.yaml'))) return 'pnpm'\n\tif (existsSync(join(cwd, 'package-lock.json'))) return 'npm'\n\tif (existsSync(join(cwd, 'bun.lockb'))) return 'bun'\n\tif (existsSync(join(cwd, 'bun.lock'))) return 'bun'\n\n\treturn 'npm'\n}\n"],"names":["existsSync","join"],"mappings":";;;;AAKO,MAAM,uBAAuB,MAAsB;AACnD,QAAA,YAAY,QAAQ,IAAI;AAE9B,MAAI,WAAW;AACd,QAAI,UAAU,WAAW,OAAO,EAAU,QAAA;AAC1C,QAAI,UAAU,WAAW,OAAO,EAAU,QAAA;AAC1C,QAAI,UAAU,WAAW,MAAM,EAAU,QAAA;AACzC,QAAI,UAAU,WAAW,MAAM,EAAU,QAAA;AAAA,EAAA;AAGpC,QAAA,MAAM,QAAQ,IAAI;AACxB,MAAIA,QAAAA,WAAWC,UAAAA,KAAK,KAAK,WAAW,CAAC,EAAU,QAAA;AAC/C,MAAID,QAAAA,WAAWC,UAAAA,KAAK,KAAK,gBAAgB,CAAC,EAAU,QAAA;AACpD,MAAID,QAAAA,WAAWC,UAAAA,KAAK,KAAK,mBAAmB,CAAC,EAAU,QAAA;AACvD,MAAID,QAAAA,WAAWC,UAAAA,KAAK,KAAK,WAAW,CAAC,EAAU,QAAA;AAC/C,MAAID,QAAAA,WAAWC,UAAAA,KAAK,KAAK,UAAU,CAAC,EAAU,QAAA;AAEvC,SAAA;AACR;;"}
@@ -0,0 +1,22 @@
1
+ import { existsSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ const detectPackageManager = () => {
4
+ const userAgent = process.env.npm_config_user_agent;
5
+ if (userAgent) {
6
+ if (userAgent.startsWith("yarn/")) return "yarn";
7
+ if (userAgent.startsWith("pnpm/")) return "pnpm";
8
+ if (userAgent.startsWith("npm/")) return "npm";
9
+ if (userAgent.startsWith("bun/")) return "bun";
10
+ }
11
+ const cwd = process.cwd();
12
+ if (existsSync(join(cwd, "yarn.lock"))) return "yarn";
13
+ if (existsSync(join(cwd, "pnpm-lock.yaml"))) return "pnpm";
14
+ if (existsSync(join(cwd, "package-lock.json"))) return "npm";
15
+ if (existsSync(join(cwd, "bun.lockb"))) return "bun";
16
+ if (existsSync(join(cwd, "bun.lock"))) return "bun";
17
+ return "npm";
18
+ };
19
+ export {
20
+ detectPackageManager
21
+ };
22
+ //# sourceMappingURL=packageManagerDetector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageManagerDetector.js","sources":["../../../../../packages/create/src/lib/packageManagerDetector.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { join } from 'node:path'\n\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun'\n\nexport const detectPackageManager = (): PackageManager => {\n\tconst userAgent = process.env.npm_config_user_agent\n\n\tif (userAgent) {\n\t\tif (userAgent.startsWith('yarn/')) return 'yarn'\n\t\tif (userAgent.startsWith('pnpm/')) return 'pnpm'\n\t\tif (userAgent.startsWith('npm/')) return 'npm'\n\t\tif (userAgent.startsWith('bun/')) return 'bun'\n\t}\n\n\tconst cwd = process.cwd()\n\tif (existsSync(join(cwd, 'yarn.lock'))) return 'yarn'\n\tif (existsSync(join(cwd, 'pnpm-lock.yaml'))) return 'pnpm'\n\tif (existsSync(join(cwd, 'package-lock.json'))) return 'npm'\n\tif (existsSync(join(cwd, 'bun.lockb'))) return 'bun'\n\tif (existsSync(join(cwd, 'bun.lock'))) return 'bun'\n\n\treturn 'npm'\n}\n"],"names":[],"mappings":";;AAKO,MAAM,uBAAuB,MAAsB;AACnD,QAAA,YAAY,QAAQ,IAAI;AAE9B,MAAI,WAAW;AACd,QAAI,UAAU,WAAW,OAAO,EAAU,QAAA;AAC1C,QAAI,UAAU,WAAW,OAAO,EAAU,QAAA;AAC1C,QAAI,UAAU,WAAW,MAAM,EAAU,QAAA;AACzC,QAAI,UAAU,WAAW,MAAM,EAAU,QAAA;AAAA,EAAA;AAGpC,QAAA,MAAM,QAAQ,IAAI;AACxB,MAAI,WAAW,KAAK,KAAK,WAAW,CAAC,EAAU,QAAA;AAC/C,MAAI,WAAW,KAAK,KAAK,gBAAgB,CAAC,EAAU,QAAA;AACpD,MAAI,WAAW,KAAK,KAAK,mBAAmB,CAAC,EAAU,QAAA;AACvD,MAAI,WAAW,KAAK,KAAK,WAAW,CAAC,EAAU,QAAA;AAC/C,MAAI,WAAW,KAAK,KAAK,UAAU,CAAC,EAAU,QAAA;AAEvC,SAAA;AACR;"}
@@ -4,47 +4,60 @@ const cliCommon = require("@contember/cli-common");
4
4
  const node_path = require("node:path");
5
5
  const chalk = require("chalk");
6
6
  const version = require("../lib/version.cjs");
7
+ const packageManagerDetector = require("../lib/packageManagerDetector.cjs");
7
8
  class WorkspaceCreateCommand extends cliCommon.Command {
8
9
  constructor(templateInstaller) {
9
10
  super();
10
11
  this.templateInstaller = templateInstaller;
11
12
  }
12
13
  configure(configuration) {
13
- configuration.description("Creates a new Contember workspace");
14
- configuration.argument("workspaceName");
14
+ configuration.description("Creates a new Contember project");
15
+ configuration.argument("projectName");
16
+ configuration.option("template").shortcut("t");
15
17
  }
16
18
  async execute(input) {
17
- const workspaceName = input.getArgument("workspaceName");
18
- const workspaceDirectory = node_path.join(process.cwd(), workspaceName);
19
- await this.templateInstaller.installTemplate("@contember/template-workspace", workspaceDirectory, {
19
+ const projectName = input.getArgument("projectName");
20
+ const projectDirectory = node_path.join(process.cwd(), projectName);
21
+ const packageManager = packageManagerDetector.detectPackageManager();
22
+ await this.templateInstaller.installTemplate(input.getOption("template") ?? "default", projectDirectory, {
20
23
  version: await version.getPackageVersion(),
21
- projectName: workspaceName
24
+ projectName,
25
+ packageManager
22
26
  });
23
- console.log(createDocs(workspaceDirectory, workspaceName));
27
+ console.log(createDocs(projectDirectory, projectName, packageManager));
24
28
  }
25
29
  }
26
- const createDocs = (workspaceDirectory, workspaceName) => `
27
- Contember workspace was successfully created inside the directory ${workspaceDirectory}
30
+ const createDocs = (projectDirectory, projectName, packageManager) => `
31
+ Contember project successfully created in ${projectDirectory}
28
32
 
29
- You can now enter this directory:
30
- $ ${chalk.greenBright(`cd ${workspaceName}`)}
33
+ Next steps:
31
34
 
32
- Install NPM dependencies:
33
- $ ${chalk.greenBright(`yarn install`)}
35
+ 1. Navigate to the project directory:
36
+ $ ${chalk.green(`cd ${projectName}`)}
34
37
 
35
- And start the Contember stack:
36
- $ ${chalk.greenBright("yarn start")}
38
+ 2. Install dependencies:
39
+ $ ${chalk.green(`${packageManager} install`)}
37
40
 
38
- The following services will be accessible:
41
+ 3. Start the Contember stack:
42
+ $ ${chalk.green(`${packageManager} start`)}
39
43
 
40
- - Contember Admin at http://localhost:1480
41
- - Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)
42
- - Adminer database management tool at http://localhost:1485
43
- - Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)
44
- - MailHog testing SMTP at http://localhost:1484
45
- - PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)
44
+ Available services:
46
45
 
47
- If you have any issues or questions, just ask here: https://github.com/contember/engine/discussions
46
+ ${chalk.bold("UI & Admin")}
47
+ - Contember Admin ${chalk.blue("http://localhost:1480")}
48
+
49
+ ${chalk.bold("API & Backend")}
50
+ - Contember Engine API ${chalk.blue("http://localhost:1481")}
51
+ Auth token: 0000000000000000000000000000000000000000
52
+
53
+ ${chalk.bold("Development Tools")}
54
+ - PostgreSQL database ${chalk.blue("http://localhost:1482")} ${chalk.grey("credentials: contember / contember")}
55
+ - Minio S3 storage ${chalk.blue("http://localhost:1483")}
56
+ - Mailpit SMTP testing ${chalk.blue("http://localhost:1484")}
57
+ - Adminer DB manager ${chalk.blue("http://localhost:1485")}
58
+ - Minio Dashboard ${chalk.blue("http://localhost:1486")} ${chalk.grey("credentials: contember / contember")}
59
+
60
+ ${chalk.bold("Need help?")} Ask the community: https://github.com/orgs/contember/discussions
48
61
  `;
49
62
  exports.WorkspaceCreateCommand = WorkspaceCreateCommand;
50
63
  //# sourceMappingURL=WorkspaceCreateCommand.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"WorkspaceCreateCommand.cjs","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\n\ntype Args = {\n\tworkspaceName: string\n}\n\ntype Options = {\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember workspace')\n\t\tconfiguration.argument('workspaceName')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst workspaceName = input.getArgument('workspaceName')\n\t\tconst workspaceDirectory = join(process.cwd(), workspaceName)\n\t\tawait this.templateInstaller.installTemplate('@contember/template-workspace', workspaceDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: workspaceName,\n\t\t})\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(workspaceDirectory, workspaceName))\n\t}\n}\n\nconst createDocs = (workspaceDirectory: string, workspaceName: string) => `\nContember workspace was successfully created inside the directory ${workspaceDirectory}\n\nYou can now enter this directory:\n$ ${chalk.greenBright(`cd ${workspaceName}`)}\n\nInstall NPM dependencies:\n$ ${chalk.greenBright(`yarn install`)}\n\nAnd start the Contember stack:\n$ ${chalk.greenBright('yarn start')}\n\nThe following services will be accessible:\n\n- Contember Admin at http://localhost:1480\n- Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)\n- Adminer database management tool at http://localhost:1485\n- Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)\n- MailHog testing SMTP at http://localhost:1484\n- PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)\n\nIf you have any issues or questions, just ask here: https://github.com/contember/engine/discussions\n`\n"],"names":["Command","join","getPackageVersion"],"mappings":";;;;;;AAaO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACK,UAAA;AAFW,SAAA,oBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,mCAAmC;AAC7D,kBAAc,SAAS,eAAe;AAAA,EAAA;AAAA,EAGvC,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,gBAAgB,MAAM,YAAY,eAAe;AACvD,UAAM,qBAAqBC,UAAA,KAAK,QAAQ,IAAA,GAAO,aAAa;AAC5D,UAAM,KAAK,kBAAkB,gBAAgB,iCAAiC,oBAAoB;AAAA,MACjG,SAAS,MAAMC,QAAAA,kBAAkB;AAAA,MACjC,aAAa;AAAA,IAAA,CACb;AAED,YAAQ,IAAI,WAAW,oBAAoB,aAAa,CAAC;AAAA,EAAA;AAE3D;AAEA,MAAM,aAAa,CAAC,oBAA4B,kBAA0B;AAAA,oEACN,kBAAkB;AAAA;AAAA;AAAA,IAGlF,MAAM,YAAY,MAAM,aAAa,EAAE,CAAC;AAAA;AAAA;AAAA,IAGxC,MAAM,YAAY,cAAc,CAAC;AAAA;AAAA;AAAA,IAGjC,MAAM,YAAY,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;"}
1
+ {"version":3,"file":"WorkspaceCreateCommand.cjs","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\nimport { detectPackageManager } from '../lib/packageManagerDetector'\n\ntype Args = {\n\tprojectName: string\n}\n\ntype Options = {\n\ttemplate: string\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember project')\n\t\tconfiguration.argument('projectName')\n\t\tconfiguration.option('template').shortcut('t')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst projectName = input.getArgument('projectName')\n\t\tconst projectDirectory = join(process.cwd(), projectName)\n\t\tconst packageManager = detectPackageManager()\n\n\t\tawait this.templateInstaller.installTemplate(input.getOption('template') ?? 'default', projectDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: projectName,\n\t\t\tpackageManager: packageManager,\n\t\t})\n\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(projectDirectory, projectName, packageManager))\n\t}\n}\n\nconst createDocs = (projectDirectory: string, projectName: string, packageManager: string) => `\nContember project successfully created in ${projectDirectory}\n\nNext steps:\n\n1. Navigate to the project directory:\n $ ${chalk.green(`cd ${projectName}`)}\n\n2. Install dependencies:\n $ ${chalk.green(`${packageManager} install`)}\n\n3. Start the Contember stack:\n $ ${chalk.green(`${packageManager} start`)}\n\nAvailable services:\n\n${chalk.bold('UI & Admin')}\n- Contember Admin ${chalk.blue('http://localhost:1480')}\n\n${chalk.bold('API & Backend')}\n- Contember Engine API ${chalk.blue('http://localhost:1481')}\n Auth token: 0000000000000000000000000000000000000000\n\n${chalk.bold('Development Tools')}\n- PostgreSQL database ${chalk.blue('http://localhost:1482')} ${chalk.grey('credentials: contember / contember')}\n- Minio S3 storage ${chalk.blue('http://localhost:1483')}\n- Mailpit SMTP testing ${chalk.blue('http://localhost:1484')}\n- Adminer DB manager ${chalk.blue('http://localhost:1485')}\n- Minio Dashboard ${chalk.blue('http://localhost:1486')} ${chalk.grey('credentials: contember / contember')}\n\n${chalk.bold('Need help?')} Ask the community: https://github.com/orgs/contember/discussions\n`\n"],"names":["Command","join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AAC;AAAA,4BAC1F,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC,OAAO,MAAM,KAAK,oCAAoC,CAAC;AAAA;AAAA,EAEpH,MAAM,KAAK,YAAY,CAAC;AAAA;;"}
@@ -2,47 +2,60 @@ import { Command } from "@contember/cli-common";
2
2
  import { join } from "node:path";
3
3
  import chalk from "chalk";
4
4
  import { getPackageVersion } from "../lib/version.js";
5
+ import { detectPackageManager } from "../lib/packageManagerDetector.js";
5
6
  class WorkspaceCreateCommand extends Command {
6
7
  constructor(templateInstaller) {
7
8
  super();
8
9
  this.templateInstaller = templateInstaller;
9
10
  }
10
11
  configure(configuration) {
11
- configuration.description("Creates a new Contember workspace");
12
- configuration.argument("workspaceName");
12
+ configuration.description("Creates a new Contember project");
13
+ configuration.argument("projectName");
14
+ configuration.option("template").shortcut("t");
13
15
  }
14
16
  async execute(input) {
15
- const workspaceName = input.getArgument("workspaceName");
16
- const workspaceDirectory = join(process.cwd(), workspaceName);
17
- await this.templateInstaller.installTemplate("@contember/template-workspace", workspaceDirectory, {
17
+ const projectName = input.getArgument("projectName");
18
+ const projectDirectory = join(process.cwd(), projectName);
19
+ const packageManager = detectPackageManager();
20
+ await this.templateInstaller.installTemplate(input.getOption("template") ?? "default", projectDirectory, {
18
21
  version: await getPackageVersion(),
19
- projectName: workspaceName
22
+ projectName,
23
+ packageManager
20
24
  });
21
- console.log(createDocs(workspaceDirectory, workspaceName));
25
+ console.log(createDocs(projectDirectory, projectName, packageManager));
22
26
  }
23
27
  }
24
- const createDocs = (workspaceDirectory, workspaceName) => `
25
- Contember workspace was successfully created inside the directory ${workspaceDirectory}
28
+ const createDocs = (projectDirectory, projectName, packageManager) => `
29
+ Contember project successfully created in ${projectDirectory}
26
30
 
27
- You can now enter this directory:
28
- $ ${chalk.greenBright(`cd ${workspaceName}`)}
31
+ Next steps:
29
32
 
30
- Install NPM dependencies:
31
- $ ${chalk.greenBright(`yarn install`)}
33
+ 1. Navigate to the project directory:
34
+ $ ${chalk.green(`cd ${projectName}`)}
32
35
 
33
- And start the Contember stack:
34
- $ ${chalk.greenBright("yarn start")}
36
+ 2. Install dependencies:
37
+ $ ${chalk.green(`${packageManager} install`)}
35
38
 
36
- The following services will be accessible:
39
+ 3. Start the Contember stack:
40
+ $ ${chalk.green(`${packageManager} start`)}
37
41
 
38
- - Contember Admin at http://localhost:1480
39
- - Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)
40
- - Adminer database management tool at http://localhost:1485
41
- - Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)
42
- - MailHog testing SMTP at http://localhost:1484
43
- - PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)
42
+ Available services:
44
43
 
45
- If you have any issues or questions, just ask here: https://github.com/contember/engine/discussions
44
+ ${chalk.bold("UI & Admin")}
45
+ - Contember Admin ${chalk.blue("http://localhost:1480")}
46
+
47
+ ${chalk.bold("API & Backend")}
48
+ - Contember Engine API ${chalk.blue("http://localhost:1481")}
49
+ Auth token: 0000000000000000000000000000000000000000
50
+
51
+ ${chalk.bold("Development Tools")}
52
+ - PostgreSQL database ${chalk.blue("http://localhost:1482")} ${chalk.grey("credentials: contember / contember")}
53
+ - Minio S3 storage ${chalk.blue("http://localhost:1483")}
54
+ - Mailpit SMTP testing ${chalk.blue("http://localhost:1484")}
55
+ - Adminer DB manager ${chalk.blue("http://localhost:1485")}
56
+ - Minio Dashboard ${chalk.blue("http://localhost:1486")} ${chalk.grey("credentials: contember / contember")}
57
+
58
+ ${chalk.bold("Need help?")} Ask the community: https://github.com/orgs/contember/discussions
46
59
  `;
47
60
  export {
48
61
  WorkspaceCreateCommand