@contember/create 2.1.0-alpha.7 → 2.1.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs +36 -23
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.js +36 -23
- package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.cjs +4 -6
- package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.js +4 -6
- 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 +36 -23
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.js +36 -23
- package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.cjs +4 -6
- package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.js +4 -6
- 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/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 +3 -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/{template-workspace → default}/admin/lib/datagrid/elements.tsx +2 -2
- 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/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 +3 -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 +14 -14
- 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/package.json +5 -2
- 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 +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 +40 -24
- package/src/lib/TemplateInstaller.ts +6 -4
- 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/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/container.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/form/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/form/inputs.tsx +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/uic.tsx +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
|
@@ -4,47 +4,60 @@ const cliCommon = require("@contember/cli-common");
|
|
|
4
4
|
const node_path = require("node:path");
|
|
5
5
|
const chalk = require("chalk");
|
|
6
6
|
const version = require("../lib/version.cjs");
|
|
7
|
+
const packageManagerDetector = require("../lib/packageManagerDetector.cjs");
|
|
7
8
|
class WorkspaceCreateCommand extends cliCommon.Command {
|
|
8
9
|
constructor(templateInstaller) {
|
|
9
10
|
super();
|
|
10
11
|
this.templateInstaller = templateInstaller;
|
|
11
12
|
}
|
|
12
13
|
configure(configuration) {
|
|
13
|
-
configuration.description("Creates a new Contember
|
|
14
|
-
configuration.argument("
|
|
14
|
+
configuration.description("Creates a new Contember project");
|
|
15
|
+
configuration.argument("projectName");
|
|
16
|
+
configuration.option("template").shortcut("t");
|
|
15
17
|
}
|
|
16
18
|
async execute(input) {
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
19
|
+
const projectName = input.getArgument("projectName");
|
|
20
|
+
const projectDirectory = node_path.join(process.cwd(), projectName);
|
|
21
|
+
const packageManager = packageManagerDetector.detectPackageManager();
|
|
22
|
+
await this.templateInstaller.installTemplate(input.getOption("template") ?? "default", projectDirectory, {
|
|
20
23
|
version: await version.getPackageVersion(),
|
|
21
|
-
projectName
|
|
24
|
+
projectName,
|
|
25
|
+
packageManager
|
|
22
26
|
});
|
|
23
|
-
console.log(createDocs(
|
|
27
|
+
console.log(createDocs(projectDirectory, projectName, packageManager));
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
|
-
const createDocs = (
|
|
27
|
-
Contember
|
|
30
|
+
const createDocs = (projectDirectory, projectName, packageManager) => `
|
|
31
|
+
Contember project successfully created in ${projectDirectory}
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
$ ${chalk.greenBright(`cd ${workspaceName}`)}
|
|
33
|
+
Next steps:
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
$ ${chalk.
|
|
35
|
+
1. Navigate to the project directory:
|
|
36
|
+
$ ${chalk.green(`cd ${projectName}`)}
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
$ ${chalk.
|
|
38
|
+
2. Install dependencies:
|
|
39
|
+
$ ${chalk.green(`${packageManager} install`)}
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
3. Start the Contember stack:
|
|
42
|
+
$ ${chalk.green(`${packageManager} start`)}
|
|
39
43
|
|
|
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)
|
|
44
|
+
Available services:
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
${chalk.bold("UI & Admin")}
|
|
47
|
+
- Contember Admin ${chalk.blue("http://localhost:1480")}
|
|
48
|
+
|
|
49
|
+
${chalk.bold("API & Backend")}
|
|
50
|
+
- Contember Engine API ${chalk.blue("http://localhost:1481")}
|
|
51
|
+
Auth token: 0000000000000000000000000000000000000000
|
|
52
|
+
|
|
53
|
+
${chalk.bold("Development Tools")}
|
|
54
|
+
- PostgreSQL database ${chalk.blue("http://localhost:1482")} ${chalk.grey("credentials: contember / contember")}
|
|
55
|
+
- Minio S3 storage ${chalk.blue("http://localhost:1483")}
|
|
56
|
+
- Mailpit SMTP testing ${chalk.blue("http://localhost:1484")}
|
|
57
|
+
- Adminer DB manager ${chalk.blue("http://localhost:1485")}
|
|
58
|
+
- Minio Dashboard ${chalk.blue("http://localhost:1486")} ${chalk.grey("credentials: contember / contember")}
|
|
59
|
+
|
|
60
|
+
${chalk.bold("Need help?")} Ask the community: https://github.com/orgs/contember/discussions
|
|
48
61
|
`;
|
|
49
62
|
exports.WorkspaceCreateCommand = WorkspaceCreateCommand;
|
|
50
63
|
//# sourceMappingURL=WorkspaceCreateCommand.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspaceCreateCommand.cjs","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\n\ntype Args = {\n\
|
|
1
|
+
{"version":3,"file":"WorkspaceCreateCommand.cjs","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\nimport { detectPackageManager } from '../lib/packageManagerDetector'\n\ntype Args = {\n\tprojectName: string\n}\n\ntype Options = {\n\ttemplate: string\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember project')\n\t\tconfiguration.argument('projectName')\n\t\tconfiguration.option('template').shortcut('t')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst projectName = input.getArgument('projectName')\n\t\tconst projectDirectory = join(process.cwd(), projectName)\n\t\tconst packageManager = detectPackageManager()\n\n\t\tawait this.templateInstaller.installTemplate(input.getOption('template') ?? 'default', projectDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: projectName,\n\t\t\tpackageManager: packageManager,\n\t\t})\n\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(projectDirectory, projectName, packageManager))\n\t}\n}\n\nconst createDocs = (projectDirectory: string, projectName: string, packageManager: string) => `\nContember project successfully created in ${projectDirectory}\n\nNext steps:\n\n1. Navigate to the project directory:\n $ ${chalk.green(`cd ${projectName}`)}\n\n2. Install dependencies:\n $ ${chalk.green(`${packageManager} install`)}\n\n3. Start the Contember stack:\n $ ${chalk.green(`${packageManager} start`)}\n\nAvailable services:\n\n${chalk.bold('UI & Admin')}\n- Contember Admin ${chalk.blue('http://localhost:1480')}\n\n${chalk.bold('API & Backend')}\n- Contember Engine API ${chalk.blue('http://localhost:1481')}\n Auth token: 0000000000000000000000000000000000000000\n\n${chalk.bold('Development Tools')}\n- PostgreSQL database ${chalk.blue('http://localhost:1482')} ${chalk.grey('credentials: contember / contember')}\n- Minio S3 storage ${chalk.blue('http://localhost:1483')}\n- Mailpit SMTP testing ${chalk.blue('http://localhost:1484')}\n- Adminer DB manager ${chalk.blue('http://localhost:1485')}\n- Minio Dashboard ${chalk.blue('http://localhost:1486')} ${chalk.grey('credentials: contember / contember')}\n\n${chalk.bold('Need help?')} Ask the community: https://github.com/orgs/contember/discussions\n`\n"],"names":["Command","join","detectPackageManager","getPackageVersion"],"mappings":";;;;;;;AAeO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACK,UAAA;AAFW,SAAA,oBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,iCAAiC;AAC3D,kBAAc,SAAS,aAAa;AACpC,kBAAc,OAAO,UAAU,EAAE,SAAS,GAAG;AAAA,EAAA;AAAA,EAG9C,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,cAAc,MAAM,YAAY,aAAa;AACnD,UAAM,mBAAmBC,UAAA,KAAK,QAAQ,IAAA,GAAO,WAAW;AACxD,UAAM,iBAAiBC,uBAAAA,qBAAqB;AAEtC,UAAA,KAAK,kBAAkB,gBAAgB,MAAM,UAAU,UAAU,KAAK,WAAW,kBAAkB;AAAA,MACxG,SAAS,MAAMC,QAAAA,kBAAkB;AAAA,MACjC;AAAA,MACA;AAAA,IAAA,CACA;AAGD,YAAQ,IAAI,WAAW,kBAAkB,aAAa,cAAc,CAAC;AAAA,EAAA;AAEvE;AAEA,MAAM,aAAa,CAAC,kBAA0B,aAAqB,mBAA2B;AAAA,4CAClD,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,OAKrD,MAAM,MAAM,MAAM,WAAW,EAAE,CAAC;AAAA;AAAA;AAAA,OAGhC,MAAM,MAAM,GAAG,cAAc,UAAU,CAAC;AAAA;AAAA;AAAA,OAGxC,MAAM,MAAM,GAAG,cAAc,QAAQ,CAAC;AAAA;AAAA;AAAA;AAAA,EAI3C,MAAM,KAAK,YAAY,CAAC;AAAA,4BACE,MAAM,KAAK,uBAAuB,CAAC;AAAA;AAAA,EAE7D,MAAM,KAAK,eAAe,CAAC;AAAA,4BACD,MAAM,KAAK,uBAAuB,CAAC;AAAA;AAAA;AAAA,EAG7D,MAAM,KAAK,mBAAmB,CAAC;AAAA,4BACL,MAAM,KAAK,uBAAuB,CAAC,OAAO,MAAM,KAAK,oCAAoC,CAAC;AAAA,4BAC1F,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC,OAAO,MAAM,KAAK,oCAAoC,CAAC;AAAA;AAAA,EAEpH,MAAM,KAAK,YAAY,CAAC;AAAA;;"}
|
|
@@ -2,47 +2,60 @@ import { Command } from "@contember/cli-common";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import { getPackageVersion } from "../lib/version.js";
|
|
5
|
+
import { detectPackageManager } from "../lib/packageManagerDetector.js";
|
|
5
6
|
class WorkspaceCreateCommand extends Command {
|
|
6
7
|
constructor(templateInstaller) {
|
|
7
8
|
super();
|
|
8
9
|
this.templateInstaller = templateInstaller;
|
|
9
10
|
}
|
|
10
11
|
configure(configuration) {
|
|
11
|
-
configuration.description("Creates a new Contember
|
|
12
|
-
configuration.argument("
|
|
12
|
+
configuration.description("Creates a new Contember project");
|
|
13
|
+
configuration.argument("projectName");
|
|
14
|
+
configuration.option("template").shortcut("t");
|
|
13
15
|
}
|
|
14
16
|
async execute(input) {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
17
|
+
const projectName = input.getArgument("projectName");
|
|
18
|
+
const projectDirectory = join(process.cwd(), projectName);
|
|
19
|
+
const packageManager = detectPackageManager();
|
|
20
|
+
await this.templateInstaller.installTemplate(input.getOption("template") ?? "default", projectDirectory, {
|
|
18
21
|
version: await getPackageVersion(),
|
|
19
|
-
projectName
|
|
22
|
+
projectName,
|
|
23
|
+
packageManager
|
|
20
24
|
});
|
|
21
|
-
console.log(createDocs(
|
|
25
|
+
console.log(createDocs(projectDirectory, projectName, packageManager));
|
|
22
26
|
}
|
|
23
27
|
}
|
|
24
|
-
const createDocs = (
|
|
25
|
-
Contember
|
|
28
|
+
const createDocs = (projectDirectory, projectName, packageManager) => `
|
|
29
|
+
Contember project successfully created in ${projectDirectory}
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
$ ${chalk.greenBright(`cd ${workspaceName}`)}
|
|
31
|
+
Next steps:
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
$ ${chalk.
|
|
33
|
+
1. Navigate to the project directory:
|
|
34
|
+
$ ${chalk.green(`cd ${projectName}`)}
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
$ ${chalk.
|
|
36
|
+
2. Install dependencies:
|
|
37
|
+
$ ${chalk.green(`${packageManager} install`)}
|
|
35
38
|
|
|
36
|
-
|
|
39
|
+
3. Start the Contember stack:
|
|
40
|
+
$ ${chalk.green(`${packageManager} start`)}
|
|
37
41
|
|
|
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)
|
|
42
|
+
Available services:
|
|
44
43
|
|
|
45
|
-
|
|
44
|
+
${chalk.bold("UI & Admin")}
|
|
45
|
+
- Contember Admin ${chalk.blue("http://localhost:1480")}
|
|
46
|
+
|
|
47
|
+
${chalk.bold("API & Backend")}
|
|
48
|
+
- Contember Engine API ${chalk.blue("http://localhost:1481")}
|
|
49
|
+
Auth token: 0000000000000000000000000000000000000000
|
|
50
|
+
|
|
51
|
+
${chalk.bold("Development Tools")}
|
|
52
|
+
- PostgreSQL database ${chalk.blue("http://localhost:1482")} ${chalk.grey("credentials: contember / contember")}
|
|
53
|
+
- Minio S3 storage ${chalk.blue("http://localhost:1483")}
|
|
54
|
+
- Mailpit SMTP testing ${chalk.blue("http://localhost:1484")}
|
|
55
|
+
- Adminer DB manager ${chalk.blue("http://localhost:1485")}
|
|
56
|
+
- Minio Dashboard ${chalk.blue("http://localhost:1486")} ${chalk.grey("credentials: contember / contember")}
|
|
57
|
+
|
|
58
|
+
${chalk.bold("Need help?")} Ask the community: https://github.com/orgs/contember/discussions
|
|
46
59
|
`;
|
|
47
60
|
export {
|
|
48
61
|
WorkspaceCreateCommand
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspaceCreateCommand.js","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\n\ntype Args = {\n\
|
|
1
|
+
{"version":3,"file":"WorkspaceCreateCommand.js","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\nimport { detectPackageManager } from '../lib/packageManagerDetector'\n\ntype Args = {\n\tprojectName: string\n}\n\ntype Options = {\n\ttemplate: string\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember project')\n\t\tconfiguration.argument('projectName')\n\t\tconfiguration.option('template').shortcut('t')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst projectName = input.getArgument('projectName')\n\t\tconst projectDirectory = join(process.cwd(), projectName)\n\t\tconst packageManager = detectPackageManager()\n\n\t\tawait this.templateInstaller.installTemplate(input.getOption('template') ?? 'default', projectDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: projectName,\n\t\t\tpackageManager: packageManager,\n\t\t})\n\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(projectDirectory, projectName, packageManager))\n\t}\n}\n\nconst createDocs = (projectDirectory: string, projectName: string, packageManager: string) => `\nContember project successfully created in ${projectDirectory}\n\nNext steps:\n\n1. Navigate to the project directory:\n $ ${chalk.green(`cd ${projectName}`)}\n\n2. Install dependencies:\n $ ${chalk.green(`${packageManager} install`)}\n\n3. Start the Contember stack:\n $ ${chalk.green(`${packageManager} start`)}\n\nAvailable services:\n\n${chalk.bold('UI & Admin')}\n- Contember Admin ${chalk.blue('http://localhost:1480')}\n\n${chalk.bold('API & Backend')}\n- Contember Engine API ${chalk.blue('http://localhost:1481')}\n Auth token: 0000000000000000000000000000000000000000\n\n${chalk.bold('Development Tools')}\n- PostgreSQL database ${chalk.blue('http://localhost:1482')} ${chalk.grey('credentials: contember / contember')}\n- Minio S3 storage ${chalk.blue('http://localhost:1483')}\n- Mailpit SMTP testing ${chalk.blue('http://localhost:1484')}\n- Adminer DB manager ${chalk.blue('http://localhost:1485')}\n- Minio Dashboard ${chalk.blue('http://localhost:1486')} ${chalk.grey('credentials: contember / contember')}\n\n${chalk.bold('Need help?')} Ask the community: https://github.com/orgs/contember/discussions\n`\n"],"names":[],"mappings":";;;;;AAeO,MAAM,+BAA+B,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACK,UAAA;AAFW,SAAA,oBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,iCAAiC;AAC3D,kBAAc,SAAS,aAAa;AACpC,kBAAc,OAAO,UAAU,EAAE,SAAS,GAAG;AAAA,EAAA;AAAA,EAG9C,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,cAAc,MAAM,YAAY,aAAa;AACnD,UAAM,mBAAmB,KAAK,QAAQ,IAAA,GAAO,WAAW;AACxD,UAAM,iBAAiB,qBAAqB;AAEtC,UAAA,KAAK,kBAAkB,gBAAgB,MAAM,UAAU,UAAU,KAAK,WAAW,kBAAkB;AAAA,MACxG,SAAS,MAAM,kBAAkB;AAAA,MACjC;AAAA,MACA;AAAA,IAAA,CACA;AAGD,YAAQ,IAAI,WAAW,kBAAkB,aAAa,cAAc,CAAC;AAAA,EAAA;AAEvE;AAEA,MAAM,aAAa,CAAC,kBAA0B,aAAqB,mBAA2B;AAAA,4CAClD,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,OAKrD,MAAM,MAAM,MAAM,WAAW,EAAE,CAAC;AAAA;AAAA;AAAA,OAGhC,MAAM,MAAM,GAAG,cAAc,UAAU,CAAC;AAAA;AAAA;AAAA,OAGxC,MAAM,MAAM,GAAG,cAAc,QAAQ,CAAC;AAAA;AAAA;AAAA;AAAA,EAI3C,MAAM,KAAK,YAAY,CAAC;AAAA,4BACE,MAAM,KAAK,uBAAuB,CAAC;AAAA;AAAA,EAE7D,MAAM,KAAK,eAAe,CAAC;AAAA,4BACD,MAAM,KAAK,uBAAuB,CAAC;AAAA;AAAA;AAAA,EAG7D,MAAM,KAAK,mBAAmB,CAAC;AAAA,4BACL,MAAM,KAAK,uBAAuB,CAAC,OAAO,MAAM,KAAK,oCAAoC,CAAC;AAAA,4BAC1F,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC,OAAO,MAAM,KAAK,oCAAoC,CAAC;AAAA;AAAA,EAEpH,MAAM,KAAK,YAAY,CAAC;AAAA;"}
|
|
@@ -9,12 +9,8 @@ class TemplateInstaller {
|
|
|
9
9
|
constructor(resourceDir, fs) {
|
|
10
10
|
this.resourceDir = resourceDir;
|
|
11
11
|
this.fs = fs;
|
|
12
|
-
__publicField(this, "localTemplates"
|
|
13
|
-
["@contember/template-workspace"]: node_path.join(this.resourceDir, "templates/template-workspace")
|
|
14
|
-
});
|
|
12
|
+
__publicField(this, "localTemplates");
|
|
15
13
|
__publicField(this, "installTemplate", async (template, targetDir, variables = {}) => {
|
|
16
|
-
let removeTemplate = () => {
|
|
17
|
-
};
|
|
18
14
|
if (this.localTemplates[template]) {
|
|
19
15
|
template = this.localTemplates[template];
|
|
20
16
|
}
|
|
@@ -31,7 +27,6 @@ class TemplateInstaller {
|
|
|
31
27
|
await this.fs.copy(template, targetDir, {
|
|
32
28
|
filter: (src) => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src)
|
|
33
29
|
});
|
|
34
|
-
await removeTemplate();
|
|
35
30
|
if (config.patchPackageJson) {
|
|
36
31
|
await this.replaceFileContent(node_path.join(targetDir, "package.json"), (content) => {
|
|
37
32
|
const {
|
|
@@ -74,6 +69,9 @@ class TemplateInstaller {
|
|
|
74
69
|
const content = await this.fs.readFile(path, { encoding: "utf8" });
|
|
75
70
|
return jsyaml.load(content);
|
|
76
71
|
});
|
|
72
|
+
this.localTemplates = {
|
|
73
|
+
["default"]: node_path.join(this.resourceDir, "templates/default")
|
|
74
|
+
};
|
|
77
75
|
}
|
|
78
76
|
}
|
|
79
77
|
exports.TemplateInstaller = TemplateInstaller;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateInstaller.cjs","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\n\n\nexport class TemplateInstaller {\n\n\tprivate localTemplates: Record<string, string
|
|
1
|
+
{"version":3,"file":"TemplateInstaller.cjs","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\n\n\nexport class TemplateInstaller {\n\n\tprivate localTemplates: Record<string, string>\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t\tthis.localTemplates = {\n\t\t\t['default']: join(this.resourceDir, 'templates/default'),\n\t\t}\n\t}\n\n\tinstallTemplate = async (\n\t\ttemplate: string,\n\t\ttargetDir: string,\n\t\tvariables: Record<string, string> = {},\n\t) => {\n\t\tlet removeTemplate = () => {\n\t\t}\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t}\n\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tthrow `${template} is not a Contember template`\n\t\t}\n\t\tconst config = (await this.readYaml(templateConfigFile)) as {\n\t\t\ttype?: string\n\t\t\tremove?: string[]\n\t\t\tpatchPackageJson?: boolean\n\t\t\trename?: Record<string, string>\n\t\t\tcopy?: Record<string, string>\n\t\t\treplaceVariables?: string[]\n\t\t}\n\t\tconst nodeModulesDir = join(template, 'node_modules')\n\t\tconst skippedFiles = new Set([...(config.remove || []).map(it => join(template, it)), templateConfigFile])\n\t\tif (await this.fs.pathExists(targetDir)) {\n\t\t\tthrow `${targetDir} already exists`\n\t\t}\n\t\tawait this.fs.copy(template, targetDir, {\n\t\t\tfilter: src => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src),\n\t\t})\n\n\t\tremoveTemplate()\n\n\t\tif (config.patchPackageJson) {\n\t\t\tawait this.replaceFileContent(join(targetDir, 'package.json'), content => {\n\t\t\t\tconst {\n\t\t\t\t\tname,\n\t\t\t\t\tversion,\n\t\t\t\t\t'scripts-template': scripts,\n\t\t\t\t\tscripts: _nullScripts,\n\t\t\t\t\tlicense,\n\t\t\t\t\t...json\n\t\t\t\t} = JSON.parse(content)\n\t\t\t\treturn JSON.stringify({ scripts, ...json }, null, ' ')\n\t\t\t})\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.rename || {})) {\n\t\t\tawait this.fs.rename(join(targetDir, source), join(targetDir, target))\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.copy || {})) {\n\t\t\tawait this.fs.copy(join(targetDir, source), join(targetDir, target))\n\t\t}\n\n\t\tfor (const file of config.replaceVariables || []) {\n\t\t\tconst path = join(targetDir, file)\n\t\t\tif (!(await this.fs.pathExists(path))) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tawait this.replaceFileContent(path, content =>\n\t\t\t\tObject.entries(variables).reduce(\n\t\t\t\t\t(content, [key, value]) => content.replace(new RegExp(`\\{${key}\\}`, 'g'), value),\n\t\t\t\t\tcontent,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\t}\n\n\tprivate replaceFileContent = async (path: string, replacer: (content: string) => string): Promise<void> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\tconst newContent = replacer(content)\n\t\tawait this.fs.writeFile(path, newContent, { encoding: 'utf8' })\n\t}\n\n\tprivate readYaml = async <T = unknown>(path: string): Promise<T> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\treturn jsyaml.load(content) as unknown as T\n\t}\n}\n"],"names":["join","content"],"mappings":";;;;;;;AAKO,MAAM,kBAAkB;AAAA,EAI9B,YACkB,aACA,IAChB;AAFgB,SAAA,cAAA;AACA,SAAA,KAAA;AAJV,kBAAA,MAAA,gBAAA;AAWR,kBAAA,MAAA,mBAAkB,OACjB,UACA,WACA,YAAoC,OAChC;AAGA,UAAA,KAAK,eAAe,QAAQ,GAAG;AACvB,mBAAA,KAAK,eAAe,QAAQ;AAAA,MAAA;AAGlC,YAAA,qBAAqBA,UAAAA,KAAK,UAAU,yBAAyB;AACnE,UAAI,CAAE,MAAM,KAAK,GAAG,WAAW,kBAAkB,GAAI;AACpD,cAAM,GAAG,QAAQ;AAAA,MAAA;AAElB,YAAM,SAAU,MAAM,KAAK,SAAS,kBAAkB;AAQhD,YAAA,iBAAiBA,UAAAA,KAAK,UAAU,cAAc;AACpD,YAAM,eAAmB,oBAAA,IAAI,CAAC,IAAI,OAAO,UAAU,CAAI,GAAA,IAAI,QAAMA,UAAAA,KAAK,UAAU,EAAE,CAAC,GAAG,kBAAkB,CAAC;AACzG,UAAI,MAAM,KAAK,GAAG,WAAW,SAAS,GAAG;AACxC,cAAM,GAAG,SAAS;AAAA,MAAA;AAEnB,YAAM,KAAK,GAAG,KAAK,UAAU,WAAW;AAAA,QACvC,QAAQ,CAAO,QAAA,CAAC,IAAI,WAAW,cAAc,KAAK,CAAC,aAAa,IAAI,GAAG;AAAA,MAAA,CACvE;AAID,UAAI,OAAO,kBAAkB;AAC5B,cAAM,KAAK,mBAAmBA,UAAA,KAAK,WAAW,cAAc,GAAG,CAAW,YAAA;AACnE,gBAAA;AAAA,YACL;AAAA,YACA;AAAA,YACA,oBAAoB;AAAA,YACpB,SAAS;AAAA,YACT;AAAA,YACA,GAAG;AAAA,UAAA,IACA,KAAK,MAAM,OAAO;AACf,iBAAA,KAAK,UAAU,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM,IAAI;AAAA,QAAA,CACtD;AAAA,MAAA;AAES,iBAAA,CAAC,QAAQ,MAAM,KAAK,OAAO,QAAQ,OAAO,UAAU,CAAA,CAAE,GAAG;AAC7D,cAAA,KAAK,GAAG,OAAOA,eAAK,WAAW,MAAM,GAAGA,UAAA,KAAK,WAAW,MAAM,CAAC;AAAA,MAAA;AAE3D,iBAAA,CAAC,QAAQ,MAAM,KAAK,OAAO,QAAQ,OAAO,QAAQ,CAAA,CAAE,GAAG;AAC3D,cAAA,KAAK,GAAG,KAAKA,eAAK,WAAW,MAAM,GAAGA,UAAA,KAAK,WAAW,MAAM,CAAC;AAAA,MAAA;AAGpE,iBAAW,QAAQ,OAAO,oBAAoB,CAAA,GAAI;AAC3C,cAAA,OAAOA,UAAAA,KAAK,WAAW,IAAI;AACjC,YAAI,CAAE,MAAM,KAAK,GAAG,WAAW,IAAI,GAAI;AACtC;AAAA,QAAA;AAED,cAAM,KAAK;AAAA,UAAmB;AAAA,UAAM,CACnC,YAAA,OAAO,QAAQ,SAAS,EAAE;AAAA,YACzB,CAACC,UAAS,CAAC,KAAK,KAAK,MAAMA,SAAQ,QAAQ,IAAI,OAAO,IAAK,GAAG,KAAM,GAAG,GAAG,KAAK;AAAA,YAC/E;AAAA,UAAA;AAAA,QAEF;AAAA,MAAA;AAAA,IACD,CACD;AAEQ,kBAAA,MAAA,sBAAqB,OAAO,MAAc,aAAyD;AACpG,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AAC3D,YAAA,aAAa,SAAS,OAAO;AAC7B,YAAA,KAAK,GAAG,UAAU,MAAM,YAAY,EAAE,UAAU,QAAQ;AAAA,IAAA,CAC/D;AAEQ,kBAAA,MAAA,YAAW,OAAoB,SAA6B;AAC7D,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AAC1D,aAAA,OAAO,KAAK,OAAO;AAAA,IAAA,CAC3B;AAlFC,SAAK,iBAAiB;AAAA,MACrB,CAAC,SAAS,GAAGD,UAAAA,KAAK,KAAK,aAAa,mBAAmB;AAAA,IACxD;AAAA,EAAA;AAiFF;;"}
|
|
@@ -7,12 +7,8 @@ class TemplateInstaller {
|
|
|
7
7
|
constructor(resourceDir, fs) {
|
|
8
8
|
this.resourceDir = resourceDir;
|
|
9
9
|
this.fs = fs;
|
|
10
|
-
__publicField(this, "localTemplates"
|
|
11
|
-
["@contember/template-workspace"]: join(this.resourceDir, "templates/template-workspace")
|
|
12
|
-
});
|
|
10
|
+
__publicField(this, "localTemplates");
|
|
13
11
|
__publicField(this, "installTemplate", async (template, targetDir, variables = {}) => {
|
|
14
|
-
let removeTemplate = () => {
|
|
15
|
-
};
|
|
16
12
|
if (this.localTemplates[template]) {
|
|
17
13
|
template = this.localTemplates[template];
|
|
18
14
|
}
|
|
@@ -29,7 +25,6 @@ class TemplateInstaller {
|
|
|
29
25
|
await this.fs.copy(template, targetDir, {
|
|
30
26
|
filter: (src) => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src)
|
|
31
27
|
});
|
|
32
|
-
await removeTemplate();
|
|
33
28
|
if (config.patchPackageJson) {
|
|
34
29
|
await this.replaceFileContent(join(targetDir, "package.json"), (content) => {
|
|
35
30
|
const {
|
|
@@ -72,6 +67,9 @@ class TemplateInstaller {
|
|
|
72
67
|
const content = await this.fs.readFile(path, { encoding: "utf8" });
|
|
73
68
|
return jsyaml__default.load(content);
|
|
74
69
|
});
|
|
70
|
+
this.localTemplates = {
|
|
71
|
+
["default"]: join(this.resourceDir, "templates/default")
|
|
72
|
+
};
|
|
75
73
|
}
|
|
76
74
|
}
|
|
77
75
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateInstaller.js","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\n\n\nexport class TemplateInstaller {\n\n\tprivate localTemplates: Record<string, string
|
|
1
|
+
{"version":3,"file":"TemplateInstaller.js","sources":["../../../../../packages/create/src/lib/TemplateInstaller.ts"],"sourcesContent":["import { join } from 'node:path'\nimport { FileSystem } from './FileSystem'\nimport jsyaml from 'js-yaml'\n\n\nexport class TemplateInstaller {\n\n\tprivate localTemplates: Record<string, string>\n\n\tconstructor(\n\t\tprivate readonly resourceDir: string,\n\t\tprivate readonly fs: FileSystem,\n\t) {\n\t\tthis.localTemplates = {\n\t\t\t['default']: join(this.resourceDir, 'templates/default'),\n\t\t}\n\t}\n\n\tinstallTemplate = async (\n\t\ttemplate: string,\n\t\ttargetDir: string,\n\t\tvariables: Record<string, string> = {},\n\t) => {\n\t\tlet removeTemplate = () => {\n\t\t}\n\t\tif (this.localTemplates[template]) {\n\t\t\ttemplate = this.localTemplates[template]\n\t\t}\n\n\t\tconst templateConfigFile = join(template, 'contember.template.yaml')\n\t\tif (!(await this.fs.pathExists(templateConfigFile))) {\n\t\t\tthrow `${template} is not a Contember template`\n\t\t}\n\t\tconst config = (await this.readYaml(templateConfigFile)) as {\n\t\t\ttype?: string\n\t\t\tremove?: string[]\n\t\t\tpatchPackageJson?: boolean\n\t\t\trename?: Record<string, string>\n\t\t\tcopy?: Record<string, string>\n\t\t\treplaceVariables?: string[]\n\t\t}\n\t\tconst nodeModulesDir = join(template, 'node_modules')\n\t\tconst skippedFiles = new Set([...(config.remove || []).map(it => join(template, it)), templateConfigFile])\n\t\tif (await this.fs.pathExists(targetDir)) {\n\t\t\tthrow `${targetDir} already exists`\n\t\t}\n\t\tawait this.fs.copy(template, targetDir, {\n\t\t\tfilter: src => !src.startsWith(nodeModulesDir) && !skippedFiles.has(src),\n\t\t})\n\n\t\tremoveTemplate()\n\n\t\tif (config.patchPackageJson) {\n\t\t\tawait this.replaceFileContent(join(targetDir, 'package.json'), content => {\n\t\t\t\tconst {\n\t\t\t\t\tname,\n\t\t\t\t\tversion,\n\t\t\t\t\t'scripts-template': scripts,\n\t\t\t\t\tscripts: _nullScripts,\n\t\t\t\t\tlicense,\n\t\t\t\t\t...json\n\t\t\t\t} = JSON.parse(content)\n\t\t\t\treturn JSON.stringify({ scripts, ...json }, null, ' ')\n\t\t\t})\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.rename || {})) {\n\t\t\tawait this.fs.rename(join(targetDir, source), join(targetDir, target))\n\t\t}\n\t\tfor (const [source, target] of Object.entries(config.copy || {})) {\n\t\t\tawait this.fs.copy(join(targetDir, source), join(targetDir, target))\n\t\t}\n\n\t\tfor (const file of config.replaceVariables || []) {\n\t\t\tconst path = join(targetDir, file)\n\t\t\tif (!(await this.fs.pathExists(path))) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tawait this.replaceFileContent(path, content =>\n\t\t\t\tObject.entries(variables).reduce(\n\t\t\t\t\t(content, [key, value]) => content.replace(new RegExp(`\\{${key}\\}`, 'g'), value),\n\t\t\t\t\tcontent,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\t}\n\n\tprivate replaceFileContent = async (path: string, replacer: (content: string) => string): Promise<void> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\tconst newContent = replacer(content)\n\t\tawait this.fs.writeFile(path, newContent, { encoding: 'utf8' })\n\t}\n\n\tprivate readYaml = async <T = unknown>(path: string): Promise<T> => {\n\t\tconst content = await this.fs.readFile(path, { encoding: 'utf8' })\n\t\treturn jsyaml.load(content) as unknown as T\n\t}\n}\n"],"names":["content","jsyaml"],"mappings":";;;;;AAKO,MAAM,kBAAkB;AAAA,EAI9B,YACkB,aACA,IAChB;AAFgB,SAAA,cAAA;AACA,SAAA,KAAA;AAJV,kBAAA,MAAA,gBAAA;AAWR,kBAAA,MAAA,mBAAkB,OACjB,UACA,WACA,YAAoC,OAChC;AAGA,UAAA,KAAK,eAAe,QAAQ,GAAG;AACvB,mBAAA,KAAK,eAAe,QAAQ;AAAA,MAAA;AAGlC,YAAA,qBAAqB,KAAK,UAAU,yBAAyB;AACnE,UAAI,CAAE,MAAM,KAAK,GAAG,WAAW,kBAAkB,GAAI;AACpD,cAAM,GAAG,QAAQ;AAAA,MAAA;AAElB,YAAM,SAAU,MAAM,KAAK,SAAS,kBAAkB;AAQhD,YAAA,iBAAiB,KAAK,UAAU,cAAc;AACpD,YAAM,eAAmB,oBAAA,IAAI,CAAC,IAAI,OAAO,UAAU,CAAI,GAAA,IAAI,QAAM,KAAK,UAAU,EAAE,CAAC,GAAG,kBAAkB,CAAC;AACzG,UAAI,MAAM,KAAK,GAAG,WAAW,SAAS,GAAG;AACxC,cAAM,GAAG,SAAS;AAAA,MAAA;AAEnB,YAAM,KAAK,GAAG,KAAK,UAAU,WAAW;AAAA,QACvC,QAAQ,CAAO,QAAA,CAAC,IAAI,WAAW,cAAc,KAAK,CAAC,aAAa,IAAI,GAAG;AAAA,MAAA,CACvE;AAID,UAAI,OAAO,kBAAkB;AAC5B,cAAM,KAAK,mBAAmB,KAAK,WAAW,cAAc,GAAG,CAAW,YAAA;AACnE,gBAAA;AAAA,YACL;AAAA,YACA;AAAA,YACA,oBAAoB;AAAA,YACpB,SAAS;AAAA,YACT;AAAA,YACA,GAAG;AAAA,UAAA,IACA,KAAK,MAAM,OAAO;AACf,iBAAA,KAAK,UAAU,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM,IAAI;AAAA,QAAA,CACtD;AAAA,MAAA;AAES,iBAAA,CAAC,QAAQ,MAAM,KAAK,OAAO,QAAQ,OAAO,UAAU,CAAA,CAAE,GAAG;AAC7D,cAAA,KAAK,GAAG,OAAO,KAAK,WAAW,MAAM,GAAG,KAAK,WAAW,MAAM,CAAC;AAAA,MAAA;AAE3D,iBAAA,CAAC,QAAQ,MAAM,KAAK,OAAO,QAAQ,OAAO,QAAQ,CAAA,CAAE,GAAG;AAC3D,cAAA,KAAK,GAAG,KAAK,KAAK,WAAW,MAAM,GAAG,KAAK,WAAW,MAAM,CAAC;AAAA,MAAA;AAGpE,iBAAW,QAAQ,OAAO,oBAAoB,CAAA,GAAI;AAC3C,cAAA,OAAO,KAAK,WAAW,IAAI;AACjC,YAAI,CAAE,MAAM,KAAK,GAAG,WAAW,IAAI,GAAI;AACtC;AAAA,QAAA;AAED,cAAM,KAAK;AAAA,UAAmB;AAAA,UAAM,CACnC,YAAA,OAAO,QAAQ,SAAS,EAAE;AAAA,YACzB,CAACA,UAAS,CAAC,KAAK,KAAK,MAAMA,SAAQ,QAAQ,IAAI,OAAO,IAAK,GAAG,KAAM,GAAG,GAAG,KAAK;AAAA,YAC/E;AAAA,UAAA;AAAA,QAEF;AAAA,MAAA;AAAA,IACD,CACD;AAEQ,kBAAA,MAAA,sBAAqB,OAAO,MAAc,aAAyD;AACpG,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AAC3D,YAAA,aAAa,SAAS,OAAO;AAC7B,YAAA,KAAK,GAAG,UAAU,MAAM,YAAY,EAAE,UAAU,QAAQ;AAAA,IAAA,CAC/D;AAEQ,kBAAA,MAAA,YAAW,OAAoB,SAA6B;AAC7D,YAAA,UAAU,MAAM,KAAK,GAAG,SAAS,MAAM,EAAE,UAAU,QAAQ;AAC1D,aAAAC,gBAAO,KAAK,OAAO;AAAA,IAAA,CAC3B;AAlFC,SAAK,iBAAiB;AAAA,MACrB,CAAC,SAAS,GAAG,KAAK,KAAK,aAAa,mBAAmB;AAAA,IACxD;AAAA,EAAA;AAiFF;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const node_fs = require("node:fs");
|
|
4
|
+
const node_path = require("node:path");
|
|
5
|
+
const detectPackageManager = () => {
|
|
6
|
+
const userAgent = process.env.npm_config_user_agent;
|
|
7
|
+
if (userAgent) {
|
|
8
|
+
if (userAgent.startsWith("yarn/")) return "yarn";
|
|
9
|
+
if (userAgent.startsWith("pnpm/")) return "pnpm";
|
|
10
|
+
if (userAgent.startsWith("npm/")) return "npm";
|
|
11
|
+
if (userAgent.startsWith("bun/")) return "bun";
|
|
12
|
+
}
|
|
13
|
+
const cwd = process.cwd();
|
|
14
|
+
if (node_fs.existsSync(node_path.join(cwd, "yarn.lock"))) return "yarn";
|
|
15
|
+
if (node_fs.existsSync(node_path.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
16
|
+
if (node_fs.existsSync(node_path.join(cwd, "package-lock.json"))) return "npm";
|
|
17
|
+
if (node_fs.existsSync(node_path.join(cwd, "bun.lockb"))) return "bun";
|
|
18
|
+
if (node_fs.existsSync(node_path.join(cwd, "bun.lock"))) return "bun";
|
|
19
|
+
return "npm";
|
|
20
|
+
};
|
|
21
|
+
exports.detectPackageManager = detectPackageManager;
|
|
22
|
+
//# sourceMappingURL=packageManagerDetector.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageManagerDetector.cjs","sources":["../../../../../packages/create/src/lib/packageManagerDetector.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { join } from 'node:path'\n\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun'\n\nexport const detectPackageManager = (): PackageManager => {\n\tconst userAgent = process.env.npm_config_user_agent\n\n\tif (userAgent) {\n\t\tif (userAgent.startsWith('yarn/')) return 'yarn'\n\t\tif (userAgent.startsWith('pnpm/')) return 'pnpm'\n\t\tif (userAgent.startsWith('npm/')) return 'npm'\n\t\tif (userAgent.startsWith('bun/')) return 'bun'\n\t}\n\n\tconst cwd = process.cwd()\n\tif (existsSync(join(cwd, 'yarn.lock'))) return 'yarn'\n\tif (existsSync(join(cwd, 'pnpm-lock.yaml'))) return 'pnpm'\n\tif (existsSync(join(cwd, 'package-lock.json'))) return 'npm'\n\tif (existsSync(join(cwd, 'bun.lockb'))) return 'bun'\n\tif (existsSync(join(cwd, 'bun.lock'))) return 'bun'\n\n\treturn 'npm'\n}\n"],"names":["existsSync","join"],"mappings":";;;;AAKO,MAAM,uBAAuB,MAAsB;AACnD,QAAA,YAAY,QAAQ,IAAI;AAE9B,MAAI,WAAW;AACd,QAAI,UAAU,WAAW,OAAO,EAAU,QAAA;AAC1C,QAAI,UAAU,WAAW,OAAO,EAAU,QAAA;AAC1C,QAAI,UAAU,WAAW,MAAM,EAAU,QAAA;AACzC,QAAI,UAAU,WAAW,MAAM,EAAU,QAAA;AAAA,EAAA;AAGpC,QAAA,MAAM,QAAQ,IAAI;AACxB,MAAIA,QAAAA,WAAWC,UAAAA,KAAK,KAAK,WAAW,CAAC,EAAU,QAAA;AAC/C,MAAID,QAAAA,WAAWC,UAAAA,KAAK,KAAK,gBAAgB,CAAC,EAAU,QAAA;AACpD,MAAID,QAAAA,WAAWC,UAAAA,KAAK,KAAK,mBAAmB,CAAC,EAAU,QAAA;AACvD,MAAID,QAAAA,WAAWC,UAAAA,KAAK,KAAK,WAAW,CAAC,EAAU,QAAA;AAC/C,MAAID,QAAAA,WAAWC,UAAAA,KAAK,KAAK,UAAU,CAAC,EAAU,QAAA;AAEvC,SAAA;AACR;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
const detectPackageManager = () => {
|
|
4
|
+
const userAgent = process.env.npm_config_user_agent;
|
|
5
|
+
if (userAgent) {
|
|
6
|
+
if (userAgent.startsWith("yarn/")) return "yarn";
|
|
7
|
+
if (userAgent.startsWith("pnpm/")) return "pnpm";
|
|
8
|
+
if (userAgent.startsWith("npm/")) return "npm";
|
|
9
|
+
if (userAgent.startsWith("bun/")) return "bun";
|
|
10
|
+
}
|
|
11
|
+
const cwd = process.cwd();
|
|
12
|
+
if (existsSync(join(cwd, "yarn.lock"))) return "yarn";
|
|
13
|
+
if (existsSync(join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
14
|
+
if (existsSync(join(cwd, "package-lock.json"))) return "npm";
|
|
15
|
+
if (existsSync(join(cwd, "bun.lockb"))) return "bun";
|
|
16
|
+
if (existsSync(join(cwd, "bun.lock"))) return "bun";
|
|
17
|
+
return "npm";
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
detectPackageManager
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=packageManagerDetector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageManagerDetector.js","sources":["../../../../../packages/create/src/lib/packageManagerDetector.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { join } from 'node:path'\n\nexport type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun'\n\nexport const detectPackageManager = (): PackageManager => {\n\tconst userAgent = process.env.npm_config_user_agent\n\n\tif (userAgent) {\n\t\tif (userAgent.startsWith('yarn/')) return 'yarn'\n\t\tif (userAgent.startsWith('pnpm/')) return 'pnpm'\n\t\tif (userAgent.startsWith('npm/')) return 'npm'\n\t\tif (userAgent.startsWith('bun/')) return 'bun'\n\t}\n\n\tconst cwd = process.cwd()\n\tif (existsSync(join(cwd, 'yarn.lock'))) return 'yarn'\n\tif (existsSync(join(cwd, 'pnpm-lock.yaml'))) return 'pnpm'\n\tif (existsSync(join(cwd, 'package-lock.json'))) return 'npm'\n\tif (existsSync(join(cwd, 'bun.lockb'))) return 'bun'\n\tif (existsSync(join(cwd, 'bun.lock'))) return 'bun'\n\n\treturn 'npm'\n}\n"],"names":[],"mappings":";;AAKO,MAAM,uBAAuB,MAAsB;AACnD,QAAA,YAAY,QAAQ,IAAI;AAE9B,MAAI,WAAW;AACd,QAAI,UAAU,WAAW,OAAO,EAAU,QAAA;AAC1C,QAAI,UAAU,WAAW,OAAO,EAAU,QAAA;AAC1C,QAAI,UAAU,WAAW,MAAM,EAAU,QAAA;AACzC,QAAI,UAAU,WAAW,MAAM,EAAU,QAAA;AAAA,EAAA;AAGpC,QAAA,MAAM,QAAQ,IAAI;AACxB,MAAI,WAAW,KAAK,KAAK,WAAW,CAAC,EAAU,QAAA;AAC/C,MAAI,WAAW,KAAK,KAAK,gBAAgB,CAAC,EAAU,QAAA;AACpD,MAAI,WAAW,KAAK,KAAK,mBAAmB,CAAC,EAAU,QAAA;AACvD,MAAI,WAAW,KAAK,KAAK,WAAW,CAAC,EAAU,QAAA;AAC/C,MAAI,WAAW,KAAK,KAAK,UAAU,CAAC,EAAU,QAAA;AAEvC,SAAA;AACR;"}
|
|
@@ -4,47 +4,60 @@ const cliCommon = require("@contember/cli-common");
|
|
|
4
4
|
const node_path = require("node:path");
|
|
5
5
|
const chalk = require("chalk");
|
|
6
6
|
const version = require("../lib/version.cjs");
|
|
7
|
+
const packageManagerDetector = require("../lib/packageManagerDetector.cjs");
|
|
7
8
|
class WorkspaceCreateCommand extends cliCommon.Command {
|
|
8
9
|
constructor(templateInstaller) {
|
|
9
10
|
super();
|
|
10
11
|
this.templateInstaller = templateInstaller;
|
|
11
12
|
}
|
|
12
13
|
configure(configuration) {
|
|
13
|
-
configuration.description("Creates a new Contember
|
|
14
|
-
configuration.argument("
|
|
14
|
+
configuration.description("Creates a new Contember project");
|
|
15
|
+
configuration.argument("projectName");
|
|
16
|
+
configuration.option("template").shortcut("t");
|
|
15
17
|
}
|
|
16
18
|
async execute(input) {
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
19
|
+
const projectName = input.getArgument("projectName");
|
|
20
|
+
const projectDirectory = node_path.join(process.cwd(), projectName);
|
|
21
|
+
const packageManager = packageManagerDetector.detectPackageManager();
|
|
22
|
+
await this.templateInstaller.installTemplate(input.getOption("template") ?? "default", projectDirectory, {
|
|
20
23
|
version: await version.getPackageVersion(),
|
|
21
|
-
projectName
|
|
24
|
+
projectName,
|
|
25
|
+
packageManager
|
|
22
26
|
});
|
|
23
|
-
console.log(createDocs(
|
|
27
|
+
console.log(createDocs(projectDirectory, projectName, packageManager));
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
|
-
const createDocs = (
|
|
27
|
-
Contember
|
|
30
|
+
const createDocs = (projectDirectory, projectName, packageManager) => `
|
|
31
|
+
Contember project successfully created in ${projectDirectory}
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
$ ${chalk.greenBright(`cd ${workspaceName}`)}
|
|
33
|
+
Next steps:
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
$ ${chalk.
|
|
35
|
+
1. Navigate to the project directory:
|
|
36
|
+
$ ${chalk.green(`cd ${projectName}`)}
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
$ ${chalk.
|
|
38
|
+
2. Install dependencies:
|
|
39
|
+
$ ${chalk.green(`${packageManager} install`)}
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
3. Start the Contember stack:
|
|
42
|
+
$ ${chalk.green(`${packageManager} start`)}
|
|
39
43
|
|
|
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)
|
|
44
|
+
Available services:
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
${chalk.bold("UI & Admin")}
|
|
47
|
+
- Contember Admin ${chalk.blue("http://localhost:1480")}
|
|
48
|
+
|
|
49
|
+
${chalk.bold("API & Backend")}
|
|
50
|
+
- Contember Engine API ${chalk.blue("http://localhost:1481")}
|
|
51
|
+
Auth token: 0000000000000000000000000000000000000000
|
|
52
|
+
|
|
53
|
+
${chalk.bold("Development Tools")}
|
|
54
|
+
- PostgreSQL database ${chalk.blue("http://localhost:1482")} ${chalk.grey("credentials: contember / contember")}
|
|
55
|
+
- Minio S3 storage ${chalk.blue("http://localhost:1483")}
|
|
56
|
+
- Mailpit SMTP testing ${chalk.blue("http://localhost:1484")}
|
|
57
|
+
- Adminer DB manager ${chalk.blue("http://localhost:1485")}
|
|
58
|
+
- Minio Dashboard ${chalk.blue("http://localhost:1486")} ${chalk.grey("credentials: contember / contember")}
|
|
59
|
+
|
|
60
|
+
${chalk.bold("Need help?")} Ask the community: https://github.com/orgs/contember/discussions
|
|
48
61
|
`;
|
|
49
62
|
exports.WorkspaceCreateCommand = WorkspaceCreateCommand;
|
|
50
63
|
//# sourceMappingURL=WorkspaceCreateCommand.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkspaceCreateCommand.cjs","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\n\ntype Args = {\n\
|
|
1
|
+
{"version":3,"file":"WorkspaceCreateCommand.cjs","sources":["../../../../../packages/create/src/commands/WorkspaceCreateCommand.ts"],"sourcesContent":["import { Command, CommandConfiguration, Input } from '@contember/cli-common'\nimport { join } from 'node:path'\nimport chalk from 'chalk'\nimport { TemplateInstaller } from '../lib/TemplateInstaller'\nimport { getPackageVersion } from '../lib/version'\nimport { detectPackageManager } from '../lib/packageManagerDetector'\n\ntype Args = {\n\tprojectName: string\n}\n\ntype Options = {\n\ttemplate: string\n}\n\nexport class WorkspaceCreateCommand extends Command<Args, Options> {\n\tconstructor(\n\t\tprivate readonly templateInstaller: TemplateInstaller,\n\t) {\n\t\tsuper()\n\t}\n\n\tprotected configure(configuration: CommandConfiguration<Args, Options>): void {\n\t\tconfiguration.description('Creates a new Contember project')\n\t\tconfiguration.argument('projectName')\n\t\tconfiguration.option('template').shortcut('t')\n\t}\n\n\tprotected async execute(input: Input<Args, Options>): Promise<void> {\n\t\tconst projectName = input.getArgument('projectName')\n\t\tconst projectDirectory = join(process.cwd(), projectName)\n\t\tconst packageManager = detectPackageManager()\n\n\t\tawait this.templateInstaller.installTemplate(input.getOption('template') ?? 'default', projectDirectory, {\n\t\t\tversion: await getPackageVersion(),\n\t\t\tprojectName: projectName,\n\t\t\tpackageManager: packageManager,\n\t\t})\n\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(createDocs(projectDirectory, projectName, packageManager))\n\t}\n}\n\nconst createDocs = (projectDirectory: string, projectName: string, packageManager: string) => `\nContember project successfully created in ${projectDirectory}\n\nNext steps:\n\n1. Navigate to the project directory:\n $ ${chalk.green(`cd ${projectName}`)}\n\n2. Install dependencies:\n $ ${chalk.green(`${packageManager} install`)}\n\n3. Start the Contember stack:\n $ ${chalk.green(`${packageManager} start`)}\n\nAvailable services:\n\n${chalk.bold('UI & Admin')}\n- Contember Admin ${chalk.blue('http://localhost:1480')}\n\n${chalk.bold('API & Backend')}\n- Contember Engine API ${chalk.blue('http://localhost:1481')}\n Auth token: 0000000000000000000000000000000000000000\n\n${chalk.bold('Development Tools')}\n- PostgreSQL database ${chalk.blue('http://localhost:1482')} ${chalk.grey('credentials: contember / contember')}\n- Minio S3 storage ${chalk.blue('http://localhost:1483')}\n- Mailpit SMTP testing ${chalk.blue('http://localhost:1484')}\n- Adminer DB manager ${chalk.blue('http://localhost:1485')}\n- Minio Dashboard ${chalk.blue('http://localhost:1486')} ${chalk.grey('credentials: contember / contember')}\n\n${chalk.bold('Need help?')} Ask the community: https://github.com/orgs/contember/discussions\n`\n"],"names":["Command","join","detectPackageManager","getPackageVersion"],"mappings":";;;;;;;AAeO,MAAM,+BAA+BA,UAAAA,QAAuB;AAAA,EAClE,YACkB,mBAChB;AACK,UAAA;AAFW,SAAA,oBAAA;AAAA,EAAA;AAAA,EAKR,UAAU,eAA0D;AAC7E,kBAAc,YAAY,iCAAiC;AAC3D,kBAAc,SAAS,aAAa;AACpC,kBAAc,OAAO,UAAU,EAAE,SAAS,GAAG;AAAA,EAAA;AAAA,EAG9C,MAAgB,QAAQ,OAA4C;AAC7D,UAAA,cAAc,MAAM,YAAY,aAAa;AACnD,UAAM,mBAAmBC,UAAA,KAAK,QAAQ,IAAA,GAAO,WAAW;AACxD,UAAM,iBAAiBC,uBAAAA,qBAAqB;AAEtC,UAAA,KAAK,kBAAkB,gBAAgB,MAAM,UAAU,UAAU,KAAK,WAAW,kBAAkB;AAAA,MACxG,SAAS,MAAMC,QAAAA,kBAAkB;AAAA,MACjC;AAAA,MACA;AAAA,IAAA,CACA;AAGD,YAAQ,IAAI,WAAW,kBAAkB,aAAa,cAAc,CAAC;AAAA,EAAA;AAEvE;AAEA,MAAM,aAAa,CAAC,kBAA0B,aAAqB,mBAA2B;AAAA,4CAClD,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,OAKrD,MAAM,MAAM,MAAM,WAAW,EAAE,CAAC;AAAA;AAAA;AAAA,OAGhC,MAAM,MAAM,GAAG,cAAc,UAAU,CAAC;AAAA;AAAA;AAAA,OAGxC,MAAM,MAAM,GAAG,cAAc,QAAQ,CAAC;AAAA;AAAA;AAAA;AAAA,EAI3C,MAAM,KAAK,YAAY,CAAC;AAAA,4BACE,MAAM,KAAK,uBAAuB,CAAC;AAAA;AAAA,EAE7D,MAAM,KAAK,eAAe,CAAC;AAAA,4BACD,MAAM,KAAK,uBAAuB,CAAC;AAAA;AAAA;AAAA,EAG7D,MAAM,KAAK,mBAAmB,CAAC;AAAA,4BACL,MAAM,KAAK,uBAAuB,CAAC,OAAO,MAAM,KAAK,oCAAoC,CAAC;AAAA,4BAC1F,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC;AAAA,4BACnC,MAAM,KAAK,uBAAuB,CAAC,OAAO,MAAM,KAAK,oCAAoC,CAAC;AAAA;AAAA,EAEpH,MAAM,KAAK,YAAY,CAAC;AAAA;;"}
|
|
@@ -2,47 +2,60 @@ import { Command } from "@contember/cli-common";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import { getPackageVersion } from "../lib/version.js";
|
|
5
|
+
import { detectPackageManager } from "../lib/packageManagerDetector.js";
|
|
5
6
|
class WorkspaceCreateCommand extends Command {
|
|
6
7
|
constructor(templateInstaller) {
|
|
7
8
|
super();
|
|
8
9
|
this.templateInstaller = templateInstaller;
|
|
9
10
|
}
|
|
10
11
|
configure(configuration) {
|
|
11
|
-
configuration.description("Creates a new Contember
|
|
12
|
-
configuration.argument("
|
|
12
|
+
configuration.description("Creates a new Contember project");
|
|
13
|
+
configuration.argument("projectName");
|
|
14
|
+
configuration.option("template").shortcut("t");
|
|
13
15
|
}
|
|
14
16
|
async execute(input) {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
17
|
+
const projectName = input.getArgument("projectName");
|
|
18
|
+
const projectDirectory = join(process.cwd(), projectName);
|
|
19
|
+
const packageManager = detectPackageManager();
|
|
20
|
+
await this.templateInstaller.installTemplate(input.getOption("template") ?? "default", projectDirectory, {
|
|
18
21
|
version: await getPackageVersion(),
|
|
19
|
-
projectName
|
|
22
|
+
projectName,
|
|
23
|
+
packageManager
|
|
20
24
|
});
|
|
21
|
-
console.log(createDocs(
|
|
25
|
+
console.log(createDocs(projectDirectory, projectName, packageManager));
|
|
22
26
|
}
|
|
23
27
|
}
|
|
24
|
-
const createDocs = (
|
|
25
|
-
Contember
|
|
28
|
+
const createDocs = (projectDirectory, projectName, packageManager) => `
|
|
29
|
+
Contember project successfully created in ${projectDirectory}
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
$ ${chalk.greenBright(`cd ${workspaceName}`)}
|
|
31
|
+
Next steps:
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
$ ${chalk.
|
|
33
|
+
1. Navigate to the project directory:
|
|
34
|
+
$ ${chalk.green(`cd ${projectName}`)}
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
$ ${chalk.
|
|
36
|
+
2. Install dependencies:
|
|
37
|
+
$ ${chalk.green(`${packageManager} install`)}
|
|
35
38
|
|
|
36
|
-
|
|
39
|
+
3. Start the Contember stack:
|
|
40
|
+
$ ${chalk.green(`${packageManager} start`)}
|
|
37
41
|
|
|
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)
|
|
42
|
+
Available services:
|
|
44
43
|
|
|
45
|
-
|
|
44
|
+
${chalk.bold("UI & Admin")}
|
|
45
|
+
- Contember Admin ${chalk.blue("http://localhost:1480")}
|
|
46
|
+
|
|
47
|
+
${chalk.bold("API & Backend")}
|
|
48
|
+
- Contember Engine API ${chalk.blue("http://localhost:1481")}
|
|
49
|
+
Auth token: 0000000000000000000000000000000000000000
|
|
50
|
+
|
|
51
|
+
${chalk.bold("Development Tools")}
|
|
52
|
+
- PostgreSQL database ${chalk.blue("http://localhost:1482")} ${chalk.grey("credentials: contember / contember")}
|
|
53
|
+
- Minio S3 storage ${chalk.blue("http://localhost:1483")}
|
|
54
|
+
- Mailpit SMTP testing ${chalk.blue("http://localhost:1484")}
|
|
55
|
+
- Adminer DB manager ${chalk.blue("http://localhost:1485")}
|
|
56
|
+
- Minio Dashboard ${chalk.blue("http://localhost:1486")} ${chalk.grey("credentials: contember / contember")}
|
|
57
|
+
|
|
58
|
+
${chalk.bold("Need help?")} Ask the community: https://github.com/orgs/contember/discussions
|
|
46
59
|
`;
|
|
47
60
|
export {
|
|
48
61
|
WorkspaceCreateCommand
|