@contember/create 2.1.0-alpha.3 → 2.1.0-alpha.35
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/run.cjs +6 -4
- package/dist/development/run.cjs.map +1 -1
- package/dist/development/run.js +6 -4
- package/dist/development/run.js.map +1 -1
- 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 +28 -12
- package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.js +28 -12
- 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/development/src/lib/version.cjs.map +1 -1
- package/dist/development/src/lib/version.js.map +1 -1
- package/dist/development/src/paths.cjs.map +1 -1
- package/dist/development/src/paths.js.map +1 -1
- package/dist/production/run.cjs +6 -4
- package/dist/production/run.cjs.map +1 -1
- package/dist/production/run.js +6 -4
- package/dist/production/run.js.map +1 -1
- 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 +28 -12
- package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.js +28 -12
- 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/production/src/lib/version.cjs.map +1 -1
- package/dist/production/src/lib/version.js.map +1 -1
- package/dist/production/src/paths.cjs.map +1 -1
- package/dist/production/src/paths.js.map +1 -1
- 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/package.json +15 -6
- package/resources/templates/{template-workspace → default}/.github/workflows/deploy.yaml +1 -1
- 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/default/admin/.env.production +6 -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/magicLinkSent.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/binding/binding.tsx +0 -2
- package/resources/templates/{template-workspace → default}/admin/lib/binding/hooks.tsx +14 -8
- package/resources/templates/default/admin/lib/binding/identity.tsx +51 -0
- package/resources/templates/{template-workspace → default}/admin/lib/binding/navigation-guard-dialog.tsx +12 -8
- package/resources/templates/{template-workspace → default}/admin/lib/binding/persist.tsx +7 -5
- package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/block-repeater.tsx +14 -16
- package/resources/templates/{template-workspace → default}/admin/lib/board/board.tsx +61 -47
- package/resources/templates/{template-workspace → default}/admin/lib/buttons/back-button.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/cells.tsx +49 -35
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-header.tsx +47 -38
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/columns.tsx +128 -105
- package/resources/templates/default/admin/lib/datagrid/elements.tsx +63 -0
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/empty.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/boolean.tsx +1 -4
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/common.tsx +14 -14
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/date.tsx +35 -21
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/defined.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/enum.tsx +24 -30
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/mobile.tsx +2 -3
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/number.tsx +0 -3
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/relation.tsx +36 -30
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/labels.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/loader.tsx +2 -7
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/pagination.tsx +33 -38
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/table.tsx +8 -6
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/tiles.tsx +10 -5
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/toolbar.tsx +10 -7
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/ui.tsx +12 -15
- package/resources/templates/{template-workspace → default}/admin/lib/dev/login-panel.tsx +23 -16
- package/resources/templates/{template-workspace → default}/admin/lib/dict.ts +17 -5
- package/resources/templates/default/admin/lib/dimensions/dimensions.tsx +159 -0
- package/resources/templates/{template-workspace → default}/admin/lib/editor/block-editor.tsx +22 -10
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/baseEditorPlugins.tsx +0 -2
- package/resources/templates/default/admin/lib/editor/common/buttons.tsx +205 -0
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-block-toolbar.tsx +3 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-canvas.tsx +6 -4
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-editable-canvas.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-inline-toolbar.tsx +5 -2
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/AnchorRenderer.tsx +18 -16
- package/resources/templates/default/admin/lib/editor/common/elements/BlockElement.tsx +60 -0
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HeadingRenderer.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableCellElementRenderer.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableElementRenderer.tsx +2 -7
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableRowElementRenderer.tsx +1 -5
- package/resources/templates/{template-workspace → default}/admin/lib/editor/editor-block.tsx +17 -10
- package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text-view.tsx +11 -6
- package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text.tsx +6 -7
- package/resources/templates/default/admin/lib/editor/sortable-block.tsx +57 -0
- package/resources/templates/default/admin/lib/form/container.tsx +72 -0
- package/resources/templates/{template-workspace → default}/admin/lib/form/inputs.tsx +14 -12
- package/resources/templates/{template-workspace → default}/admin/lib/form/select.tsx +93 -51
- package/resources/templates/{template-workspace → default}/admin/lib/form/ui.tsx +1 -1
- package/resources/templates/default/admin/lib/form/upload-repeaters.tsx +221 -0
- package/resources/templates/{template-workspace → default}/admin/lib/form/upload.tsx +61 -62
- package/resources/templates/{template-workspace → default}/admin/lib/labels/enum-labels.ts +6 -3
- package/resources/templates/{template-workspace → default}/admin/lib/labels/field-labels.ts +4 -2
- package/resources/templates/{template-workspace → default}/admin/lib/layout/layout-boxed.tsx +39 -29
- package/resources/templates/{template-workspace → default}/admin/lib/layout/slots.tsx +1 -4
- package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +10 -4
- package/resources/templates/{template-workspace → default}/admin/lib/repeater/repeater.tsx +24 -15
- package/resources/templates/{template-workspace → default}/admin/lib/select/create-new.tsx +0 -3
- package/resources/templates/{template-workspace → default}/admin/lib/select/filter.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/select/list.tsx +33 -28
- package/resources/templates/default/admin/lib/select/multi-select.tsx +92 -0
- package/resources/templates/default/admin/lib/select/select.tsx +109 -0
- package/resources/templates/default/admin/lib/select/sortable-select.tsx +138 -0
- package/resources/templates/{template-workspace → default}/admin/lib/select/ui.tsx +13 -11
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/change-my-password.tsx +21 -8
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/common.tsx +21 -12
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/create-api-key.tsx +9 -5
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/invite.tsx +12 -7
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/login.tsx +26 -7
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/memberships-control.tsx +32 -20
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset-request.tsx +9 -5
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset.tsx +21 -8
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin-init.tsx +9 -5
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin.tsx +25 -12
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/update-project-member.tsx +3 -4
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInviteUser.tsx +2 -3
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/api-key-list.tsx +5 -3
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-delete-dialog.tsx +13 -2
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-list.tsx +17 -11
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/person-list.tsx +6 -4
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/otp-setup.tsx +86 -59
- package/resources/templates/default/admin/lib/toast/toast.tsx +113 -0
- package/resources/templates/{template-workspace → default}/admin/lib/toast/toaster.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/alert-dialog.tsx +4 -3
- package/resources/templates/default/admin/lib/ui/button.tsx +30 -0
- package/resources/templates/{template-workspace → default}/admin/lib/ui/card.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/dialog.tsx +12 -8
- package/resources/templates/default/admin/lib/ui/dimension.tsx +9 -0
- package/resources/templates/{template-workspace → default}/admin/lib/ui/dropdown.tsx +18 -15
- package/resources/templates/default/admin/lib/ui/input.tsx +68 -0
- package/resources/templates/{template-workspace → default}/admin/lib/ui/loader.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/menu.tsx +3 -11
- package/resources/templates/{template-workspace → default}/admin/lib/ui/overlay.tsx +11 -9
- package/resources/templates/{template-workspace → default}/admin/lib/ui/popover.tsx +2 -2
- package/resources/templates/{template-workspace → default}/admin/lib/ui/property-list.tsx +5 -5
- package/resources/templates/{template-workspace → default}/admin/lib/ui/scroll-area.tsx +11 -11
- package/resources/templates/{template-workspace → default}/admin/lib/ui/select.tsx +4 -5
- package/resources/templates/{template-workspace → default}/admin/lib/ui/sheet.tsx +9 -8
- package/resources/templates/{template-workspace → default}/admin/lib/ui/sidebar.tsx +53 -42
- package/resources/templates/{template-workspace → default}/admin/lib/ui/sortable.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/switch.tsx +11 -0
- package/resources/templates/{template-workspace → default}/admin/lib/ui/table.tsx +3 -3
- package/resources/templates/{template-workspace → default}/admin/lib/ui/textarea.tsx +10 -7
- package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle-group.tsx +9 -5
- package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle.tsx +3 -5
- package/resources/templates/{template-workspace → default}/admin/lib/ui/tooltip.tsx +4 -3
- package/resources/templates/{template-workspace → default}/admin/lib/upload/dropzone.tsx +14 -10
- package/resources/templates/{template-workspace → default}/admin/lib/upload/repeater.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/upload/ui.tsx +4 -8
- package/resources/templates/{template-workspace → default}/admin/lib/upload/upload-progress.tsx +28 -12
- package/resources/templates/{template-workspace → default}/admin/lib/upload/view.tsx +130 -68
- package/resources/templates/{template-workspace → default}/admin/lib/utils/createComponentOpenHooks.tsx +10 -6
- package/resources/templates/{template-workspace → default}/admin/lib/utils/uic.tsx +24 -14
- package/resources/templates/{template-workspace → default}/admin/lib/utils/use-mobile.ts +1 -3
- package/resources/templates/{template-workspace → default}/admin/package.json +6 -4
- 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 +1 -1
- 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 -25
- package/src/lib/FileSystem.ts +1 -0
- package/src/lib/TemplateInstaller.ts +32 -12
- package/src/lib/packageManagerDetector.ts +24 -0
- package/src/run.ts +8 -7
- package/dist/types/tsconfig.tsbuildinfo +0 -1
- 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/binding/identity.tsx +0 -50
- package/resources/templates/template-workspace/admin/lib/datagrid/elements.tsx +0 -48
- package/resources/templates/template-workspace/admin/lib/dimensions/dimensions.tsx +0 -135
- package/resources/templates/template-workspace/admin/lib/editor/common/buttons.tsx +0 -83
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/BlockElement.tsx +0 -48
- package/resources/templates/template-workspace/admin/lib/editor/sortable-block.tsx +0 -51
- package/resources/templates/template-workspace/admin/lib/form/container.tsx +0 -59
- package/resources/templates/template-workspace/admin/lib/form/upload-repeaters.tsx +0 -188
- package/resources/templates/template-workspace/admin/lib/select/multi-select.tsx +0 -96
- package/resources/templates/template-workspace/admin/lib/select/select.tsx +0 -104
- package/resources/templates/template-workspace/admin/lib/select/sortable-select.tsx +0 -136
- package/resources/templates/template-workspace/admin/lib/toast/toast.tsx +0 -112
- package/resources/templates/template-workspace/admin/lib/ui/button.tsx +0 -29
- package/resources/templates/template-workspace/admin/lib/ui/input.tsx +0 -69
- package/resources/templates/template-workspace/admin/lib/ui/switch.tsx +0 -9
- 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}/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/delete.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/binding/index.ts +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/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/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/index.ts +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 +21 -21
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/layout-switcher.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/todo.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/dimensions/index.ts +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/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/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/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/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/outdated-application-dialog/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/repeater/index.ts +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/tenant/forms/index.ts +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/index.ts +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/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/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/progress.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/upload/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/utils/cn.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/utils/index.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
package/dist/development/run.cjs
CHANGED
|
@@ -7,10 +7,12 @@ const paths = require("./src/paths.cjs");
|
|
|
7
7
|
const FileSystem = require("./src/lib/FileSystem.cjs");
|
|
8
8
|
(async () => {
|
|
9
9
|
const commandManager = new cliCommon.CommandManager({
|
|
10
|
-
["workspace"]: () => new WorkspaceCreateCommand.WorkspaceCreateCommand(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
["workspace"]: () => new WorkspaceCreateCommand.WorkspaceCreateCommand(
|
|
11
|
+
new TemplateInstaller.TemplateInstaller(
|
|
12
|
+
paths.resourcesDir,
|
|
13
|
+
new FileSystem.FileSystem()
|
|
14
|
+
)
|
|
15
|
+
)
|
|
14
16
|
});
|
|
15
17
|
const nodeVersion = process.version.match(/^v?(\d+)\..+$/);
|
|
16
18
|
if (nodeVersion && Number(nodeVersion[1]) < 18) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.cjs","sources":["../../../packages/create/src/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Application, CommandManager } from '@contember/cli-common'\nimport { WorkspaceCreateCommand } from './commands'\nimport { TemplateInstaller } from './lib/TemplateInstaller'\nimport { resourcesDir } from './paths'\nimport { FileSystem } from './lib/FileSystem'\n
|
|
1
|
+
{"version":3,"file":"run.cjs","sources":["../../../packages/create/src/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Application, CommandManager } from '@contember/cli-common'\nimport { WorkspaceCreateCommand } from './commands'\nimport { TemplateInstaller } from './lib/TemplateInstaller'\nimport { resourcesDir } from './paths'\nimport { FileSystem } from './lib/FileSystem'\n;(async () => {\n\tconst commandManager = new CommandManager({\n\t\t['workspace']: () =>\n\t\t\tnew WorkspaceCreateCommand(\n\t\t\t\tnew TemplateInstaller(\n\t\t\t\t\tresourcesDir,\n\t\t\t\t\tnew FileSystem(),\n\t\t\t\t),\n\t\t\t),\n\t})\n\n\tconst nodeVersion = process.version.match(/^v?(\\d+)\\..+$/)\n\tif (nodeVersion && Number(nodeVersion[1]) < 18) {\n\t\tthrow `Node >= 18 is required`\n\t}\n\tconst app = new Application(commandManager, `Contember installer`)\n\tawait app.runCommand('workspace', process.argv.slice(2))\n})().catch(e => {\n\tconsole.log(e)\n\tprocess.exit(1)\n})\n"],"names":["CommandManager","WorkspaceCreateCommand","TemplateInstaller","resourcesDir","FileSystem","Application"],"mappings":";;;;;;;CAME,YAAY;AACb,QAAM,iBAAiB,IAAIA,yBAAe;AAAA,IACzC,CAAC,WAAW,GAAG,MACd,IAAIC,uBAAAA;AAAAA,MACH,IAAIC,kBAAAA;AAAAA,QACHC,MAAAA;AAAAA,QACA,IAAIC,WAAAA,WAAA;AAAA,MAAW;AAAA,IAChB;AAAA,EACD,CACD;AAED,QAAM,cAAc,QAAQ,QAAQ,MAAM,eAAe;AACzD,MAAI,eAAe,OAAO,YAAY,CAAC,CAAC,IAAI,IAAI;AAC/C,UAAM;AAAA,EACP;AACA,QAAM,MAAM,IAAIC,UAAAA,YAAY,gBAAgB,qBAAqB;AACjE,QAAM,IAAI,WAAW,aAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AACxD,KAAK,MAAM,CAAA,MAAK;AACf,UAAQ,IAAI,CAAC;AACb,UAAQ,KAAK,CAAC;AACf,CAAC;"}
|
package/dist/development/run.js
CHANGED
|
@@ -6,10 +6,12 @@ import { resourcesDir } from "./src/paths.js";
|
|
|
6
6
|
import { FileSystem } from "./src/lib/FileSystem.js";
|
|
7
7
|
(async () => {
|
|
8
8
|
const commandManager = new CommandManager({
|
|
9
|
-
["workspace"]: () => new WorkspaceCreateCommand(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
["workspace"]: () => new WorkspaceCreateCommand(
|
|
10
|
+
new TemplateInstaller(
|
|
11
|
+
resourcesDir,
|
|
12
|
+
new FileSystem()
|
|
13
|
+
)
|
|
14
|
+
)
|
|
13
15
|
});
|
|
14
16
|
const nodeVersion = process.version.match(/^v?(\d+)\..+$/);
|
|
15
17
|
if (nodeVersion && Number(nodeVersion[1]) < 18) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sources":["../../../packages/create/src/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Application, CommandManager } from '@contember/cli-common'\nimport { WorkspaceCreateCommand } from './commands'\nimport { TemplateInstaller } from './lib/TemplateInstaller'\nimport { resourcesDir } from './paths'\nimport { FileSystem } from './lib/FileSystem'\n
|
|
1
|
+
{"version":3,"file":"run.js","sources":["../../../packages/create/src/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Application, CommandManager } from '@contember/cli-common'\nimport { WorkspaceCreateCommand } from './commands'\nimport { TemplateInstaller } from './lib/TemplateInstaller'\nimport { resourcesDir } from './paths'\nimport { FileSystem } from './lib/FileSystem'\n;(async () => {\n\tconst commandManager = new CommandManager({\n\t\t['workspace']: () =>\n\t\t\tnew WorkspaceCreateCommand(\n\t\t\t\tnew TemplateInstaller(\n\t\t\t\t\tresourcesDir,\n\t\t\t\t\tnew FileSystem(),\n\t\t\t\t),\n\t\t\t),\n\t})\n\n\tconst nodeVersion = process.version.match(/^v?(\\d+)\\..+$/)\n\tif (nodeVersion && Number(nodeVersion[1]) < 18) {\n\t\tthrow `Node >= 18 is required`\n\t}\n\tconst app = new Application(commandManager, `Contember installer`)\n\tawait app.runCommand('workspace', process.argv.slice(2))\n})().catch(e => {\n\tconsole.log(e)\n\tprocess.exit(1)\n})\n"],"names":[],"mappings":";;;;;;CAME,YAAY;AACb,QAAM,iBAAiB,IAAI,eAAe;AAAA,IACzC,CAAC,WAAW,GAAG,MACd,IAAI;AAAA,MACH,IAAI;AAAA,QACH;AAAA,QACA,IAAI,WAAA;AAAA,MAAW;AAAA,IAChB;AAAA,EACD,CACD;AAED,QAAM,cAAc,QAAQ,QAAQ,MAAM,eAAe;AACzD,MAAI,eAAe,OAAO,YAAY,CAAC,CAAC,IAAI,IAAI;AAC/C,UAAM;AAAA,EACP;AACA,QAAM,MAAM,IAAI,YAAY,gBAAgB,qBAAqB;AACjE,QAAM,IAAI,WAAW,aAAa,QAAQ,KAAK,MAAM,CAAC,CAAC;AACxD,KAAK,MAAM,CAAA,MAAK;AACf,UAAQ,IAAI,CAAC;AACb,UAAQ,KAAK,CAAC;AACf,CAAC;"}
|
|
@@ -4,47 +4,61 @@ const cliCommon = require("@contember/cli-common");
|
|
|
4
4
|
const node_path = require("node:path");
|
|
5
5
|
const chalk = require("chalk");
|
|
6
6
|
const version = require("../lib/version.cjs");
|
|
7
|
+
const packageManagerDetector = require("../lib/packageManagerDetector.cjs");
|
|
7
8
|
class WorkspaceCreateCommand extends cliCommon.Command {
|
|
8
9
|
constructor(templateInstaller) {
|
|
9
10
|
super();
|
|
10
11
|
this.templateInstaller = templateInstaller;
|
|
11
12
|
}
|
|
12
13
|
configure(configuration) {
|
|
13
|
-
configuration.description("Creates a new Contember
|
|
14
|
-
configuration.argument("
|
|
14
|
+
configuration.description("Creates a new Contember project");
|
|
15
|
+
configuration.argument("projectName");
|
|
16
|
+
configuration.option("template").shortcut("t").valueRequired().description("Template name or remote source");
|
|
15
17
|
}
|
|
16
18
|
async execute(input) {
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
19
|
+
const projectName = input.getArgument("projectName");
|
|
20
|
+
const projectDirectory = node_path.join(process.cwd(), projectName);
|
|
21
|
+
const packageManager = packageManagerDetector.detectPackageManager();
|
|
22
|
+
const template = input.getOption("template") ?? "default";
|
|
23
|
+
await this.templateInstaller.installTemplate(template, projectDirectory, {
|
|
20
24
|
version: await version.getPackageVersion(),
|
|
21
|
-
projectName
|
|
25
|
+
projectName,
|
|
26
|
+
packageManager
|
|
22
27
|
});
|
|
23
|
-
console.log(createDocs(
|
|
28
|
+
console.log(createDocs(projectDirectory, projectName, packageManager));
|
|
24
29
|
}
|
|
25
30
|
}
|
|
26
|
-
const createDocs = (
|
|
27
|
-
Contember
|
|
31
|
+
const createDocs = (projectDirectory, projectName, packageManager) => `
|
|
32
|
+
Contember project successfully created in ${projectDirectory}
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
$ ${chalk.greenBright(`cd ${workspaceName}`)}
|
|
34
|
+
Next steps:
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
$ ${chalk.
|
|
36
|
+
1. Navigate to the project directory:
|
|
37
|
+
$ ${chalk.green(`cd ${projectName}`)}
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
$ ${chalk.
|
|
39
|
+
2. Install dependencies:
|
|
40
|
+
$ ${chalk.green(`${packageManager} install`)}
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
3. Start the Contember stack:
|
|
43
|
+
$ ${chalk.green(`${packageManager} start`)}
|
|
39
44
|
|
|
40
|
-
|
|
41
|
-
- Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)
|
|
42
|
-
- Adminer database management tool at http://localhost:1485
|
|
43
|
-
- Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)
|
|
44
|
-
- MailHog testing SMTP at http://localhost:1484
|
|
45
|
-
- PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)
|
|
45
|
+
Available services:
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
${chalk.bold("UI & Admin")}
|
|
48
|
+
- Contember Admin ${chalk.blue("http://localhost:1480")}
|
|
49
|
+
|
|
50
|
+
${chalk.bold("API & Backend")}
|
|
51
|
+
- Contember Engine API ${chalk.blue("http://localhost:1481")}
|
|
52
|
+
Auth token: 0000000000000000000000000000000000000000
|
|
53
|
+
|
|
54
|
+
${chalk.bold("Development Tools")}
|
|
55
|
+
- PostgreSQL database ${chalk.blue("http://localhost:1482")} ${chalk.grey("credentials: contember / contember")}
|
|
56
|
+
- Minio S3 storage ${chalk.blue("http://localhost:1483")}
|
|
57
|
+
- Mailpit SMTP testing ${chalk.blue("http://localhost:1484")}
|
|
58
|
+
- Adminer DB manager ${chalk.blue("http://localhost:1485")}
|
|
59
|
+
- Minio Dashboard ${chalk.blue("http://localhost:1486")} ${chalk.grey("credentials: contember / contember")}
|
|
60
|
+
|
|
61
|
+
${chalk.bold("Need help?")} Ask the community: https://github.com/orgs/contember/discussions
|
|
48
62
|
`;
|
|
49
63
|
exports.WorkspaceCreateCommand = WorkspaceCreateCommand;
|
|
50
64
|
//# sourceMappingURL=WorkspaceCreateCommand.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspaceCreateCommand.cjs","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\n\ntype Args = {\n\
|
|
1
|
+
{"version":3,"file":"WorkspaceCreateCommand.cjs","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\nimport { detectPackageManager } from '../lib/packageManagerDetector'\n\ntype Args = {\n\tprojectName: string\n}\n\ntype Options = {\n\ttemplate: string\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember project')\n\t\tconfiguration.argument('projectName')\n\t\tconfiguration.option('template').shortcut('t').valueRequired().description('Template name or remote source')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst projectName = input.getArgument('projectName')\n\t\tconst projectDirectory = join(process.cwd(), projectName)\n\t\tconst packageManager = detectPackageManager()\n\t\tconst template = input.getOption('template') ?? 'default'\n\n\t\tawait this.templateInstaller.installTemplate(template, projectDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: projectName,\n\t\t\tpackageManager: packageManager,\n\t\t})\n\n\t\tconsole.log(createDocs(projectDirectory, projectName, packageManager))\n\t}\n}\n\nconst createDocs = (projectDirectory: string, projectName: string, packageManager: string) => `\nContember project successfully created in ${projectDirectory}\n\nNext steps:\n\n1. Navigate to the project directory:\n $ ${chalk.green(`cd ${projectName}`)}\n\n2. Install dependencies:\n $ ${chalk.green(`${packageManager} install`)}\n\n3. Start the Contember stack:\n $ ${chalk.green(`${packageManager} start`)}\n\nAvailable services:\n\n${chalk.bold('UI & Admin')}\n- Contember Admin ${chalk.blue('http://localhost:1480')}\n\n${chalk.bold('API & Backend')}\n- Contember Engine API ${chalk.blue('http://localhost:1481')}\n Auth token: 0000000000000000000000000000000000000000\n\n${chalk.bold('Development Tools')}\n- PostgreSQL database ${chalk.blue('http://localhost:1482')} ${chalk.grey('credentials: contember / contember')}\n- Minio S3 storage ${chalk.blue('http://localhost:1483')}\n- Mailpit SMTP testing ${chalk.blue('http://localhost:1484')}\n- Adminer DB manager ${chalk.blue('http://localhost:1485')}\n- Minio Dashboard ${chalk.blue('http://localhost:1486')} ${chalk.grey('credentials: contember / contember')}\n\n${chalk.bold('Need help?')} Ask the community: https://github.com/orgs/contember/discussions\n`\n"],"names":["Command","join","detectPackageManager","getPackageVersion"],"mappings":";;;;;;;AAeO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACD,UAAA;AAFiB,SAAA,oBAAA;AAAA,EAGlB;AAAA,EAEU,UAAU,eAA0D;AAC7E,kBAAc,YAAY,iCAAiC;AAC3D,kBAAc,SAAS,aAAa;AACpC,kBAAc,OAAO,UAAU,EAAE,SAAS,GAAG,EAAE,cAAA,EAAgB,YAAY,gCAAgC;AAAA,EAC5G;AAAA,EAEA,MAAgB,QAAQ,OAA4C;AACnE,UAAM,cAAc,MAAM,YAAY,aAAa;AACnD,UAAM,mBAAmBC,UAAAA,KAAK,QAAQ,IAAA,GAAO,WAAW;AACxD,UAAM,iBAAiBC,uBAAAA,qBAAA;AACvB,UAAM,WAAW,MAAM,UAAU,UAAU,KAAK;AAEhD,UAAM,KAAK,kBAAkB,gBAAgB,UAAU,kBAAkB;AAAA,MACxE,SAAS,MAAMC,QAAAA,kBAAA;AAAA,MACf;AAAA,MACA;AAAA,IAAA,CACA;AAED,YAAQ,IAAI,WAAW,kBAAkB,aAAa,cAAc,CAAC;AAAA,EACtE;AACD;AAEA,MAAM,aAAa,CAAC,kBAA0B,aAAqB,mBAA2B;AAAA,4CAClD,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,OAKrD,MAAM,MAAM,MAAM,WAAW,EAAE,CAAC;AAAA;AAAA;AAAA,OAGhC,MAAM,MAAM,GAAG,cAAc,UAAU,CAAC;AAAA;AAAA;AAAA,OAGxC,MAAM,MAAM,GAAG,cAAc,QAAQ,CAAC;AAAA;AAAA;AAAA;AAAA,EAI3C,MAAM,KAAK,YAAY,CAAC;AAAA,4BACE,MAAM,KAAK,uBAAuB,CAAC;AAAA;AAAA,EAE7D,MAAM,KAAK,eAAe,CAAC;AAAA,4BACD,MAAM,KAAK,uBAAuB,CAAC;AAAA;AAAA;AAAA,EAG7D,MAAM,KAAK,mBAAmB,CAAC;AAAA,4BACL,MAAM,KAAK,uBAAuB,CAAC,OAAO,MAAM,KAAK,oCAAoC,CAAC;AAAA,4BAC1F,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC,OAAO,MAAM,KAAK,oCAAoC,CAAC;AAAA;AAAA,EAEpH,MAAM,KAAK,YAAY,CAAC;AAAA;;"}
|
|
@@ -2,47 +2,61 @@ import { Command } from "@contember/cli-common";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import { getPackageVersion } from "../lib/version.js";
|
|
5
|
+
import { detectPackageManager } from "../lib/packageManagerDetector.js";
|
|
5
6
|
class WorkspaceCreateCommand extends Command {
|
|
6
7
|
constructor(templateInstaller) {
|
|
7
8
|
super();
|
|
8
9
|
this.templateInstaller = templateInstaller;
|
|
9
10
|
}
|
|
10
11
|
configure(configuration) {
|
|
11
|
-
configuration.description("Creates a new Contember
|
|
12
|
-
configuration.argument("
|
|
12
|
+
configuration.description("Creates a new Contember project");
|
|
13
|
+
configuration.argument("projectName");
|
|
14
|
+
configuration.option("template").shortcut("t").valueRequired().description("Template name or remote source");
|
|
13
15
|
}
|
|
14
16
|
async execute(input) {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
17
|
+
const projectName = input.getArgument("projectName");
|
|
18
|
+
const projectDirectory = join(process.cwd(), projectName);
|
|
19
|
+
const packageManager = detectPackageManager();
|
|
20
|
+
const template = input.getOption("template") ?? "default";
|
|
21
|
+
await this.templateInstaller.installTemplate(template, projectDirectory, {
|
|
18
22
|
version: await getPackageVersion(),
|
|
19
|
-
projectName
|
|
23
|
+
projectName,
|
|
24
|
+
packageManager
|
|
20
25
|
});
|
|
21
|
-
console.log(createDocs(
|
|
26
|
+
console.log(createDocs(projectDirectory, projectName, packageManager));
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
|
-
const createDocs = (
|
|
25
|
-
Contember
|
|
29
|
+
const createDocs = (projectDirectory, projectName, packageManager) => `
|
|
30
|
+
Contember project successfully created in ${projectDirectory}
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
$ ${chalk.greenBright(`cd ${workspaceName}`)}
|
|
32
|
+
Next steps:
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
$ ${chalk.
|
|
34
|
+
1. Navigate to the project directory:
|
|
35
|
+
$ ${chalk.green(`cd ${projectName}`)}
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
$ ${chalk.
|
|
37
|
+
2. Install dependencies:
|
|
38
|
+
$ ${chalk.green(`${packageManager} install`)}
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
3. Start the Contember stack:
|
|
41
|
+
$ ${chalk.green(`${packageManager} start`)}
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
- Contember Engine endpoints at http://localhost:1481 (you can authorize with token 0000000000000000000000000000000000000000)
|
|
40
|
-
- Adminer database management tool at http://localhost:1485
|
|
41
|
-
- Minio local S3 provider at http://localhost:1483 (you can sign in with contember / contember credentials)
|
|
42
|
-
- MailHog testing SMTP at http://localhost:1484
|
|
43
|
-
- PostgreSQL database at localhost:1482 (you can sign in with contember / contember credentials)
|
|
43
|
+
Available services:
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
${chalk.bold("UI & Admin")}
|
|
46
|
+
- Contember Admin ${chalk.blue("http://localhost:1480")}
|
|
47
|
+
|
|
48
|
+
${chalk.bold("API & Backend")}
|
|
49
|
+
- Contember Engine API ${chalk.blue("http://localhost:1481")}
|
|
50
|
+
Auth token: 0000000000000000000000000000000000000000
|
|
51
|
+
|
|
52
|
+
${chalk.bold("Development Tools")}
|
|
53
|
+
- PostgreSQL database ${chalk.blue("http://localhost:1482")} ${chalk.grey("credentials: contember / contember")}
|
|
54
|
+
- Minio S3 storage ${chalk.blue("http://localhost:1483")}
|
|
55
|
+
- Mailpit SMTP testing ${chalk.blue("http://localhost:1484")}
|
|
56
|
+
- Adminer DB manager ${chalk.blue("http://localhost:1485")}
|
|
57
|
+
- Minio Dashboard ${chalk.blue("http://localhost:1486")} ${chalk.grey("credentials: contember / contember")}
|
|
58
|
+
|
|
59
|
+
${chalk.bold("Need help?")} Ask the community: https://github.com/orgs/contember/discussions
|
|
46
60
|
`;
|
|
47
61
|
export {
|
|
48
62
|
WorkspaceCreateCommand
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspaceCreateCommand.js","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\n\ntype Args = {\n\
|
|
1
|
+
{"version":3,"file":"WorkspaceCreateCommand.js","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\nimport { detectPackageManager } from '../lib/packageManagerDetector'\n\ntype Args = {\n\tprojectName: string\n}\n\ntype Options = {\n\ttemplate: string\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember project')\n\t\tconfiguration.argument('projectName')\n\t\tconfiguration.option('template').shortcut('t').valueRequired().description('Template name or remote source')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst projectName = input.getArgument('projectName')\n\t\tconst projectDirectory = join(process.cwd(), projectName)\n\t\tconst packageManager = detectPackageManager()\n\t\tconst template = input.getOption('template') ?? 'default'\n\n\t\tawait this.templateInstaller.installTemplate(template, projectDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: projectName,\n\t\t\tpackageManager: packageManager,\n\t\t})\n\n\t\tconsole.log(createDocs(projectDirectory, projectName, packageManager))\n\t}\n}\n\nconst createDocs = (projectDirectory: string, projectName: string, packageManager: string) => `\nContember project successfully created in ${projectDirectory}\n\nNext steps:\n\n1. Navigate to the project directory:\n $ ${chalk.green(`cd ${projectName}`)}\n\n2. Install dependencies:\n $ ${chalk.green(`${packageManager} install`)}\n\n3. Start the Contember stack:\n $ ${chalk.green(`${packageManager} start`)}\n\nAvailable services:\n\n${chalk.bold('UI & Admin')}\n- Contember Admin ${chalk.blue('http://localhost:1480')}\n\n${chalk.bold('API & Backend')}\n- Contember Engine API ${chalk.blue('http://localhost:1481')}\n Auth token: 0000000000000000000000000000000000000000\n\n${chalk.bold('Development Tools')}\n- PostgreSQL database ${chalk.blue('http://localhost:1482')} ${chalk.grey('credentials: contember / contember')}\n- Minio S3 storage ${chalk.blue('http://localhost:1483')}\n- Mailpit SMTP testing ${chalk.blue('http://localhost:1484')}\n- Adminer DB manager ${chalk.blue('http://localhost:1485')}\n- Minio Dashboard ${chalk.blue('http://localhost:1486')} ${chalk.grey('credentials: contember / contember')}\n\n${chalk.bold('Need help?')} Ask the community: https://github.com/orgs/contember/discussions\n`\n"],"names":[],"mappings":";;;;;AAeO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACD,UAAA;AAFiB,SAAA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AAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC,OAAO,MAAM,KAAK,oCAAoC,CAAC;AAAA;AAAA,EAEpH,MAAM,KAAK,YAAY,CAAC;AAAA;"}
|
|
@@ -31,6 +31,7 @@ class FileSystem {
|
|
|
31
31
|
__publicField(this, "readDir", fs__namespace.readdir);
|
|
32
32
|
__publicField(this, "copy", fsExtra.copy);
|
|
33
33
|
__publicField(this, "unlink", fs__namespace.unlink);
|
|
34
|
+
__publicField(this, "remove", fs__namespace.rm);
|
|
34
35
|
__publicField(this, "pathExists", async (path) => {
|
|
35
36
|
try {
|
|
36
37
|
await fs.access(path);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileSystem.cjs","sources":["../../../../../packages/create/src/lib/FileSystem.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport { access } from 'node:fs/promises'\nimport { copy } from 'fs-extra'\nimport { tmpdir } from 'node:os'\n\nexport class FileSystem {\n\treadFile = fs.readFile\n\twriteFile = fs.writeFile\n\trename = fs.rename\n\treadDir = fs.readdir\n\tcopy = copy\n\tunlink = fs.unlink\n\tpathExists = async (path: string) => {\n\t\ttry {\n\t\t\tawait access(path)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\tcreateTempDir = async () => {\n\t\treturn await fs.mkdtemp(tmpdir())\n\t}\n}\n"],"names":["fs","copy","access","tmpdir"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,WAAW;AAAA,EAAjB,cAAA;AACN,kBAAA,MAAA,YAAWA,cAAG,QAAA;AACd,kBAAA,MAAA,aAAYA,cAAG,SAAA;AACf,kBAAA,MAAA,UAASA,cAAG,MAAA;AACZ,kBAAA,MAAA,WAAUA,cAAG,OAAA;
|
|
1
|
+
{"version":3,"file":"FileSystem.cjs","sources":["../../../../../packages/create/src/lib/FileSystem.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport { access } from 'node:fs/promises'\nimport { copy } from 'fs-extra'\nimport { tmpdir } from 'node:os'\n\nexport class FileSystem {\n\treadFile = fs.readFile\n\twriteFile = fs.writeFile\n\trename = fs.rename\n\treadDir = fs.readdir\n\tcopy = copy\n\tunlink = fs.unlink\n\tremove = fs.rm\n\tpathExists = async (path: string) => {\n\t\ttry {\n\t\t\tawait access(path)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\tcreateTempDir = async () => {\n\t\treturn await fs.mkdtemp(tmpdir())\n\t}\n}\n"],"names":["fs","copy","access","tmpdir"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAKO,MAAM,WAAW;AAAA,EAAjB,cAAA;AACN,kBAAA,MAAA,YAAWA,cAAG,QAAA;AACd,kBAAA,MAAA,aAAYA,cAAG,SAAA;AACf,kBAAA,MAAA,UAASA,cAAG,MAAA;AACZ,kBAAA,MAAA,WAAUA,cAAG,OAAA;AACb,kBAAA,MAAA,QAAOC,YAAA;AACP,kBAAA,MAAA,UAASD,cAAG,MAAA;AACZ,kBAAA,MAAA,UAASA,cAAG,EAAA;AACZ,kBAAA,MAAA,cAAa,OAAO,SAAiB;AACpC,UAAI;AACH,cAAME,GAAAA,OAAO,IAAI;AACjB,eAAO;AAAA,MACR,QAAQ;AACP,eAAO;AAAA,MACR;AAAA,IACD,CAAA;AACA,kBAAA,MAAA,iBAAgB,YAAY;AAC3B,aAAO,MAAMF,cAAG,QAAQG,GAAAA,QAAQ;AAAA,IACjC,CAAA;AAAA,EAAA;AACD;;"}
|
|
@@ -13,6 +13,7 @@ class FileSystem {
|
|
|
13
13
|
__publicField(this, "readDir", fs.readdir);
|
|
14
14
|
__publicField(this, "copy", copy);
|
|
15
15
|
__publicField(this, "unlink", fs.unlink);
|
|
16
|
+
__publicField(this, "remove", fs.rm);
|
|
16
17
|
__publicField(this, "pathExists", async (path) => {
|
|
17
18
|
try {
|
|
18
19
|
await access(path);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileSystem.js","sources":["../../../../../packages/create/src/lib/FileSystem.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport { access } from 'node:fs/promises'\nimport { copy } from 'fs-extra'\nimport { tmpdir } from 'node:os'\n\nexport class FileSystem {\n\treadFile = fs.readFile\n\twriteFile = fs.writeFile\n\trename = fs.rename\n\treadDir = fs.readdir\n\tcopy = copy\n\tunlink = fs.unlink\n\tpathExists = async (path: string) => {\n\t\ttry {\n\t\t\tawait access(path)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\tcreateTempDir = async () => {\n\t\treturn await fs.mkdtemp(tmpdir())\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAKO,MAAM,WAAW;AAAA,EAAjB,cAAA;AACN,kBAAA,MAAA,YAAW,GAAG,QAAA;AACd,kBAAA,MAAA,aAAY,GAAG,SAAA;AACf,kBAAA,MAAA,UAAS,GAAG,MAAA;AACZ,kBAAA,MAAA,WAAU,GAAG,OAAA;
|
|
1
|
+
{"version":3,"file":"FileSystem.js","sources":["../../../../../packages/create/src/lib/FileSystem.ts"],"sourcesContent":["import * as fs from 'node:fs/promises'\nimport { access } from 'node:fs/promises'\nimport { copy } from 'fs-extra'\nimport { tmpdir } from 'node:os'\n\nexport class FileSystem {\n\treadFile = fs.readFile\n\twriteFile = fs.writeFile\n\trename = fs.rename\n\treadDir = fs.readdir\n\tcopy = copy\n\tunlink = fs.unlink\n\tremove = fs.rm\n\tpathExists = async (path: string) => {\n\t\ttry {\n\t\t\tawait access(path)\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\tcreateTempDir = async () => {\n\t\treturn await fs.mkdtemp(tmpdir())\n\t}\n}\n"],"names":[],"mappings":";;;;;;;AAKO,MAAM,WAAW;AAAA,EAAjB,cAAA;AACN,kBAAA,MAAA,YAAW,GAAG,QAAA;AACd,kBAAA,MAAA,aAAY,GAAG,SAAA;AACf,kBAAA,MAAA,UAAS,GAAG,MAAA;AACZ,kBAAA,MAAA,WAAU,GAAG,OAAA;AACb,kBAAA,MAAA,QAAO,IAAA;AACP,kBAAA,MAAA,UAAS,GAAG,MAAA;AACZ,kBAAA,MAAA,UAAS,GAAG,EAAA;AACZ,kBAAA,MAAA,cAAa,OAAO,SAAiB;AACpC,UAAI;AACH,cAAM,OAAO,IAAI;AACjB,eAAO;AAAA,MACR,QAAQ;AACP,eAAO;AAAA,MACR;AAAA,IACD,CAAA;AACA,kBAAA,MAAA,iBAAgB,YAAY;AAC3B,aAAO,MAAM,GAAG,QAAQ,QAAQ;AAAA,IACjC,CAAA;AAAA,EAAA;AACD;"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const node_path = require("node:path");
|
|
4
4
|
const jsyaml = require("js-yaml");
|
|
5
|
+
const degit = require("degit");
|
|
5
6
|
var __defProp = Object.defineProperty;
|
|
6
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
8
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -9,18 +10,33 @@ class TemplateInstaller {
|
|
|
9
10
|
constructor(resourceDir, fs) {
|
|
10
11
|
this.resourceDir = resourceDir;
|
|
11
12
|
this.fs = fs;
|
|
12
|
-
__publicField(this, "localTemplates"
|
|
13
|
-
["@contember/template-workspace"]: node_path.join(this.resourceDir, "templates/template-workspace")
|
|
14
|
-
});
|
|
13
|
+
__publicField(this, "localTemplates");
|
|
15
14
|
__publicField(this, "installTemplate", async (template, targetDir, variables = {}) => {
|
|
16
15
|
let removeTemplate = () => {
|
|
17
16
|
};
|
|
18
17
|
if (this.localTemplates[template]) {
|
|
19
18
|
template = this.localTemplates[template];
|
|
19
|
+
} else {
|
|
20
|
+
const tmpDir = await this.fs.createTempDir();
|
|
21
|
+
try {
|
|
22
|
+
const emitter = degit(template, { cache: false, force: true, verbose: true });
|
|
23
|
+
await emitter.clone(tmpDir);
|
|
24
|
+
removeTemplate = () => {
|
|
25
|
+
try {
|
|
26
|
+
this.fs.remove(tmpDir, { recursive: true, force: true });
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error(`Failed to clean up template: ${error}`);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
template = tmpDir;
|
|
32
|
+
} catch (error) {
|
|
33
|
+
throw new Error(`Failed to clone template from repository: ${error}`);
|
|
34
|
+
}
|
|
20
35
|
}
|
|
21
36
|
const templateConfigFile = node_path.join(template, "contember.template.yaml");
|
|
22
37
|
if (!await this.fs.pathExists(templateConfigFile)) {
|
|
23
|
-
|
|
38
|
+
removeTemplate();
|
|
39
|
+
throw new Error(`${template} is not a Contember template`);
|
|
24
40
|
}
|
|
25
41
|
const config = await this.readYaml(templateConfigFile);
|
|
26
42
|
const nodeModulesDir = node_path.join(template, "node_modules");
|
|
@@ -31,7 +47,7 @@ class TemplateInstaller {
|
|
|
31
47
|
await this.fs.copy(template, targetDir, {
|
|
32
48
|
filter: (src) => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src)
|
|
33
49
|
});
|
|
34
|
-
|
|
50
|
+
removeTemplate();
|
|
35
51
|
if (config.patchPackageJson) {
|
|
36
52
|
await this.replaceFileContent(node_path.join(targetDir, "package.json"), (content) => {
|
|
37
53
|
const {
|
|
@@ -56,13 +72,10 @@ class TemplateInstaller {
|
|
|
56
72
|
if (!await this.fs.pathExists(path)) {
|
|
57
73
|
continue;
|
|
58
74
|
}
|
|
59
|
-
await this.replaceFileContent(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
content
|
|
64
|
-
)
|
|
65
|
-
);
|
|
75
|
+
await this.replaceFileContent(path, (content) => Object.entries(variables).reduce(
|
|
76
|
+
(content2, [key, value]) => content2.replace(new RegExp(`{${key}}`, "g"), value),
|
|
77
|
+
content
|
|
78
|
+
));
|
|
66
79
|
}
|
|
67
80
|
});
|
|
68
81
|
__publicField(this, "replaceFileContent", async (path, replacer) => {
|
|
@@ -74,6 +87,9 @@ class TemplateInstaller {
|
|
|
74
87
|
const content = await this.fs.readFile(path, { encoding: "utf8" });
|
|
75
88
|
return jsyaml.load(content);
|
|
76
89
|
});
|
|
90
|
+
this.localTemplates = {
|
|
91
|
+
["default"]: node_path.join(this.resourceDir, "templates/default")
|
|
92
|
+
};
|
|
77
93
|
}
|
|
78
94
|
}
|
|
79
95
|
exports.TemplateInstaller = TemplateInstaller;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateInstaller.cjs","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\
|
|
1
|
+
{"version":3,"file":"TemplateInstaller.cjs","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\nimport degit from 'degit'\n\nexport class TemplateInstaller {\n\tprivate localTemplates: Record<string, string>\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t\tthis.localTemplates = {\n\t\t\t['default']: join(this.resourceDir, 'templates/default'),\n\t\t}\n\t}\n\n\tinstallTemplate = async (\n\t\ttemplate: string,\n\t\ttargetDir: string,\n\t\tvariables: Record<string, string> = {},\n\t) => {\n\t\tlet removeTemplate = () => {}\n\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t} else {\n\t\t\tconst tmpDir = await this.fs.createTempDir()\n\n\t\t\ttry {\n\t\t\t\tconst emitter = degit(template, { cache: false, force: true, verbose: true })\n\t\t\t\tawait emitter.clone(tmpDir)\n\n\t\t\t\tremoveTemplate = () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.fs.remove(tmpDir, { recursive: true, force: true })\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconsole.error(`Failed to clean up template: ${error}`)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttemplate = tmpDir\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(`Failed to clone template from repository: ${error}`)\n\t\t\t}\n\t\t}\n\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tremoveTemplate()\n\t\t\tthrow new Error(`${template} is not a Contember template`)\n\t\t}\n\t\tconst config = (await this.readYaml(templateConfigFile)) as {\n\t\t\ttype?: string\n\t\t\tremove?: string[]\n\t\t\tpatchPackageJson?: boolean\n\t\t\trename?: Record<string, string>\n\t\t\tcopy?: Record<string, string>\n\t\t\treplaceVariables?: string[]\n\t\t}\n\t\tconst nodeModulesDir = join(template, 'node_modules')\n\t\tconst skippedFiles = new Set([...(config.remove || []).map(it => join(template, it)), templateConfigFile])\n\t\tif (await this.fs.pathExists(targetDir)) {\n\t\t\tthrow `${targetDir} already exists`\n\t\t}\n\t\tawait this.fs.copy(template, targetDir, {\n\t\t\tfilter: src => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src),\n\t\t})\n\n\t\tremoveTemplate()\n\n\t\tif (config.patchPackageJson) {\n\t\t\tawait this.replaceFileContent(join(targetDir, 'package.json'), content => {\n\t\t\t\tconst {\n\t\t\t\t\tname,\n\t\t\t\t\tversion,\n\t\t\t\t\t'scripts-template': scripts,\n\t\t\t\t\tscripts: _nullScripts,\n\t\t\t\t\tlicense,\n\t\t\t\t\t...json\n\t\t\t\t} = JSON.parse(content)\n\t\t\t\treturn JSON.stringify({ scripts, ...json }, null, ' ')\n\t\t\t})\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.rename || {})) {\n\t\t\tawait this.fs.rename(join(targetDir, source), join(targetDir, target))\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.copy || {})) {\n\t\t\tawait this.fs.copy(join(targetDir, source), join(targetDir, target))\n\t\t}\n\n\t\tfor (const file of config.replaceVariables || []) {\n\t\t\tconst path = join(targetDir, file)\n\t\t\tif (!(await this.fs.pathExists(path))) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tawait this.replaceFileContent(path, content =>\n\t\t\t\tObject.entries(variables).reduce(\n\t\t\t\t\t(content, [key, value]) => content.replace(new RegExp(`{${key}}`, 'g'), value),\n\t\t\t\t\tcontent,\n\t\t\t\t))\n\t\t}\n\t}\n\n\tprivate replaceFileContent = async (path: string, replacer: (content: string) => string): Promise<void> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\tconst newContent = replacer(content)\n\t\tawait this.fs.writeFile(path, newContent, { encoding: 'utf8' })\n\t}\n\n\tprivate readYaml = async <T = unknown>(path: string): Promise<T> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\treturn jsyaml.load(content) as unknown as T\n\t}\n}\n"],"names":["join","content"],"mappings":";;;;;;;;AAKO,MAAM,kBAAkB;AAAA,EAG9B,YACkB,aACA,IAChB;AAFgB,SAAA,cAAA;AACA,SAAA,KAAA;AAJlB,kBAAA,MAAQ,gBAAA;AAWR,kBAAA,MAAA,mBAAkB,OACjB,UACA,WACA,YAAoC,OAChC;AACJ,UAAI,iBAAiB,MAAM;AAAA,MAAC;AAE5B,UAAI,KAAK,eAAe,QAAQ,GAAG;AAClC,mBAAW,KAAK,eAAe,QAAQ;AAAA,MACxC,OAAO;AACN,cAAM,SAAS,MAAM,KAAK,GAAG,cAAA;AAE7B,YAAI;AACH,gBAAM,UAAU,MAAM,UAAU,EAAE,OAAO,OAAO,OAAO,MAAM,SAAS,MAAM;AAC5E,gBAAM,QAAQ,MAAM,MAAM;AAE1B,2BAAiB,MAAM;AACtB,gBAAI;AACH,mBAAK,GAAG,OAAO,QAAQ,EAAE,WAAW,MAAM,OAAO,MAAM;AAAA,YACxD,SA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
|
|
2
2
|
import jsyaml__default from "js-yaml";
|
|
3
|
+
import degit from "degit";
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
6
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -7,18 +8,33 @@ class TemplateInstaller {
|
|
|
7
8
|
constructor(resourceDir, fs) {
|
|
8
9
|
this.resourceDir = resourceDir;
|
|
9
10
|
this.fs = fs;
|
|
10
|
-
__publicField(this, "localTemplates"
|
|
11
|
-
["@contember/template-workspace"]: join(this.resourceDir, "templates/template-workspace")
|
|
12
|
-
});
|
|
11
|
+
__publicField(this, "localTemplates");
|
|
13
12
|
__publicField(this, "installTemplate", async (template, targetDir, variables = {}) => {
|
|
14
13
|
let removeTemplate = () => {
|
|
15
14
|
};
|
|
16
15
|
if (this.localTemplates[template]) {
|
|
17
16
|
template = this.localTemplates[template];
|
|
17
|
+
} else {
|
|
18
|
+
const tmpDir = await this.fs.createTempDir();
|
|
19
|
+
try {
|
|
20
|
+
const emitter = degit(template, { cache: false, force: true, verbose: true });
|
|
21
|
+
await emitter.clone(tmpDir);
|
|
22
|
+
removeTemplate = () => {
|
|
23
|
+
try {
|
|
24
|
+
this.fs.remove(tmpDir, { recursive: true, force: true });
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error(`Failed to clean up template: ${error}`);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
template = tmpDir;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
throw new Error(`Failed to clone template from repository: ${error}`);
|
|
32
|
+
}
|
|
18
33
|
}
|
|
19
34
|
const templateConfigFile = join(template, "contember.template.yaml");
|
|
20
35
|
if (!await this.fs.pathExists(templateConfigFile)) {
|
|
21
|
-
|
|
36
|
+
removeTemplate();
|
|
37
|
+
throw new Error(`${template} is not a Contember template`);
|
|
22
38
|
}
|
|
23
39
|
const config = await this.readYaml(templateConfigFile);
|
|
24
40
|
const nodeModulesDir = join(template, "node_modules");
|
|
@@ -29,7 +45,7 @@ class TemplateInstaller {
|
|
|
29
45
|
await this.fs.copy(template, targetDir, {
|
|
30
46
|
filter: (src) => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src)
|
|
31
47
|
});
|
|
32
|
-
|
|
48
|
+
removeTemplate();
|
|
33
49
|
if (config.patchPackageJson) {
|
|
34
50
|
await this.replaceFileContent(join(targetDir, "package.json"), (content) => {
|
|
35
51
|
const {
|
|
@@ -54,13 +70,10 @@ class TemplateInstaller {
|
|
|
54
70
|
if (!await this.fs.pathExists(path)) {
|
|
55
71
|
continue;
|
|
56
72
|
}
|
|
57
|
-
await this.replaceFileContent(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
content
|
|
62
|
-
)
|
|
63
|
-
);
|
|
73
|
+
await this.replaceFileContent(path, (content) => Object.entries(variables).reduce(
|
|
74
|
+
(content2, [key, value]) => content2.replace(new RegExp(`{${key}}`, "g"), value),
|
|
75
|
+
content
|
|
76
|
+
));
|
|
64
77
|
}
|
|
65
78
|
});
|
|
66
79
|
__publicField(this, "replaceFileContent", async (path, replacer) => {
|
|
@@ -72,6 +85,9 @@ class TemplateInstaller {
|
|
|
72
85
|
const content = await this.fs.readFile(path, { encoding: "utf8" });
|
|
73
86
|
return jsyaml__default.load(content);
|
|
74
87
|
});
|
|
88
|
+
this.localTemplates = {
|
|
89
|
+
["default"]: join(this.resourceDir, "templates/default")
|
|
90
|
+
};
|
|
75
91
|
}
|
|
76
92
|
}
|
|
77
93
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateInstaller.js","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\
|
|
1
|
+
{"version":3,"file":"TemplateInstaller.js","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\nimport degit from 'degit'\n\nexport class TemplateInstaller {\n\tprivate localTemplates: Record<string, string>\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t\tthis.localTemplates = {\n\t\t\t['default']: join(this.resourceDir, 'templates/default'),\n\t\t}\n\t}\n\n\tinstallTemplate = async (\n\t\ttemplate: string,\n\t\ttargetDir: string,\n\t\tvariables: Record<string, string> = {},\n\t) => {\n\t\tlet removeTemplate = () => {}\n\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t} else {\n\t\t\tconst tmpDir = await this.fs.createTempDir()\n\n\t\t\ttry {\n\t\t\t\tconst emitter = degit(template, { cache: false, force: true, verbose: true })\n\t\t\t\tawait emitter.clone(tmpDir)\n\n\t\t\t\tremoveTemplate = () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.fs.remove(tmpDir, { recursive: true, force: true })\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconsole.error(`Failed to clean up template: ${error}`)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\ttemplate = tmpDir\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(`Failed to clone template from repository: ${error}`)\n\t\t\t}\n\t\t}\n\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tremoveTemplate()\n\t\t\tthrow new Error(`${template} is not a Contember template`)\n\t\t}\n\t\tconst config = (await this.readYaml(templateConfigFile)) as {\n\t\t\ttype?: string\n\t\t\tremove?: string[]\n\t\t\tpatchPackageJson?: boolean\n\t\t\trename?: Record<string, string>\n\t\t\tcopy?: Record<string, string>\n\t\t\treplaceVariables?: string[]\n\t\t}\n\t\tconst nodeModulesDir = join(template, 'node_modules')\n\t\tconst skippedFiles = new Set([...(config.remove || []).map(it => join(template, it)), templateConfigFile])\n\t\tif (await this.fs.pathExists(targetDir)) {\n\t\t\tthrow `${targetDir} already exists`\n\t\t}\n\t\tawait this.fs.copy(template, targetDir, {\n\t\t\tfilter: src => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src),\n\t\t})\n\n\t\tremoveTemplate()\n\n\t\tif (config.patchPackageJson) {\n\t\t\tawait this.replaceFileContent(join(targetDir, 'package.json'), content => {\n\t\t\t\tconst {\n\t\t\t\t\tname,\n\t\t\t\t\tversion,\n\t\t\t\t\t'scripts-template': scripts,\n\t\t\t\t\tscripts: _nullScripts,\n\t\t\t\t\tlicense,\n\t\t\t\t\t...json\n\t\t\t\t} = JSON.parse(content)\n\t\t\t\treturn JSON.stringify({ scripts, ...json }, null, ' ')\n\t\t\t})\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.rename || {})) {\n\t\t\tawait this.fs.rename(join(targetDir, source), join(targetDir, target))\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.copy || {})) {\n\t\t\tawait this.fs.copy(join(targetDir, source), join(targetDir, target))\n\t\t}\n\n\t\tfor (const file of config.replaceVariables || []) {\n\t\t\tconst path = join(targetDir, file)\n\t\t\tif (!(await this.fs.pathExists(path))) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tawait this.replaceFileContent(path, content =>\n\t\t\t\tObject.entries(variables).reduce(\n\t\t\t\t\t(content, [key, value]) => content.replace(new RegExp(`{${key}}`, 'g'), value),\n\t\t\t\t\tcontent,\n\t\t\t\t))\n\t\t}\n\t}\n\n\tprivate replaceFileContent = async (path: string, replacer: (content: string) => string): Promise<void> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\tconst newContent = replacer(content)\n\t\tawait this.fs.writeFile(path, newContent, { encoding: 'utf8' })\n\t}\n\n\tprivate readYaml = async <T = unknown>(path: string): Promise<T> => {\n\t\tconst content = await this.fs.readFile(path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QAAA,CACA;AAAA,MACH;AAAA,IACD,CAAA;AAEA,kBAAA,MAAQ,sBAAqB,OAAO,MAAc,aAAyD;AAC1G,YAAM,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AACjE,YAAM,aAAa,SAAS,OAAO;AACnC,YAAM,KAAK,GAAG,UAAU,MAAM,YAAY,EAAE,UAAU,QAAQ;AAAA,IAC/D,CAAA;AAEA,kBAAA,MAAQ,YAAW,OAAoB,SAA6B;AACnE,YAAM,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AACjE,aAAOC,gBAAO,KAAK,OAAO;AAAA,IAC3B,CAAA;AArGC,SAAK,iBAAiB;AAAA,MACrB,CAAC,SAAS,GAAG,KAAK,KAAK,aAAa,mBAAmB;AAAA,IAAA;AAAA,EAEzD;AAmGD;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const node_fs = require("node:fs");
|
|
4
|
+
const node_path = require("node:path");
|
|
5
|
+
const detectPackageManager = () => {
|
|
6
|
+
const userAgent = process.env.npm_config_user_agent;
|
|
7
|
+
if (userAgent) {
|
|
8
|
+
if (userAgent.startsWith("yarn/")) return "yarn";
|
|
9
|
+
if (userAgent.startsWith("pnpm/")) return "pnpm";
|
|
10
|
+
if (userAgent.startsWith("npm/")) return "npm";
|
|
11
|
+
if (userAgent.startsWith("bun/")) return "bun";
|
|
12
|
+
}
|
|
13
|
+
const cwd = process.cwd();
|
|
14
|
+
if (node_fs.existsSync(node_path.join(cwd, "yarn.lock"))) return "yarn";
|
|
15
|
+
if (node_fs.existsSync(node_path.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
16
|
+
if (node_fs.existsSync(node_path.join(cwd, "package-lock.json"))) return "npm";
|
|
17
|
+
if (node_fs.existsSync(node_path.join(cwd, "bun.lockb"))) return "bun";
|
|
18
|
+
if (node_fs.existsSync(node_path.join(cwd, "bun.lock"))) return "bun";
|
|
19
|
+
return "npm";
|
|
20
|
+
};
|
|
21
|
+
exports.detectPackageManager = detectPackageManager;
|
|
22
|
+
//# sourceMappingURL=packageManagerDetector.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageManagerDetector.cjs","sources":["../../../../../packages/create/src/lib/packageManagerDetector.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { join } from 'node:path'\n\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun'\n\nexport const detectPackageManager = (): PackageManager => {\n\tconst userAgent = process.env.npm_config_user_agent\n\n\tif (userAgent) {\n\t\tif (userAgent.startsWith('yarn/')) return 'yarn'\n\t\tif (userAgent.startsWith('pnpm/')) return 'pnpm'\n\t\tif (userAgent.startsWith('npm/')) return 'npm'\n\t\tif (userAgent.startsWith('bun/')) return 'bun'\n\t}\n\n\tconst cwd = process.cwd()\n\tif (existsSync(join(cwd, 'yarn.lock'))) return 'yarn'\n\tif (existsSync(join(cwd, 'pnpm-lock.yaml'))) return 'pnpm'\n\tif (existsSync(join(cwd, 'package-lock.json'))) return 'npm'\n\tif (existsSync(join(cwd, 'bun.lockb'))) return 'bun'\n\tif (existsSync(join(cwd, 'bun.lock'))) return 'bun'\n\n\treturn 'npm'\n}\n"],"names":["existsSync","join"],"mappings":";;;;AAKO,MAAM,uBAAuB,MAAsB;AACzD,QAAM,YAAY,QAAQ,IAAI;AAE9B,MAAI,WAAW;AACd,QAAI,UAAU,WAAW,OAAO,EAAG,QAAO;AAC1C,QAAI,UAAU,WAAW,OAAO,EAAG,QAAO;AAC1C,QAAI,UAAU,WAAW,MAAM,EAAG,QAAO;AACzC,QAAI,UAAU,WAAW,MAAM,EAAG,QAAO;AAAA,EAC1C;AAEA,QAAM,MAAM,QAAQ,IAAA;AACpB,MAAIA,QAAAA,WAAWC,UAAAA,KAAK,KAAK,WAAW,CAAC,EAAG,QAAO;AAC/C,MAAID,QAAAA,WAAWC,UAAAA,KAAK,KAAK,gBAAgB,CAAC,EAAG,QAAO;AACpD,MAAID,QAAAA,WAAWC,UAAAA,KAAK,KAAK,mBAAmB,CAAC,EAAG,QAAO;AACvD,MAAID,QAAAA,WAAWC,UAAAA,KAAK,KAAK,WAAW,CAAC,EAAG,QAAO;AAC/C,MAAID,QAAAA,WAAWC,UAAAA,KAAK,KAAK,UAAU,CAAC,EAAG,QAAO;AAE9C,SAAO;AACR;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
const detectPackageManager = () => {
|
|
4
|
+
const userAgent = process.env.npm_config_user_agent;
|
|
5
|
+
if (userAgent) {
|
|
6
|
+
if (userAgent.startsWith("yarn/")) return "yarn";
|
|
7
|
+
if (userAgent.startsWith("pnpm/")) return "pnpm";
|
|
8
|
+
if (userAgent.startsWith("npm/")) return "npm";
|
|
9
|
+
if (userAgent.startsWith("bun/")) return "bun";
|
|
10
|
+
}
|
|
11
|
+
const cwd = process.cwd();
|
|
12
|
+
if (existsSync(join(cwd, "yarn.lock"))) return "yarn";
|
|
13
|
+
if (existsSync(join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
14
|
+
if (existsSync(join(cwd, "package-lock.json"))) return "npm";
|
|
15
|
+
if (existsSync(join(cwd, "bun.lockb"))) return "bun";
|
|
16
|
+
if (existsSync(join(cwd, "bun.lock"))) return "bun";
|
|
17
|
+
return "npm";
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
detectPackageManager
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=packageManagerDetector.js.map
|