@contember/create 2.0.2 → 2.1.0-alpha.10

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 (282) hide show
  1. package/dist/development/src/commands/WorkspaceCreateCommand.cjs +37 -23
  2. package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  3. package/dist/development/src/commands/WorkspaceCreateCommand.js +37 -23
  4. package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
  5. package/dist/development/src/lib/FileSystem.cjs +1 -0
  6. package/dist/development/src/lib/FileSystem.cjs.map +1 -1
  7. package/dist/development/src/lib/FileSystem.js +1 -0
  8. package/dist/development/src/lib/FileSystem.js.map +1 -1
  9. package/dist/development/src/lib/TemplateInstaller.cjs +24 -5
  10. package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
  11. package/dist/development/src/lib/TemplateInstaller.js +24 -5
  12. package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
  13. package/dist/development/src/lib/packageManagerDetector.cjs +22 -0
  14. package/dist/development/src/lib/packageManagerDetector.cjs.map +1 -0
  15. package/dist/development/src/lib/packageManagerDetector.js +22 -0
  16. package/dist/development/src/lib/packageManagerDetector.js.map +1 -0
  17. package/dist/production/src/commands/WorkspaceCreateCommand.cjs +37 -23
  18. package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  19. package/dist/production/src/commands/WorkspaceCreateCommand.js +37 -23
  20. package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
  21. package/dist/production/src/lib/FileSystem.cjs +1 -0
  22. package/dist/production/src/lib/FileSystem.cjs.map +1 -1
  23. package/dist/production/src/lib/FileSystem.js +1 -0
  24. package/dist/production/src/lib/FileSystem.js.map +1 -1
  25. package/dist/production/src/lib/TemplateInstaller.cjs +24 -5
  26. package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
  27. package/dist/production/src/lib/TemplateInstaller.js +24 -5
  28. package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
  29. package/dist/production/src/lib/packageManagerDetector.cjs +22 -0
  30. package/dist/production/src/lib/packageManagerDetector.cjs.map +1 -0
  31. package/dist/production/src/lib/packageManagerDetector.js +22 -0
  32. package/dist/production/src/lib/packageManagerDetector.js.map +1 -0
  33. package/dist/types/commands/WorkspaceCreateCommand.d.ts +4 -2
  34. package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
  35. package/dist/types/lib/FileSystem.d.ts +1 -0
  36. package/dist/types/lib/FileSystem.d.ts.map +1 -1
  37. package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
  38. package/dist/types/lib/packageManagerDetector.d.ts +3 -0
  39. package/dist/types/lib/packageManagerDetector.d.ts.map +1 -0
  40. package/dist/types/tsconfig.tsbuildinfo +1 -1
  41. package/package.json +7 -3
  42. package/resources/templates/default/.gitignore.dist +154 -0
  43. package/resources/templates/default/README.md +98 -0
  44. package/resources/templates/{template-workspace → default}/admin/.env.development +1 -0
  45. package/resources/templates/{template-workspace → default}/admin/app/components/layout.tsx +7 -3
  46. package/resources/templates/default/admin/app/components/navigation.tsx +85 -0
  47. package/resources/templates/{template-workspace → default}/admin/app/index.tsx +4 -4
  48. package/resources/templates/default/admin/app/pages/tenant.tsx +160 -0
  49. package/resources/templates/default/admin/entrypoint/components/layout.tsx +14 -0
  50. package/resources/templates/default/admin/entrypoint/components/logged-in.tsx +47 -0
  51. package/resources/templates/default/admin/entrypoint/components/login.tsx +103 -0
  52. package/resources/templates/default/admin/entrypoint/config.ts +35 -0
  53. package/resources/templates/default/admin/entrypoint/contexts/login.tsx +18 -0
  54. package/resources/templates/default/admin/entrypoint/index.tsx +12 -0
  55. package/resources/templates/default/admin/entrypoint/login-entrypoint.tsx +24 -0
  56. package/resources/templates/default/admin/entrypoint/pages/index.tsx +48 -0
  57. package/resources/templates/default/admin/entrypoint/pages/magicLink.tsx +56 -0
  58. package/resources/templates/default/admin/entrypoint/pages/magicLintSent.tsx +63 -0
  59. package/resources/templates/default/admin/entrypoint/pages/passwordReset.tsx +44 -0
  60. package/resources/templates/default/admin/entrypoint/pages/resetRequest.tsx +35 -0
  61. package/resources/templates/default/admin/entrypoint/pages/resetRequestSuccess.tsx +34 -0
  62. package/resources/templates/default/admin/index.css +94 -0
  63. package/resources/templates/{template-workspace → default}/admin/index.html +1 -1
  64. package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/block-repeater.tsx +4 -4
  65. package/resources/templates/{template-workspace → default}/admin/lib/board/board.tsx +3 -3
  66. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/cells.tsx +47 -0
  67. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-header.tsx +1 -1
  68. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/columns.tsx +72 -9
  69. package/resources/templates/default/admin/lib/datagrid/elements.tsx +59 -0
  70. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/empty.tsx +1 -1
  71. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/date.tsx +4 -4
  72. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/enum.tsx +37 -0
  73. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/relation.tsx +1 -1
  74. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/pagination.tsx +1 -1
  75. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/table.tsx +1 -1
  76. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/ui.tsx +4 -4
  77. package/resources/templates/{template-workspace → default}/admin/lib/dimensions/dimensions.tsx +2 -2
  78. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-block-toolbar.tsx +1 -1
  79. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-canvas.tsx +2 -2
  80. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-inline-toolbar.tsx +1 -1
  81. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/BlockElement.tsx +2 -2
  82. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableCellElementRenderer.tsx +1 -1
  83. package/resources/templates/{template-workspace → default}/admin/lib/editor/editor-block.tsx +1 -1
  84. package/resources/templates/{template-workspace → default}/admin/lib/editor/sortable-block.tsx +1 -1
  85. package/resources/templates/{template-workspace → default}/admin/lib/form/container.tsx +2 -1
  86. package/resources/templates/{template-workspace → default}/admin/lib/layout/layout-boxed.tsx +4 -4
  87. package/resources/templates/{template-workspace → default}/admin/lib/repeater/repeater.tsx +3 -3
  88. package/resources/templates/{template-workspace → default}/admin/lib/select/ui.tsx +5 -5
  89. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/common.tsx +1 -1
  90. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/memberships-control.tsx +1 -1
  91. package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/otp-setup.tsx +1 -1
  92. package/resources/templates/{template-workspace → default}/admin/lib/toast/toast.tsx +4 -5
  93. package/resources/templates/{template-workspace → default}/admin/lib/ui/button.tsx +6 -6
  94. package/resources/templates/{template-workspace → default}/admin/lib/ui/card.tsx +1 -1
  95. package/resources/templates/{template-workspace → default}/admin/lib/ui/dialog.tsx +2 -2
  96. package/resources/templates/{template-workspace → default}/admin/lib/ui/dropdown.tsx +6 -6
  97. package/resources/templates/{template-workspace → default}/admin/lib/ui/input.tsx +11 -11
  98. package/resources/templates/{template-workspace → default}/admin/lib/ui/overlay.tsx +1 -1
  99. package/resources/templates/{template-workspace → default}/admin/lib/ui/popover.tsx +1 -1
  100. package/resources/templates/{template-workspace → default}/admin/lib/ui/property-list.tsx +3 -3
  101. package/resources/templates/{template-workspace → default}/admin/lib/ui/select.tsx +3 -3
  102. package/resources/templates/{template-workspace → default}/admin/lib/ui/sheet.tsx +4 -4
  103. package/resources/templates/{template-workspace → default}/admin/lib/ui/sidebar.tsx +15 -16
  104. package/resources/templates/{template-workspace → default}/admin/lib/ui/sortable.tsx +1 -1
  105. package/resources/templates/{template-workspace → default}/admin/lib/ui/switch.tsx +1 -1
  106. package/resources/templates/{template-workspace → default}/admin/lib/ui/table.tsx +3 -3
  107. package/resources/templates/{template-workspace → default}/admin/lib/ui/textarea.tsx +3 -3
  108. package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle.tsx +2 -3
  109. package/resources/templates/{template-workspace → default}/admin/lib/ui/tooltip.tsx +2 -2
  110. package/resources/templates/{template-workspace → default}/admin/lib/upload/ui.tsx +4 -4
  111. package/resources/templates/{template-workspace → default}/admin/lib/upload/upload-progress.tsx +1 -1
  112. package/resources/templates/{template-workspace → default}/admin/lib/upload/view.tsx +3 -3
  113. package/resources/templates/{template-workspace → default}/admin/lib/utils/uic.tsx +30 -23
  114. package/resources/templates/{template-workspace → default}/admin/package.json +6 -3
  115. package/resources/templates/default/admin/postcss.config.js +5 -0
  116. package/resources/templates/default/admin/sentry.ts +26 -0
  117. package/resources/templates/{template-workspace → default}/admin/tsconfig.json +1 -9
  118. package/resources/templates/default/admin/vite-env.d.ts +12 -0
  119. package/resources/templates/default/admin/vite.config.ts +11 -0
  120. package/resources/templates/default/api/README.md +87 -0
  121. package/resources/templates/{template-workspace → default}/biome.json +1 -1
  122. package/resources/templates/default/client/README.md +285 -0
  123. package/resources/templates/{template-workspace → default}/contember.template.yaml +5 -0
  124. package/resources/templates/{template-workspace → default}/package.json +2 -2
  125. package/resources/templates/default/scripts/generate-client.sh +7 -0
  126. package/resources/templates/default/scripts/update-ui-lib.sh +344 -0
  127. package/src/commands/WorkspaceCreateCommand.ts +41 -24
  128. package/src/lib/FileSystem.ts +1 -0
  129. package/src/lib/TemplateInstaller.ts +30 -7
  130. package/src/lib/packageManagerDetector.ts +24 -0
  131. package/resources/templates/template-workspace/.gitignore.dist +0 -3
  132. package/resources/templates/template-workspace/admin/app/components/navigation.tsx +0 -1
  133. package/resources/templates/template-workspace/admin/index.css +0 -53
  134. package/resources/templates/template-workspace/admin/index.tsx +0 -268
  135. package/resources/templates/template-workspace/admin/lib/datagrid/elements.tsx +0 -48
  136. package/resources/templates/template-workspace/admin/postcss.config.js +0 -6
  137. package/resources/templates/template-workspace/admin/tailwind.config.js +0 -73
  138. package/resources/templates/template-workspace/admin/vite-env.d.ts +0 -7
  139. package/resources/templates/template-workspace/scripts/generate-client.sh +0 -8
  140. /package/resources/templates/{template-workspace → default}/.github/scripts/setup-actions-variables.sh +0 -0
  141. /package/resources/templates/{template-workspace → default}/.github/workflows/deploy.yaml +0 -0
  142. /package/resources/templates/{template-workspace → default}/admin/app/components/logo.tsx +0 -0
  143. /package/resources/templates/{template-workspace → default}/admin/app/config.ts +0 -0
  144. /package/resources/templates/{template-workspace → default}/admin/app/index.html +0 -0
  145. /package/resources/templates/{template-workspace → default}/admin/app/pages/index.tsx +0 -0
  146. /package/resources/templates/{template-workspace → default}/admin/lib/binding/binding.tsx +0 -0
  147. /package/resources/templates/{template-workspace → default}/admin/lib/binding/delete.tsx +0 -0
  148. /package/resources/templates/{template-workspace → default}/admin/lib/binding/hooks.tsx +0 -0
  149. /package/resources/templates/{template-workspace → default}/admin/lib/binding/identity.tsx +0 -0
  150. /package/resources/templates/{template-workspace → default}/admin/lib/binding/index.ts +0 -0
  151. /package/resources/templates/{template-workspace → default}/admin/lib/binding/navigation-guard-dialog.tsx +0 -0
  152. /package/resources/templates/{template-workspace → default}/admin/lib/binding/persist.tsx +0 -0
  153. /package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/index.ts +0 -0
  154. /package/resources/templates/{template-workspace → default}/admin/lib/board/index.ts +0 -0
  155. /package/resources/templates/{template-workspace → default}/admin/lib/buttons/back-button.tsx +0 -0
  156. /package/resources/templates/{template-workspace → default}/admin/lib/buttons/index.ts +0 -0
  157. /package/resources/templates/{template-workspace → default}/admin/lib/buttons/link-back-button.tsx +0 -0
  158. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-leaf.tsx +0 -0
  159. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/export.tsx +0 -0
  160. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/boolean.tsx +0 -0
  161. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/common.tsx +0 -0
  162. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/defined.tsx +0 -0
  163. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/index.ts +0 -0
  164. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/mobile.tsx +0 -0
  165. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/number.tsx +0 -0
  166. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/text.tsx +0 -0
  167. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/grid.tsx +0 -0
  168. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/index.ts +0 -0
  169. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/labels.tsx +0 -0
  170. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/layout-switcher.tsx +0 -0
  171. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/loader.tsx +0 -0
  172. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/tiles.tsx +0 -0
  173. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/toolbar.tsx +0 -0
  174. /package/resources/templates/{template-workspace → default}/admin/lib/dev/index.ts +0 -0
  175. /package/resources/templates/{template-workspace → default}/admin/lib/dev/login-panel.tsx +0 -0
  176. /package/resources/templates/{template-workspace → default}/admin/lib/dev/todo.tsx +0 -0
  177. /package/resources/templates/{template-workspace → default}/admin/lib/dict.ts +0 -0
  178. /package/resources/templates/{template-workspace → default}/admin/lib/dimensions/index.ts +0 -0
  179. /package/resources/templates/{template-workspace → default}/admin/lib/editor/block-editor.tsx +0 -0
  180. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/baseEditorPlugins.tsx +0 -0
  181. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/buttons.tsx +0 -0
  182. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-editable-canvas.tsx +0 -0
  183. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/AnchorRenderer.tsx +0 -0
  184. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HeadingRenderer.tsx +0 -0
  185. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +0 -0
  186. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ListItemRenderer.tsx +0 -0
  187. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/OrderedListRenderer.tsx +0 -0
  188. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ParagraphRenderer.tsx +0 -0
  189. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ScrollTargetRenderer.tsx +0 -0
  190. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableElementRenderer.tsx +0 -0
  191. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableRowElementRenderer.tsx +0 -0
  192. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +0 -0
  193. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/index.ts +0 -0
  194. /package/resources/templates/{template-workspace → default}/admin/lib/editor/index.ts +0 -0
  195. /package/resources/templates/{template-workspace → default}/admin/lib/editor/plugins.tsx +0 -0
  196. /package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text-view.tsx +0 -0
  197. /package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text.tsx +0 -0
  198. /package/resources/templates/{template-workspace → default}/admin/lib/errors/error-boundary.tsx +0 -0
  199. /package/resources/templates/{template-workspace → default}/admin/lib/errors/index.ts +0 -0
  200. /package/resources/templates/{template-workspace → default}/admin/lib/errors/use-error-formatter.ts +0 -0
  201. /package/resources/templates/{template-workspace → default}/admin/lib/field/formatted-field.tsx +0 -0
  202. /package/resources/templates/{template-workspace → default}/admin/lib/field/index.ts +0 -0
  203. /package/resources/templates/{template-workspace → default}/admin/lib/form/index.ts +0 -0
  204. /package/resources/templates/{template-workspace → default}/admin/lib/form/inputs.tsx +0 -0
  205. /package/resources/templates/{template-workspace → default}/admin/lib/form/labels.tsx +0 -0
  206. /package/resources/templates/{template-workspace → default}/admin/lib/form/select.tsx +0 -0
  207. /package/resources/templates/{template-workspace → default}/admin/lib/form/ui.tsx +0 -0
  208. /package/resources/templates/{template-workspace → default}/admin/lib/form/upload-repeaters.tsx +0 -0
  209. /package/resources/templates/{template-workspace → default}/admin/lib/form/upload.tsx +0 -0
  210. /package/resources/templates/{template-workspace → default}/admin/lib/formatting/formatting.ts +0 -0
  211. /package/resources/templates/{template-workspace → default}/admin/lib/formatting/index.ts +0 -0
  212. /package/resources/templates/{template-workspace → default}/admin/lib/images/formatImageResizeUrl.ts +0 -0
  213. /package/resources/templates/{template-workspace → default}/admin/lib/images/index.ts +0 -0
  214. /package/resources/templates/{template-workspace → default}/admin/lib/labels/enum-labels.ts +0 -0
  215. /package/resources/templates/{template-workspace → default}/admin/lib/labels/field-labels.ts +0 -0
  216. /package/resources/templates/{template-workspace → default}/admin/lib/labels/index.ts +0 -0
  217. /package/resources/templates/{template-workspace → default}/admin/lib/layout/index.ts +0 -0
  218. /package/resources/templates/{template-workspace → default}/admin/lib/layout/layout.tsx +0 -0
  219. /package/resources/templates/{template-workspace → default}/admin/lib/layout/slots.tsx +0 -0
  220. /package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/index.ts +0 -0
  221. /package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +0 -0
  222. /package/resources/templates/{template-workspace → default}/admin/lib/repeater/index.ts +0 -0
  223. /package/resources/templates/{template-workspace → default}/admin/lib/select/create-new.tsx +0 -0
  224. /package/resources/templates/{template-workspace → default}/admin/lib/select/filter.tsx +0 -0
  225. /package/resources/templates/{template-workspace → default}/admin/lib/select/highlight.tsx +0 -0
  226. /package/resources/templates/{template-workspace → default}/admin/lib/select/index.ts +0 -0
  227. /package/resources/templates/{template-workspace → default}/admin/lib/select/list.tsx +0 -0
  228. /package/resources/templates/{template-workspace → default}/admin/lib/select/multi-select.tsx +0 -0
  229. /package/resources/templates/{template-workspace → default}/admin/lib/select/select.tsx +0 -0
  230. /package/resources/templates/{template-workspace → default}/admin/lib/select/sortable-select.tsx +0 -0
  231. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/change-my-password.tsx +0 -0
  232. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/create-api-key.tsx +0 -0
  233. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/index.ts +0 -0
  234. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/invite.tsx +0 -0
  235. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/login.tsx +0 -0
  236. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset-request.tsx +0 -0
  237. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset.tsx +0 -0
  238. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin-init.tsx +0 -0
  239. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin.tsx +0 -0
  240. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/update-project-member.tsx +0 -0
  241. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInvite.ts +0 -0
  242. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInviteUser.tsx +0 -0
  243. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/index.ts +0 -0
  244. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/api-key-list.tsx +0 -0
  245. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/index.ts +0 -0
  246. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-delete-dialog.tsx +0 -0
  247. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-list.tsx +0 -0
  248. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/person-list.tsx +0 -0
  249. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/index.ts +0 -0
  250. /package/resources/templates/{template-workspace → default}/admin/lib/toast/index.ts +0 -0
  251. /package/resources/templates/{template-workspace → default}/admin/lib/toast/toaster.tsx +0 -0
  252. /package/resources/templates/{template-workspace → default}/admin/lib/ui/alert-dialog.tsx +0 -0
  253. /package/resources/templates/{template-workspace → default}/admin/lib/ui/avatar.tsx +0 -0
  254. /package/resources/templates/{template-workspace → default}/admin/lib/ui/collapsible.tsx +0 -0
  255. /package/resources/templates/{template-workspace → default}/admin/lib/ui/divider.tsx +0 -0
  256. /package/resources/templates/{template-workspace → default}/admin/lib/ui/label.tsx +0 -0
  257. /package/resources/templates/{template-workspace → default}/admin/lib/ui/loader.tsx +0 -0
  258. /package/resources/templates/{template-workspace → default}/admin/lib/ui/menu.tsx +0 -0
  259. /package/resources/templates/{template-workspace → default}/admin/lib/ui/progress.tsx +0 -0
  260. /package/resources/templates/{template-workspace → default}/admin/lib/ui/scroll-area.tsx +0 -0
  261. /package/resources/templates/{template-workspace → default}/admin/lib/ui/separator.tsx +0 -0
  262. /package/resources/templates/{template-workspace → default}/admin/lib/ui/skeleton.tsx +0 -0
  263. /package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle-group.tsx +0 -0
  264. /package/resources/templates/{template-workspace → default}/admin/lib/upload/dropzone.tsx +0 -0
  265. /package/resources/templates/{template-workspace → default}/admin/lib/upload/index.ts +0 -0
  266. /package/resources/templates/{template-workspace → default}/admin/lib/upload/repeater.tsx +0 -0
  267. /package/resources/templates/{template-workspace → default}/admin/lib/utils/cn.ts +0 -0
  268. /package/resources/templates/{template-workspace → default}/admin/lib/utils/createComponentOpenHooks.tsx +0 -0
  269. /package/resources/templates/{template-workspace → default}/admin/lib/utils/index.ts +0 -0
  270. /package/resources/templates/{template-workspace → default}/admin/lib/utils/use-mobile.ts +0 -0
  271. /package/resources/templates/{template-workspace → default}/admin/public/favicon.png +0 -0
  272. /package/resources/templates/{template-workspace → default}/api/index.ts +0 -0
  273. /package/resources/templates/{template-workspace → default}/api/migrations/.gitkeep +0 -0
  274. /package/resources/templates/{template-workspace → default}/api/model/index.ts +0 -0
  275. /package/resources/templates/{template-workspace → default}/api/package.json +0 -0
  276. /package/resources/templates/{template-workspace → default}/api/tsconfig.json +0 -0
  277. /package/resources/templates/{template-workspace → default}/client/package.json +0 -0
  278. /package/resources/templates/{template-workspace → default}/client/src/index.ts +0 -0
  279. /package/resources/templates/{template-workspace → default}/client/tsconfig.json +0 -0
  280. /package/resources/templates/{template-workspace → default}/docker-compose.yaml +0 -0
  281. /package/resources/templates/{template-workspace → default}/tsconfig.json +0 -0
  282. /package/resources/templates/{template-workspace → default}/tsconfig.settings.json +0 -0
@@ -0,0 +1,344 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ ### Default Configuration ###
5
+ TEMPLATE_REPO_URL="git@github.com:contember/contember.git" # Template repository URL
6
+ TEMPLATE_DIR="packages/react-ui-lib/src" # Directory to filter from template repo
7
+ OLD_COMMIT="9fc76ce46eb9d9196a88eeb01c7305b182dde7dd" # Default base commit or tag
8
+ NEW_COMMIT="main" # Default branch or commit with latest changes
9
+ TARGET_DIR="admin/lib" # Directory to map the filtered content into
10
+ CLONE_DIR=".tmp-ui-lib-update" # Temporary clone directory
11
+ REMOTE_NAME="ui-lib-update-temp" # Temporary remote name
12
+ COMMIT_FILE="$TARGET_DIR/COMMIT" # File to store the new commit hash
13
+ FORCE_MODE=false # Default to non-force mode
14
+ ### End Default Configuration ###
15
+
16
+ # Function to show help message
17
+ show_help() {
18
+ echo "Usage: $0 [options]"
19
+ echo ""
20
+ echo "Options:"
21
+ echo " --force Replace target directory without cherry-picking"
22
+ echo " --from COMMIT Specify base commit, tag, or branch (default: from COMMIT file or $OLD_COMMIT)"
23
+ echo " --to COMMIT Specify target commit, tag, or branch (default: $NEW_COMMIT)"
24
+ echo " --repo URL Specify template repository URL (default: $TEMPLATE_REPO_URL)"
25
+ echo " --template-dir DIR Specify template directory within repo (default: $TEMPLATE_DIR)"
26
+ echo " --target-dir DIR Specify target directory in this project (default: $TARGET_DIR)"
27
+ echo " --help Show this help message"
28
+ echo ""
29
+ echo "Examples:"
30
+ echo " $0 --to v5.0.0 # Update to tag v5.0.0"
31
+ echo " $0 --from v4.0.0 --to v5.0.0 # Update from tag v4.0.0 to v5.0.0"
32
+ echo " $0 --to feature-branch --force # Force update to a feature branch"
33
+ }
34
+
35
+ # Parse command line arguments
36
+ while [[ $# -gt 0 ]]; do
37
+ case "$1" in
38
+ --force)
39
+ FORCE_MODE=true
40
+ shift
41
+ ;;
42
+ --from)
43
+ if [ -z "${2:-}" ]; then
44
+ echo "Error: --from requires a commit, tag, or branch name"
45
+ exit 1
46
+ fi
47
+ OLD_COMMIT="$2"
48
+ shift 2
49
+ ;;
50
+ --to)
51
+ if [ -z "${2:-}" ]; then
52
+ echo "Error: --to requires a commit, tag, or branch name"
53
+ exit 1
54
+ fi
55
+ NEW_COMMIT="$2"
56
+ shift 2
57
+ ;;
58
+ --repo)
59
+ if [ -z "${2:-}" ]; then
60
+ echo "Error: --repo requires a URL"
61
+ exit 1
62
+ fi
63
+ TEMPLATE_REPO_URL="$2"
64
+ shift 2
65
+ ;;
66
+ --template-dir)
67
+ if [ -z "${2:-}" ]; then
68
+ echo "Error: --template-dir requires a directory path"
69
+ exit 1
70
+ fi
71
+ TEMPLATE_DIR="$2"
72
+ shift 2
73
+ ;;
74
+ --target-dir)
75
+ if [ -z "${2:-}" ]; then
76
+ echo "Error: --target-dir requires a directory path"
77
+ exit 1
78
+ fi
79
+ TARGET_DIR="$2"
80
+ COMMIT_FILE="$TARGET_DIR/COMMIT" # Update COMMIT file path
81
+ shift 2
82
+ ;;
83
+ --help)
84
+ show_help
85
+ exit 0
86
+ ;;
87
+ *)
88
+ echo "Unknown option: $1"
89
+ echo "Use --help for usage information"
90
+ exit 1
91
+ ;;
92
+ esac
93
+ done
94
+
95
+ echo "Running in $([ "$FORCE_MODE" = true ] && echo "FORCE" || echo "normal") mode"
96
+ echo "Using repository: $TEMPLATE_REPO_URL"
97
+ echo "Template directory: $TEMPLATE_DIR"
98
+ echo "Target directory: $TARGET_DIR"
99
+
100
+ # Ensure cleanup on exit
101
+ cleanup() {
102
+ echo "Cleaning up temporary files..."
103
+ rm -rf "$CLONE_DIR"
104
+ git remote remove "$REMOTE_NAME" 2>/dev/null || true
105
+ }
106
+ trap cleanup EXIT
107
+
108
+ # Pre-step: Ensure the repository is clean (skip check if in force mode)
109
+ if [[ "$FORCE_MODE" = false ]] && [[ -n $(git status --porcelain) ]]; then
110
+ echo "There are modified or untracked files in the repository."
111
+ exit 1
112
+ fi
113
+
114
+ # Step 0: Load OLD_COMMIT from COMMIT file, if available and not explicitly specified
115
+ if [ -f "$COMMIT_FILE" ] && [ "$OLD_COMMIT" = "9fc76ce46eb9d9196a88eeb01c7305b182dde7dd" ]; then
116
+ OLD_COMMIT=$(cat "$COMMIT_FILE")
117
+ echo "Loaded OLD_COMMIT from $COMMIT_FILE: $OLD_COMMIT"
118
+ fi
119
+
120
+ echo "Updating from: $OLD_COMMIT"
121
+ echo "Updating to: $NEW_COMMIT"
122
+
123
+ # Step 1: Clone the template repository with sparse checkout
124
+ echo "Cloning the template repository into $CLONE_DIR..."
125
+ rm -rf "$CLONE_DIR"
126
+ mkdir -p "$CLONE_DIR"
127
+ cd "$CLONE_DIR"
128
+ git init --quiet
129
+ git remote add origin "$TEMPLATE_REPO_URL"
130
+
131
+ echo "Configuring sparse checkout for $TEMPLATE_DIR..."
132
+ git sparse-checkout init --cone
133
+ git sparse-checkout set "$TEMPLATE_DIR"
134
+
135
+ # Step 2: Fetch specific references more efficiently
136
+ echo "Fetching specific references..."
137
+
138
+ # Check if inputs look like tags (starting with 'v' is a common convention)
139
+ if [[ "$OLD_COMMIT" =~ ^v[0-9] ]] || [[ "$NEW_COMMIT" =~ ^v[0-9] ]]; then
140
+ # If either reference looks like a tag, fetch only the specific tags needed
141
+ if [[ "$OLD_COMMIT" =~ ^v[0-9] ]]; then
142
+ echo "Fetching tag: $OLD_COMMIT"
143
+ git fetch origin "refs/tags/$OLD_COMMIT:refs/tags/$OLD_COMMIT" --depth=1
144
+ else
145
+ echo "Fetching commit/branch: $OLD_COMMIT"
146
+ git fetch origin "$OLD_COMMIT" --depth=1
147
+ fi
148
+
149
+ if [[ "$NEW_COMMIT" =~ ^v[0-9] ]]; then
150
+ echo "Fetching tag: $NEW_COMMIT"
151
+ git fetch origin "refs/tags/$NEW_COMMIT:refs/tags/$NEW_COMMIT" --depth=1
152
+ else
153
+ echo "Fetching commit/branch: $NEW_COMMIT"
154
+ git fetch origin "$NEW_COMMIT" --depth=1
155
+ fi
156
+ else
157
+ # If they don't look like tags, just fetch them directly
158
+ echo "Fetching commits/branches: $OLD_COMMIT and $NEW_COMMIT"
159
+ git fetch origin "$OLD_COMMIT" "$NEW_COMMIT" --depth=1
160
+ fi
161
+
162
+ # Step 3: Resolve the references to actual commit hashes
163
+ echo "Resolving commit references..."
164
+
165
+ # Function to resolve a reference to a commit hash
166
+ resolve_ref() {
167
+ local ref=$1
168
+ local hash
169
+
170
+ # Try different ways to resolve the reference
171
+ if hash=$(git rev-parse --quiet --verify "$ref" 2>/dev/null); then
172
+ echo "$hash"
173
+ elif hash=$(git rev-parse --quiet --verify "origin/$ref" 2>/dev/null); then
174
+ echo "$hash"
175
+ elif [[ "$ref" =~ ^v[0-9] ]] && hash=$(git rev-parse --quiet --verify "refs/tags/$ref" 2>/dev/null); then
176
+ echo "$hash"
177
+ else
178
+ # If we still can't resolve it, try to fetch it directly as a tag
179
+ git fetch origin "refs/tags/$ref:refs/tags/$ref" --depth=1 2>/dev/null || true
180
+
181
+ if hash=$(git rev-parse --quiet --verify "refs/tags/$ref" 2>/dev/null); then
182
+ echo "$hash"
183
+ else
184
+ # If all else fails, return the input (might be a direct hash)
185
+ echo "$ref"
186
+ fi
187
+ fi
188
+ }
189
+
190
+ OLD_COMMIT_HASH=$(resolve_ref "$OLD_COMMIT")
191
+ NEW_COMMIT_HASH=$(resolve_ref "$NEW_COMMIT")
192
+
193
+ echo "Resolved OLD_COMMIT to: $OLD_COMMIT_HASH"
194
+ echo "Resolved NEW_COMMIT to: $NEW_COMMIT_HASH"
195
+
196
+ # Step 4: Check out the resolved commits
197
+ echo "Checking out the old code..."
198
+ if ! git checkout "$OLD_COMMIT_HASH" -- "$TEMPLATE_DIR"; then
199
+ echo "Error: Failed to checkout $OLD_COMMIT_HASH"
200
+ exit 1
201
+ fi
202
+
203
+ # Try formatting, but don't fail if biome is not available or nothing changes
204
+ if command -v biome &> /dev/null; then
205
+ echo "Formatting code with biome..."
206
+ biome check --write "$TEMPLATE_DIR" 2>/dev/null || true
207
+
208
+ # Only commit if there are actual changes
209
+ if [[ -n $(git status --porcelain "$TEMPLATE_DIR") ]]; then
210
+ git add "$TEMPLATE_DIR"
211
+ git commit -m "Format code base at $OLD_COMMIT"
212
+ FORMAT_COMMIT=$(git rev-parse HEAD)
213
+ echo "Formatting commit created: $FORMAT_COMMIT"
214
+ else
215
+ echo "No formatting changes detected, using $OLD_COMMIT_HASH directly"
216
+ FORMAT_COMMIT=$OLD_COMMIT_HASH
217
+ fi
218
+ else
219
+ echo "Biome not found, skipping formatting step"
220
+ FORMAT_COMMIT=$OLD_COMMIT_HASH
221
+ fi
222
+
223
+ # Step 5: Checkout the new commit
224
+ echo "Checking out the new code..."
225
+ if ! git checkout "$NEW_COMMIT_HASH" -- "$TEMPLATE_DIR"; then
226
+ echo "Error: Failed to checkout $NEW_COMMIT_HASH"
227
+ exit 1
228
+ fi
229
+
230
+ # Capture the actual commit hash of the new commit for the COMMIT file
231
+ NEW_COMMIT_REF=$NEW_COMMIT_HASH
232
+ echo "New commit reference: $NEW_COMMIT_REF"
233
+
234
+ # Step 6: Reset and stage only the sparse directory
235
+ echo "Preparing changes..."
236
+ git reset "$FORMAT_COMMIT" -- "$TEMPLATE_DIR"
237
+
238
+ # Format new code if biome is available
239
+ if command -v biome &> /dev/null; then
240
+ echo "Formatting new code with biome..."
241
+ biome check --write "$TEMPLATE_DIR" 2>/dev/null || true
242
+ fi
243
+
244
+ git add "$TEMPLATE_DIR" # Stage only the files in the sparse directory
245
+
246
+ # Step 7: Create the squashed commit
247
+ echo "Creating a commit with changes..."
248
+
249
+ # Only commit if there are actual changes
250
+ if [[ -n $(git status --porcelain "$TEMPLATE_DIR") ]]; then
251
+ git commit -m "Update UI lib to $NEW_COMMIT"
252
+ else
253
+ echo "No changes detected between $OLD_COMMIT and $NEW_COMMIT in $TEMPLATE_DIR"
254
+ exit 0
255
+ fi
256
+
257
+ # Capture the squashed commit hash for normal mode
258
+ SQUASHED_COMMIT=$(git rev-parse HEAD)
259
+ echo "Commit created: $SQUASHED_COMMIT"
260
+
261
+ # Return to the main repository
262
+ cd - # Return to the main repository
263
+
264
+ if [ "$FORCE_MODE" = true ]; then
265
+ # FORCE MODE: directly replace the target directory
266
+ echo "Force mode: directly replacing $TARGET_DIR..."
267
+
268
+ # Remove the target directory if it exists
269
+ if [ -d "$TARGET_DIR" ]; then
270
+ echo "Removing existing $TARGET_DIR directory"
271
+ rm -rf "$TARGET_DIR"
272
+ fi
273
+
274
+ # Create target parent directory if needed
275
+ mkdir -p "$(dirname "$TARGET_DIR")"
276
+
277
+ # Copy files directly from source template directory in temporary repo
278
+ echo "Copying new files from template to target directory"
279
+ cp -r "$CLONE_DIR/$TEMPLATE_DIR" "$TARGET_DIR"
280
+
281
+ # Remove files that should not be included
282
+ if [ -f "$TARGET_DIR/index.ts" ]; then
283
+ echo "Removing $TARGET_DIR/index.ts"
284
+ rm "$TARGET_DIR/index.ts"
285
+ fi
286
+ if [ -f "$TARGET_DIR/tsconfig.json" ]; then
287
+ echo "Removing $TARGET_DIR/tsconfig.json"
288
+ rm "$TARGET_DIR/tsconfig.json"
289
+ fi
290
+
291
+ # Write the new commit hash to the COMMIT file
292
+ echo "Writing new commit reference to $COMMIT_FILE"
293
+ echo "$NEW_COMMIT_REF" > "$COMMIT_FILE"
294
+
295
+ echo "Force update complete. You'll need to manually add and commit the changes."
296
+ echo "To review and commit changes: git add $TARGET_DIR && git commit -m \"Update UI lib to $NEW_COMMIT\""
297
+ else
298
+ # NORMAL MODE: first perform the directory move in the temp repo
299
+ echo "Moving files in temporary repository..."
300
+ cd "$CLONE_DIR"
301
+ mkdir -p "$(dirname "$TARGET_DIR")"
302
+ cp -r "$TEMPLATE_DIR" "$TARGET_DIR"
303
+
304
+ # Remove files that should not be included
305
+ if [ -f "$TARGET_DIR/index.ts" ]; then
306
+ rm "$TARGET_DIR/index.ts"
307
+ fi
308
+ if [ -f "$TARGET_DIR/tsconfig.json" ]; then
309
+ rm "$TARGET_DIR/tsconfig.json"
310
+ fi
311
+
312
+ # Add the changes
313
+ git add "$TARGET_DIR"
314
+ git commit --amend --no-edit
315
+
316
+ # Update the squashed commit reference
317
+ SQUASHED_COMMIT=$(git rev-parse HEAD)
318
+ cd - # Return to main repository
319
+
320
+ # NORMAL MODE: use cherry-pick to merge changes
321
+ echo "Adding the temporary repository as a remote to the main repository..."
322
+ git remote remove "$REMOTE_NAME" 2>/dev/null || true
323
+ git remote add "$REMOTE_NAME" "file://$PWD/$CLONE_DIR"
324
+ git fetch "$REMOTE_NAME" "$SQUASHED_COMMIT"
325
+
326
+ # Cherry-pick the squashed commit
327
+ echo "Cherry-picking the squashed commit into the current branch..."
328
+ if git cherry-pick "$SQUASHED_COMMIT" --no-commit; then
329
+ echo "Cherry-pick completed successfully."
330
+ else
331
+ echo "Cherry-pick encountered conflicts. Please resolve them and run:"
332
+ echo " git cherry-pick --continue"
333
+ exit 1
334
+ fi
335
+
336
+ # Write the new commit hash to admin/lib/COMMIT
337
+ echo "Writing new commit reference to $COMMIT_FILE"
338
+ echo "$NEW_COMMIT_REF" > "$COMMIT_FILE"
339
+
340
+ echo "Process completed successfully. Review the changes and commit them."
341
+ fi
342
+
343
+ # Cleanup handled by trap
344
+ echo "Done."
@@ -3,12 +3,14 @@ import { join } from 'node:path'
3
3
  import chalk from 'chalk'
4
4
  import { TemplateInstaller } from '../lib/TemplateInstaller'
5
5
  import { getPackageVersion } from '../lib/version'
6
+ import { detectPackageManager } from '../lib/packageManagerDetector'
6
7
 
7
8
  type Args = {
8
- workspaceName: string
9
+ projectName: string
9
10
  }
10
11
 
11
12
  type Options = {
13
+ template: string
12
14
  }
13
15
 
14
16
  export class WorkspaceCreateCommand extends Command<Args, Options> {
@@ -19,42 +21,57 @@ export class WorkspaceCreateCommand extends Command<Args, Options> {
19
21
  }
20
22
 
21
23
  protected configure(configuration: CommandConfiguration<Args, Options>): void {
22
- configuration.description('Creates a new Contember workspace')
23
- configuration.argument('workspaceName')
24
+ configuration.description('Creates a new Contember project')
25
+ configuration.argument('projectName')
26
+ configuration.option('template').shortcut('t').valueRequired().description('Template name or remote source')
24
27
  }
25
28
 
26
29
  protected async execute(input: Input<Args, Options>): Promise<void> {
27
- const workspaceName = input.getArgument('workspaceName')
28
- const workspaceDirectory = join(process.cwd(), workspaceName)
29
- await this.templateInstaller.installTemplate('@contember/template-workspace', workspaceDirectory, {
30
+ const projectName = input.getArgument('projectName')
31
+ const projectDirectory = join(process.cwd(), projectName)
32
+ const packageManager = detectPackageManager()
33
+ const template = input.getOption('template') ?? 'default'
34
+
35
+ await this.templateInstaller.installTemplate(template, projectDirectory, {
30
36
  version: await getPackageVersion(),
31
- projectName: workspaceName,
37
+ projectName: projectName,
38
+ packageManager: packageManager,
32
39
  })
40
+
33
41
  // eslint-disable-next-line no-console
34
- console.log(createDocs(workspaceDirectory, workspaceName))
42
+ console.log(createDocs(projectDirectory, projectName, packageManager))
35
43
  }
36
44
  }
37
45
 
38
- const createDocs = (workspaceDirectory: string, workspaceName: string) => `
39
- Contember workspace was successfully created inside the directory ${workspaceDirectory}
46
+ const createDocs = (projectDirectory: string, projectName: string, packageManager: string) => `
47
+ Contember project successfully created in ${projectDirectory}
48
+
49
+ Next steps:
50
+
51
+ 1. Navigate to the project directory:
52
+ $ ${chalk.green(`cd ${projectName}`)}
53
+
54
+ 2. Install dependencies:
55
+ $ ${chalk.green(`${packageManager} install`)}
40
56
 
41
- You can now enter this directory:
42
- $ ${chalk.greenBright(`cd ${workspaceName}`)}
57
+ 3. Start the Contember stack:
58
+ $ ${chalk.green(`${packageManager} start`)}
43
59
 
44
- Install NPM dependencies:
45
- $ ${chalk.greenBright(`yarn install`)}
60
+ Available services:
46
61
 
47
- And start the Contember stack:
48
- $ ${chalk.greenBright('yarn start')}
62
+ ${chalk.bold('UI & Admin')}
63
+ - Contember Admin ${chalk.blue('http://localhost:1480')}
49
64
 
50
- The following services will be accessible:
65
+ ${chalk.bold('API & Backend')}
66
+ - Contember Engine API ${chalk.blue('http://localhost:1481')}
67
+ Auth token: 0000000000000000000000000000000000000000
51
68
 
52
- - Contember Admin at http://localhost:1480
53
- - Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)
54
- - Adminer database management tool at http://localhost:1485
55
- - Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)
56
- - MailHog testing SMTP at http://localhost:1484
57
- - PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)
69
+ ${chalk.bold('Development Tools')}
70
+ - PostgreSQL database ${chalk.blue('http://localhost:1482')} ${chalk.grey('credentials: contember / contember')}
71
+ - Minio S3 storage ${chalk.blue('http://localhost:1483')}
72
+ - Mailpit SMTP testing ${chalk.blue('http://localhost:1484')}
73
+ - Adminer DB manager ${chalk.blue('http://localhost:1485')}
74
+ - Minio Dashboard ${chalk.blue('http://localhost:1486')} ${chalk.grey('credentials: contember / contember')}
58
75
 
59
- If you have any issues or questions, just ask here: https://github.com/contember/engine/discussions
76
+ ${chalk.bold('Need help?')} Ask the community: https://github.com/orgs/contember/discussions
60
77
  `
@@ -10,6 +10,7 @@ export class FileSystem {
10
10
  readDir = fs.readdir
11
11
  copy = copy
12
12
  unlink = fs.unlink
13
+ remove = fs.rm
13
14
  pathExists = async (path: string) => {
14
15
  try {
15
16
  await access(path)
@@ -1,18 +1,20 @@
1
1
  import { join } from 'node:path'
2
2
  import { FileSystem } from './FileSystem'
3
3
  import jsyaml from 'js-yaml'
4
+ import degit from 'degit'
4
5
 
5
6
 
6
7
  export class TemplateInstaller {
7
8
 
8
- private localTemplates: Record<string, string> = {
9
- ['@contember/template-workspace']: join(this.resourceDir, 'templates/template-workspace'),
10
- }
9
+ private localTemplates: Record<string, string>
11
10
 
12
11
  constructor(
13
12
  private readonly resourceDir: string,
14
13
  private readonly fs: FileSystem,
15
14
  ) {
15
+ this.localTemplates = {
16
+ ['default']: join(this.resourceDir, 'templates/default'),
17
+ }
16
18
  }
17
19
 
18
20
  installTemplate = async (
@@ -20,15 +22,35 @@ export class TemplateInstaller {
20
22
  targetDir: string,
21
23
  variables: Record<string, string> = {},
22
24
  ) => {
23
- let removeTemplate = () => {
24
- }
25
+ let removeTemplate = () => { }
26
+
25
27
  if (this.localTemplates[template]) {
26
28
  template = this.localTemplates[template]
29
+ } else {
30
+ const tmpDir = await this.fs.createTempDir()
31
+
32
+ try {
33
+ const emitter = degit(template, { cache: false, force: true, verbose: true })
34
+ await emitter.clone(tmpDir)
35
+
36
+ removeTemplate = () => {
37
+ try {
38
+ this.fs.remove(tmpDir, { recursive: true, force: true })
39
+ } catch (error) {
40
+ console.error(`Failed to clean up template: ${error}`)
41
+ }
42
+ }
43
+
44
+ template = tmpDir
45
+ } catch (error) {
46
+ throw new Error(`Failed to clone template from repository: ${error}`)
47
+ }
27
48
  }
28
49
 
29
50
  const templateConfigFile = join(template, 'contember.template.yaml')
30
51
  if (!(await this.fs.pathExists(templateConfigFile))) {
31
- throw `${template} is not a Contember template`
52
+ removeTemplate()
53
+ throw new Error(`${template} is not a Contember template`)
32
54
  }
33
55
  const config = (await this.readYaml(templateConfigFile)) as {
34
56
  type?: string
@@ -46,7 +68,8 @@ export class TemplateInstaller {
46
68
  await this.fs.copy(template, targetDir, {
47
69
  filter: src => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src),
48
70
  })
49
- await removeTemplate()
71
+
72
+ removeTemplate()
50
73
 
51
74
  if (config.patchPackageJson) {
52
75
  await this.replaceFileContent(join(targetDir, 'package.json'), content => {
@@ -0,0 +1,24 @@
1
+ import { existsSync } from 'node:fs'
2
+ import { join } from 'node:path'
3
+
4
+ export type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun'
5
+
6
+ export const detectPackageManager = (): PackageManager => {
7
+ const userAgent = process.env.npm_config_user_agent
8
+
9
+ if (userAgent) {
10
+ if (userAgent.startsWith('yarn/')) return 'yarn'
11
+ if (userAgent.startsWith('pnpm/')) return 'pnpm'
12
+ if (userAgent.startsWith('npm/')) return 'npm'
13
+ if (userAgent.startsWith('bun/')) return 'bun'
14
+ }
15
+
16
+ const cwd = process.cwd()
17
+ if (existsSync(join(cwd, 'yarn.lock'))) return 'yarn'
18
+ if (existsSync(join(cwd, 'pnpm-lock.yaml'))) return 'pnpm'
19
+ if (existsSync(join(cwd, 'package-lock.json'))) return 'npm'
20
+ if (existsSync(join(cwd, 'bun.lockb'))) return 'bun'
21
+ if (existsSync(join(cwd, 'bun.lock'))) return 'bun'
22
+
23
+ return 'npm'
24
+ }
@@ -1,3 +0,0 @@
1
- /admin/dist
2
- /node_modules
3
- /docker-compose.override.yaml
@@ -1 +0,0 @@
1
- export const Navigation = () => (<div>Navigation</div>)
@@ -1,53 +0,0 @@
1
- @import "@contember/react-devbar/index.css";
2
-
3
-
4
- @tailwind base;
5
- @tailwind components;
6
- @tailwind utilities;
7
-
8
- @layer base {
9
- :root {
10
- --background: 0 0% 100%;
11
- --foreground: 240 10% 3.9%;
12
- --card: 0 0% 100%;
13
- --card-foreground: 240 10% 3.9%;
14
- --popover: 0 0% 100%;
15
- --popover-foreground: 240 10% 3.9%;
16
- --primary: 240 5.9% 10%;
17
- --primary-foreground: 0 0% 98%;
18
- --secondary: 240 4.8% 95.9%;
19
- --secondary-foreground: 240 5.9% 10%;
20
- --muted: 240 4.8% 95.9%;
21
- --muted-foreground: 240 3.8% 46.1%;
22
- --accent: 240 4.8% 95.9%;
23
- --accent-foreground: 240 5.9% 10%;
24
- --destructive: 0 72.22% 50.59%;
25
- --destructive-foreground: 0 0% 98%;
26
- --border: 240 5.9% 90%;
27
- --input: 240 5.9% 90%;
28
- --ring: 240 5% 64.9%;
29
- --radius: 0.5rem;
30
- }
31
-
32
- .dark {
33
- --background: 240 10% 3.9%;
34
- --foreground: 0 0% 98%;
35
- --card: 240 10% 3.9%;
36
- --card-foreground: 0 0% 98%;
37
- --popover: 240 10% 3.9%;
38
- --popover-foreground: 0 0% 98%;
39
- --primary: 0 0% 98%;
40
- --primary-foreground: 240 5.9% 10%;
41
- --secondary: 240 3.7% 15.9%;
42
- --secondary-foreground: 0 0% 98%;
43
- --muted: 240 3.7% 15.9%;
44
- --muted-foreground: 240 5% 64.9%;
45
- --accent: 240 3.7% 15.9%;
46
- --accent-foreground: 0 0% 98%;
47
- --destructive: 0 62.8% 30.6%;
48
- --destructive-foreground: 0 85.7% 97.3%;
49
- --border: 240 3.7% 15.9%;
50
- --input: 240 3.7% 15.9%;
51
- --ring: 240 4.9% 83.9%;
52
- }
53
- }