@contember/create 2.1.0-alpha.1 → 2.1.0-alpha.11
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.
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs +37 -23
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.js +37 -23
- package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/development/src/lib/FileSystem.cjs +1 -0
- package/dist/development/src/lib/FileSystem.cjs.map +1 -1
- package/dist/development/src/lib/FileSystem.js +1 -0
- package/dist/development/src/lib/FileSystem.js.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.cjs +24 -5
- package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.js +24 -5
- package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/development/src/lib/packageManagerDetector.cjs +22 -0
- package/dist/development/src/lib/packageManagerDetector.cjs.map +1 -0
- package/dist/development/src/lib/packageManagerDetector.js +22 -0
- package/dist/development/src/lib/packageManagerDetector.js.map +1 -0
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs +37 -23
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.js +37 -23
- package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/production/src/lib/FileSystem.cjs +1 -0
- package/dist/production/src/lib/FileSystem.cjs.map +1 -1
- package/dist/production/src/lib/FileSystem.js +1 -0
- package/dist/production/src/lib/FileSystem.js.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.cjs +24 -5
- package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.js +24 -5
- package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/production/src/lib/packageManagerDetector.cjs +22 -0
- package/dist/production/src/lib/packageManagerDetector.cjs.map +1 -0
- package/dist/production/src/lib/packageManagerDetector.js +22 -0
- package/dist/production/src/lib/packageManagerDetector.js.map +1 -0
- package/dist/types/commands/WorkspaceCreateCommand.d.ts +4 -2
- package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
- package/dist/types/lib/FileSystem.d.ts +1 -0
- package/dist/types/lib/FileSystem.d.ts.map +1 -1
- package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
- package/dist/types/lib/packageManagerDetector.d.ts +3 -0
- package/dist/types/lib/packageManagerDetector.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -3
- package/resources/templates/default/.gitignore.dist +154 -0
- package/resources/templates/default/README.md +98 -0
- package/resources/templates/{template-workspace → default}/admin/.env.development +1 -0
- package/resources/templates/{template-workspace → default}/admin/app/components/layout.tsx +7 -3
- package/resources/templates/default/admin/app/components/navigation.tsx +85 -0
- package/resources/templates/{template-workspace → default}/admin/app/index.tsx +4 -4
- package/resources/templates/default/admin/app/pages/tenant.tsx +160 -0
- package/resources/templates/default/admin/entrypoint/components/layout.tsx +14 -0
- package/resources/templates/default/admin/entrypoint/components/logged-in.tsx +47 -0
- package/resources/templates/default/admin/entrypoint/components/login.tsx +103 -0
- package/resources/templates/default/admin/entrypoint/config.ts +35 -0
- package/resources/templates/default/admin/entrypoint/contexts/login.tsx +18 -0
- package/resources/templates/default/admin/entrypoint/index.tsx +12 -0
- package/resources/templates/default/admin/entrypoint/login-entrypoint.tsx +24 -0
- package/resources/templates/default/admin/entrypoint/pages/index.tsx +48 -0
- package/resources/templates/default/admin/entrypoint/pages/magicLink.tsx +56 -0
- package/resources/templates/default/admin/entrypoint/pages/magicLintSent.tsx +63 -0
- package/resources/templates/default/admin/entrypoint/pages/passwordReset.tsx +44 -0
- package/resources/templates/default/admin/entrypoint/pages/resetRequest.tsx +35 -0
- package/resources/templates/default/admin/entrypoint/pages/resetRequestSuccess.tsx +34 -0
- package/resources/templates/default/admin/index.css +94 -0
- package/resources/templates/{template-workspace → default}/admin/index.html +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/block-repeater.tsx +4 -4
- package/resources/templates/{template-workspace → default}/admin/lib/board/board.tsx +3 -3
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-header.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/columns.tsx +8 -8
- package/resources/templates/default/admin/lib/datagrid/elements.tsx +59 -0
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/empty.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/date.tsx +4 -4
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/relation.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/pagination.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/table.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/ui.tsx +4 -4
- package/resources/templates/{template-workspace → default}/admin/lib/dimensions/dimensions.tsx +2 -2
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-block-toolbar.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-canvas.tsx +2 -2
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-inline-toolbar.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/BlockElement.tsx +2 -2
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableCellElementRenderer.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/editor-block.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/sortable-block.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/form/container.tsx +2 -1
- package/resources/templates/{template-workspace → default}/admin/lib/form/inputs.tsx +2 -2
- package/resources/templates/{template-workspace → default}/admin/lib/layout/layout-boxed.tsx +4 -4
- package/resources/templates/{template-workspace → default}/admin/lib/repeater/repeater.tsx +3 -3
- package/resources/templates/{template-workspace → default}/admin/lib/select/ui.tsx +5 -5
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/common.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/memberships-control.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/otp-setup.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/toast/toast.tsx +4 -5
- package/resources/templates/{template-workspace → default}/admin/lib/ui/button.tsx +6 -6
- package/resources/templates/{template-workspace → default}/admin/lib/ui/card.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/dialog.tsx +2 -2
- package/resources/templates/{template-workspace → default}/admin/lib/ui/dropdown.tsx +6 -6
- package/resources/templates/{template-workspace → default}/admin/lib/ui/input.tsx +11 -11
- package/resources/templates/{template-workspace → default}/admin/lib/ui/overlay.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/popover.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/property-list.tsx +3 -3
- package/resources/templates/{template-workspace → default}/admin/lib/ui/select.tsx +4 -3
- package/resources/templates/{template-workspace → default}/admin/lib/ui/sheet.tsx +4 -4
- package/resources/templates/{template-workspace → default}/admin/lib/ui/sidebar.tsx +15 -16
- package/resources/templates/{template-workspace → default}/admin/lib/ui/sortable.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/switch.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/table.tsx +3 -3
- package/resources/templates/{template-workspace → default}/admin/lib/ui/textarea.tsx +3 -3
- package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle.tsx +2 -3
- package/resources/templates/{template-workspace → default}/admin/lib/ui/tooltip.tsx +2 -2
- package/resources/templates/{template-workspace → default}/admin/lib/upload/ui.tsx +4 -4
- package/resources/templates/{template-workspace → default}/admin/lib/upload/upload-progress.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/upload/view.tsx +3 -3
- package/resources/templates/{template-workspace → default}/admin/lib/utils/uic.tsx +30 -23
- package/resources/templates/{template-workspace → default}/admin/package.json +6 -3
- package/resources/templates/default/admin/postcss.config.js +5 -0
- package/resources/templates/default/admin/sentry.ts +26 -0
- package/resources/templates/{template-workspace → default}/admin/tsconfig.json +1 -9
- package/resources/templates/default/admin/vite-env.d.ts +12 -0
- package/resources/templates/default/admin/vite.config.ts +11 -0
- package/resources/templates/default/api/README.md +87 -0
- package/resources/templates/{template-workspace → default}/biome.json +1 -1
- package/resources/templates/default/client/README.md +285 -0
- package/resources/templates/{template-workspace → default}/contember.template.yaml +5 -0
- package/resources/templates/{template-workspace → default}/package.json +2 -2
- package/resources/templates/default/scripts/generate-client.sh +7 -0
- package/resources/templates/default/scripts/update-ui-lib.sh +344 -0
- package/src/commands/WorkspaceCreateCommand.ts +41 -24
- package/src/lib/FileSystem.ts +1 -0
- package/src/lib/TemplateInstaller.ts +30 -7
- package/src/lib/packageManagerDetector.ts +24 -0
- package/resources/templates/template-workspace/.gitignore.dist +0 -3
- package/resources/templates/template-workspace/admin/app/components/navigation.tsx +0 -1
- package/resources/templates/template-workspace/admin/index.css +0 -53
- package/resources/templates/template-workspace/admin/index.tsx +0 -268
- package/resources/templates/template-workspace/admin/lib/datagrid/elements.tsx +0 -48
- package/resources/templates/template-workspace/admin/postcss.config.js +0 -6
- package/resources/templates/template-workspace/admin/tailwind.config.js +0 -73
- package/resources/templates/template-workspace/admin/vite-env.d.ts +0 -7
- package/resources/templates/template-workspace/scripts/generate-client.sh +0 -8
- /package/resources/templates/{template-workspace → default}/.github/scripts/setup-actions-variables.sh +0 -0
- /package/resources/templates/{template-workspace → default}/.github/workflows/deploy.yaml +0 -0
- /package/resources/templates/{template-workspace → default}/admin/app/components/logo.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/app/config.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/app/index.html +0 -0
- /package/resources/templates/{template-workspace → default}/admin/app/pages/index.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/binding/binding.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/binding/delete.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/binding/hooks.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/binding/identity.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/binding/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/binding/navigation-guard-dialog.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/binding/persist.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/board/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/buttons/back-button.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/buttons/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/buttons/link-back-button.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/cells.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-leaf.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/export.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/boolean.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/common.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/defined.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/enum.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/mobile.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/number.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/text.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/grid.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/labels.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/layout-switcher.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/loader.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/tiles.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/toolbar.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/dev/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/dev/login-panel.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/dev/todo.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/dict.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/dimensions/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/block-editor.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/baseEditorPlugins.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/buttons.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-editable-canvas.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/AnchorRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HeadingRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ListItemRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/OrderedListRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ParagraphRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ScrollTargetRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableElementRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableRowElementRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/plugins.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text-view.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/errors/error-boundary.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/errors/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/errors/use-error-formatter.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/field/formatted-field.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/field/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/form/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/form/labels.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/form/select.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/form/ui.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/form/upload-repeaters.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/form/upload.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/formatting/formatting.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/formatting/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/images/formatImageResizeUrl.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/images/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/labels/enum-labels.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/labels/field-labels.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/labels/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/layout/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/layout/layout.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/layout/slots.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/repeater/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/create-new.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/filter.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/highlight.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/list.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/multi-select.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/select.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/sortable-select.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/change-my-password.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/create-api-key.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/invite.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/login.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset-request.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin-init.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/update-project-member.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInvite.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInviteUser.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/api-key-list.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-delete-dialog.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-list.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/person-list.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/toast/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/toast/toaster.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/alert-dialog.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/avatar.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/collapsible.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/divider.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/label.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/loader.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/menu.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/progress.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/scroll-area.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/separator.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/skeleton.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle-group.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/upload/dropzone.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/upload/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/upload/repeater.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/utils/cn.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/utils/createComponentOpenHooks.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/utils/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/utils/use-mobile.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/public/favicon.png +0 -0
- /package/resources/templates/{template-workspace → default}/api/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/api/migrations/.gitkeep +0 -0
- /package/resources/templates/{template-workspace → default}/api/model/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/api/package.json +0 -0
- /package/resources/templates/{template-workspace → default}/api/tsconfig.json +0 -0
- /package/resources/templates/{template-workspace → default}/client/package.json +0 -0
- /package/resources/templates/{template-workspace → default}/client/src/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/client/tsconfig.json +0 -0
- /package/resources/templates/{template-workspace → default}/docker-compose.yaml +0 -0
- /package/resources/templates/{template-workspace → default}/tsconfig.json +0 -0
- /package/resources/templates/{template-workspace → default}/tsconfig.settings.json +0 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# Contember GraphQL Client Documentation
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
1. [Getting Started](#getting-started)
|
|
5
|
+
2. [Basic Operations](#basic-operations)
|
|
6
|
+
3. [Working with Relations](#working-with-relations)
|
|
7
|
+
4. [Advanced Queries](#advanced-queries)
|
|
8
|
+
|
|
9
|
+
## Getting Started
|
|
10
|
+
|
|
11
|
+
### Client Setup
|
|
12
|
+
```typescript
|
|
13
|
+
import { ContentClient } from '@contember/client-content'
|
|
14
|
+
import { GraphQlClient } from '@contember/graphql-client'
|
|
15
|
+
|
|
16
|
+
const graphQlClient = new GraphQlClient({
|
|
17
|
+
url: 'http://localhost:1481/content/app/live',
|
|
18
|
+
apiToken: '0000000000000000000000000000000000000000'
|
|
19
|
+
})
|
|
20
|
+
const client = new ContentClient(graphQlClient)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Basic Operations
|
|
24
|
+
|
|
25
|
+
### Reading Data
|
|
26
|
+
|
|
27
|
+
#### Get Single Entity
|
|
28
|
+
```typescript
|
|
29
|
+
// Get by ID
|
|
30
|
+
const entity = await client.query(
|
|
31
|
+
queryBuilder.get('Entity',
|
|
32
|
+
{ by: { id: 'entity-id' } },
|
|
33
|
+
it => it.$('field1').$('field2')
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
// Get by unique field
|
|
38
|
+
const entity = await client.query(
|
|
39
|
+
queryBuilder.get('Entity',
|
|
40
|
+
{ by: { unique: 'value' } },
|
|
41
|
+
it => it.$('field1').$('field2')
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
#### List Entities
|
|
47
|
+
```typescript
|
|
48
|
+
const entities = await client.query(
|
|
49
|
+
queryBuilder.list('Entity', {
|
|
50
|
+
filter: { publishedAt: { lte: 'now' } },
|
|
51
|
+
limit: 50,
|
|
52
|
+
offset: 0,
|
|
53
|
+
orderBy: [{ publishedAt: 'desc' }]
|
|
54
|
+
})
|
|
55
|
+
)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Creating Data
|
|
59
|
+
|
|
60
|
+
#### Create Single Entity
|
|
61
|
+
```typescript
|
|
62
|
+
await client.mutate(
|
|
63
|
+
queryBuilder.create('Entity', {
|
|
64
|
+
data: {
|
|
65
|
+
title: 'New Entity',
|
|
66
|
+
description: 'Description'
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Updating Data
|
|
73
|
+
|
|
74
|
+
#### Update Entity
|
|
75
|
+
```typescript
|
|
76
|
+
await client.mutate(
|
|
77
|
+
queryBuilder.update('Entity', {
|
|
78
|
+
by: { id: 'entity-id' },
|
|
79
|
+
data: {
|
|
80
|
+
title: 'Updated Title'
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
await client.mutate(
|
|
88
|
+
queryBuilder.upsert('Entity', {
|
|
89
|
+
by: { id: 'entity-id' },
|
|
90
|
+
create: {
|
|
91
|
+
title: 'New Entity'
|
|
92
|
+
},
|
|
93
|
+
update: {
|
|
94
|
+
title: 'Updated Title'
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Deleting Data
|
|
101
|
+
|
|
102
|
+
#### Delete Entity
|
|
103
|
+
```typescript
|
|
104
|
+
await client.mutate(
|
|
105
|
+
queryBuilder.delete('Entity', {
|
|
106
|
+
by: { id: 'entity-id' }
|
|
107
|
+
})
|
|
108
|
+
)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Working with Relations
|
|
112
|
+
|
|
113
|
+
### HasOne Relations
|
|
114
|
+
|
|
115
|
+
#### Create with Relation
|
|
116
|
+
```typescript
|
|
117
|
+
await client.mutate(
|
|
118
|
+
queryBuilder.create('Entity', {
|
|
119
|
+
data: {
|
|
120
|
+
title: 'Main Entity',
|
|
121
|
+
relation: {
|
|
122
|
+
create: {
|
|
123
|
+
title: 'Related Entity'
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
#### Connect Existing Entity
|
|
132
|
+
```typescript
|
|
133
|
+
await client.mutate(
|
|
134
|
+
queryBuilder.update('Entity', {
|
|
135
|
+
by: { id: 'entity-id' },
|
|
136
|
+
data: {
|
|
137
|
+
relation: {
|
|
138
|
+
connect: { id: 'related-id' }
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
#### Disconnect Relation
|
|
146
|
+
```typescript
|
|
147
|
+
await client.mutate(
|
|
148
|
+
queryBuilder.update('Entity', {
|
|
149
|
+
by: { id: 'entity-id' },
|
|
150
|
+
data: {
|
|
151
|
+
relation: {
|
|
152
|
+
disconnect: true
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### Delete Relation
|
|
160
|
+
```typescript
|
|
161
|
+
await client.mutate(
|
|
162
|
+
queryBuilder.update('Entity', {
|
|
163
|
+
by: { id: 'entity-id' },
|
|
164
|
+
data: {
|
|
165
|
+
relation: {
|
|
166
|
+
delete: true
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
})
|
|
170
|
+
)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### HasMany Relations
|
|
174
|
+
|
|
175
|
+
#### Add Multiple Relations
|
|
176
|
+
```typescript
|
|
177
|
+
await client.mutate(
|
|
178
|
+
queryBuilder.create('Entity', {
|
|
179
|
+
data: {
|
|
180
|
+
title: 'Main Entity',
|
|
181
|
+
relations: [
|
|
182
|
+
{ create: { title: 'Related 1' } },
|
|
183
|
+
{ connect: { id: 'related-id' } },
|
|
184
|
+
{
|
|
185
|
+
connectOrCreate: {
|
|
186
|
+
connect: { id: 'related-id' },
|
|
187
|
+
create: { title: 'New Related' },
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
})
|
|
193
|
+
)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
#### Update Multiple Relations
|
|
197
|
+
```typescript
|
|
198
|
+
await client.mutate(
|
|
199
|
+
queryBuilder.update('Entity', {
|
|
200
|
+
by: { id: 'entity-id' },
|
|
201
|
+
data: {
|
|
202
|
+
relations: [
|
|
203
|
+
{ create: { title: 'New Related' } },
|
|
204
|
+
{ connect: { id: 'related-id' } },
|
|
205
|
+
{
|
|
206
|
+
connectOrCreate: {
|
|
207
|
+
connect: { id: 'related-id' },
|
|
208
|
+
create: { title: 'New Related' },
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
upsert: {
|
|
213
|
+
by: { id: 'related-id' },
|
|
214
|
+
create: { title: 'New Related' },
|
|
215
|
+
update: { title: 'Updated Related' },
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
{ disconnect: { id: 'related-id-1' } },
|
|
219
|
+
{ delete: { id: 'related-id' } },
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
}),
|
|
223
|
+
)
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Advanced Queries
|
|
227
|
+
|
|
228
|
+
### Using Fragments
|
|
229
|
+
```typescript
|
|
230
|
+
// Define fragment
|
|
231
|
+
const entityFragment = queryBuilder.fragment('Entity',
|
|
232
|
+
it => it.$('title').$('description')
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
// Use fragment in query
|
|
236
|
+
const entity = await client.query(
|
|
237
|
+
queryBuilder.get('Entity',
|
|
238
|
+
{ by: { id: 'entity-id' } },
|
|
239
|
+
entityFragment
|
|
240
|
+
)
|
|
241
|
+
)
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Connecting or creating related entities
|
|
245
|
+
```typescript
|
|
246
|
+
await client.mutate(
|
|
247
|
+
queryBuilder.update('Entity', {
|
|
248
|
+
by: { id: 'entity-id' },
|
|
249
|
+
data: {
|
|
250
|
+
relation: {
|
|
251
|
+
connectOrCreate: {
|
|
252
|
+
connect: {
|
|
253
|
+
id: 'related-id'
|
|
254
|
+
},
|
|
255
|
+
create: {
|
|
256
|
+
title: 'Updated Related Entity'
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
})
|
|
262
|
+
)
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Multiple Queries
|
|
266
|
+
```typescript
|
|
267
|
+
const { entity1, entity2List } = await client.query({
|
|
268
|
+
entity1: queryBuilder.get('Entity1',
|
|
269
|
+
{ by: { id: 'id1' } },
|
|
270
|
+
it => it.$$()
|
|
271
|
+
),
|
|
272
|
+
entity2List: queryBuilder.list('Entity2',
|
|
273
|
+
it => it.$$()
|
|
274
|
+
)
|
|
275
|
+
})
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Counting Entities
|
|
279
|
+
```typescript
|
|
280
|
+
const count = await client.query(
|
|
281
|
+
queryBuilder.count('Entity', {
|
|
282
|
+
filter: { status: { eq: 'published' } }
|
|
283
|
+
})
|
|
284
|
+
)
|
|
285
|
+
```
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"lint:fix": "biome lint . --apply"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@biomejs/biome": "^1.
|
|
21
|
+
"@biomejs/biome": "^1.9.4",
|
|
22
22
|
"@contember/client-content-generator": "{version}",
|
|
23
23
|
"typescript": "^5.0",
|
|
24
|
-
"vite": "^
|
|
24
|
+
"vite": "^6",
|
|
25
25
|
"vite-tsconfig-paths": "^4.3.1"
|
|
26
26
|
},
|
|
27
27
|
"workspaces": [
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
docker-compose run --rm --entrypoint="" contember-cli sh -c "
|
|
4
|
+
bun /opt/contember/run.js project:print-schema --format=schema > /tmp/contember-schema.json
|
|
5
|
+
bun run --silent contember-client-generator /tmp/contember-schema.json ./client/src
|
|
6
|
+
rm /tmp/contember-schema.json
|
|
7
|
+
"
|
|
@@ -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."
|