@contember/create 2.1.0-beta.2 → 2.2.0-alpha.2
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.map +1 -1
- package/dist/development/run.js.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs +2 -2
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/development/src/lib/FileSystem.cjs +1 -2
- package/dist/development/src/lib/FileSystem.cjs.map +1 -1
- package/dist/development/src/lib/FileSystem.js +1 -2
- package/dist/development/src/lib/FileSystem.js.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.cjs +16 -16
- package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/development/src/lib/packageManagerDetector.cjs +6 -6
- package/dist/development/src/lib/packageManagerDetector.cjs.map +1 -1
- package/dist/development/src/lib/version.cjs +2 -2
- 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 +3 -3
- package/dist/development/src/paths.cjs.map +1 -1
- package/dist/production/run.cjs.map +1 -1
- package/dist/production/run.js.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs +2 -2
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/production/src/lib/FileSystem.cjs +1 -2
- package/dist/production/src/lib/FileSystem.cjs.map +1 -1
- package/dist/production/src/lib/FileSystem.js +1 -2
- package/dist/production/src/lib/FileSystem.js.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.cjs +16 -16
- package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/production/src/lib/packageManagerDetector.cjs +6 -6
- package/dist/production/src/lib/packageManagerDetector.cjs.map +1 -1
- package/dist/production/src/lib/version.cjs +2 -2
- 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 +3 -3
- package/dist/production/src/paths.cjs.map +1 -1
- package/dist/types/commands/WorkspaceCreateCommand.d.ts +1 -1
- package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
- package/dist/types/commands/index.d.ts +1 -1
- package/dist/types/commands/index.d.ts.map +1 -1
- package/dist/types/lib/FileSystem.d.ts +3 -2
- package/dist/types/lib/FileSystem.d.ts.map +1 -1
- package/dist/types/lib/TemplateInstaller.d.ts +1 -1
- package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/resources/templates/default/admin/lib/binding/binding.tsx +19 -4
- package/resources/templates/default/admin/lib/binding/delete.tsx +37 -3
- package/resources/templates/default/admin/lib/binding/hooks.tsx +65 -3
- package/resources/templates/default/admin/lib/binding/identity.tsx +17 -4
- package/resources/templates/default/admin/lib/binding/index.ts +5 -5
- package/resources/templates/default/admin/lib/binding/navigation-guard-dialog.tsx +15 -3
- package/resources/templates/default/admin/lib/binding/persist.tsx +27 -5
- package/resources/templates/default/admin/lib/block-repeater/block-repeater.tsx +15 -11
- package/resources/templates/default/admin/lib/block-repeater/index.ts +1 -1
- package/resources/templates/default/admin/lib/board/board.tsx +2 -2
- package/resources/templates/default/admin/lib/board/index.ts +1 -1
- package/resources/templates/default/admin/lib/buttons/back-button.tsx +22 -2
- package/resources/templates/default/admin/lib/buttons/index.ts +2 -2
- package/resources/templates/default/admin/lib/buttons/link-back-button.tsx +11 -2
- package/resources/templates/default/admin/lib/datagrid/cells.tsx +3 -3
- package/resources/templates/default/admin/lib/datagrid/column-header.tsx +4 -4
- package/resources/templates/default/admin/lib/datagrid/columns.tsx +28 -14
- package/resources/templates/default/admin/lib/datagrid/elements.tsx +2 -2
- package/resources/templates/default/admin/lib/datagrid/empty.tsx +1 -1
- package/resources/templates/default/admin/lib/datagrid/export.tsx +2 -2
- package/resources/templates/default/admin/lib/datagrid/filters/boolean.tsx +13 -13
- package/resources/templates/default/admin/lib/datagrid/filters/common.tsx +2 -2
- package/resources/templates/default/admin/lib/datagrid/filters/date.tsx +37 -16
- package/resources/templates/default/admin/lib/datagrid/filters/defined.tsx +13 -12
- package/resources/templates/default/admin/lib/datagrid/filters/enum.tsx +56 -22
- package/resources/templates/default/admin/lib/datagrid/filters/index.ts +7 -7
- package/resources/templates/default/admin/lib/datagrid/filters/mobile.tsx +18 -0
- package/resources/templates/default/admin/lib/datagrid/filters/number.tsx +10 -13
- package/resources/templates/default/admin/lib/datagrid/filters/relation.tsx +8 -8
- package/resources/templates/default/admin/lib/datagrid/filters/text.tsx +9 -9
- package/resources/templates/default/admin/lib/datagrid/grid.tsx +31 -23
- package/resources/templates/default/admin/lib/datagrid/index.ts +12 -12
- package/resources/templates/default/admin/lib/datagrid/labels.tsx +22 -4
- package/resources/templates/default/admin/lib/datagrid/layout-switcher.tsx +10 -4
- package/resources/templates/default/admin/lib/datagrid/loader.tsx +4 -4
- package/resources/templates/default/admin/lib/datagrid/pagination.tsx +16 -6
- package/resources/templates/default/admin/lib/datagrid/table.tsx +8 -6
- package/resources/templates/default/admin/lib/datagrid/tiles.tsx +6 -5
- package/resources/templates/default/admin/lib/datagrid/toolbar.tsx +15 -19
- package/resources/templates/default/admin/lib/datagrid/ui.tsx +3 -3
- package/resources/templates/default/admin/lib/dev/index.ts +2 -2
- package/resources/templates/default/admin/lib/dev/login-panel.tsx +12 -3
- package/resources/templates/default/admin/lib/dev/todo.tsx +12 -0
- package/resources/templates/default/admin/lib/dict.ts +0 -261
- package/resources/templates/default/admin/lib/dimensions/dimensions.tsx +85 -4
- package/resources/templates/default/admin/lib/dimensions/index.ts +1 -1
- package/resources/templates/default/admin/lib/editor/block-editor.tsx +72 -3
- package/resources/templates/default/admin/lib/editor/common/baseEditorPlugins.tsx +54 -11
- package/resources/templates/default/admin/lib/editor/common/buttons.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/editor-block-toolbar.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/HeadingRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/ListItemRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/OrderedListRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/TableElementRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/index.ts +6 -6
- package/resources/templates/default/admin/lib/editor/editor-block.tsx +54 -3
- package/resources/templates/default/admin/lib/editor/index.ts +6 -6
- package/resources/templates/default/admin/lib/editor/plugins.tsx +46 -2
- package/resources/templates/default/admin/lib/editor/rich-text-view.tsx +44 -0
- package/resources/templates/default/admin/lib/editor/rich-text.tsx +31 -3
- package/resources/templates/default/admin/lib/editor/sortable-block.tsx +34 -2
- package/resources/templates/default/admin/lib/errors/index.ts +1 -1
- package/resources/templates/default/admin/lib/errors/use-error-formatter.ts +22 -1
- package/resources/templates/default/admin/lib/field/formatted-field.tsx +16 -1
- package/resources/templates/default/admin/lib/field/index.ts +2 -1
- package/resources/templates/default/admin/lib/field/list-field.tsx +56 -0
- package/resources/templates/default/admin/lib/form/container.tsx +33 -3
- package/resources/templates/default/admin/lib/form/index.ts +6 -5
- package/resources/templates/default/admin/lib/form/inputs.tsx +105 -6
- package/resources/templates/default/admin/lib/form/labels.tsx +1 -1
- package/resources/templates/default/admin/lib/form/select.tsx +162 -5
- package/resources/templates/default/admin/lib/form/ui.tsx +2 -2
- package/resources/templates/default/admin/lib/form/upload-repeaters.tsx +159 -5
- package/resources/templates/default/admin/lib/form/upload.tsx +116 -3
- package/resources/templates/default/admin/lib/formatting/formatting.ts +106 -1
- package/resources/templates/default/admin/lib/formatting/index.ts +1 -1
- package/resources/templates/default/admin/lib/images/formatImageResizeUrl.ts +19 -0
- package/resources/templates/default/admin/lib/images/index.ts +1 -1
- package/resources/templates/default/admin/lib/index.ts +54 -0
- package/resources/templates/default/admin/lib/labels/index.ts +2 -2
- package/resources/templates/default/admin/lib/layout/index.ts +3 -3
- package/resources/templates/default/admin/lib/layout/layout-boxed.tsx +5 -5
- package/resources/templates/default/admin/lib/layout/layout.tsx +3 -3
- package/resources/templates/default/admin/lib/outdated-application-dialog/index.ts +1 -1
- package/resources/templates/default/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +2 -2
- package/resources/templates/default/admin/lib/repeater/index.ts +1 -1
- package/resources/templates/default/admin/lib/repeater/repeater.tsx +26 -9
- package/resources/templates/default/admin/lib/select/create-new.tsx +19 -3
- package/resources/templates/default/admin/lib/select/filter.tsx +8 -2
- package/resources/templates/default/admin/lib/select/highlight.tsx +16 -0
- package/resources/templates/default/admin/lib/select/index.ts +6 -6
- package/resources/templates/default/admin/lib/select/list.tsx +30 -6
- package/resources/templates/default/admin/lib/select/multi-select.tsx +41 -4
- package/resources/templates/default/admin/lib/select/select.tsx +44 -6
- package/resources/templates/default/admin/lib/select/sortable-select.tsx +15 -6
- package/resources/templates/default/admin/lib/select/ui.tsx +100 -4
- package/resources/templates/default/admin/lib/tenant/dict.ts +324 -0
- package/resources/templates/default/admin/lib/tenant/forms/change-my-password.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/forms/common.tsx +3 -3
- package/resources/templates/default/admin/lib/tenant/forms/confirm-email-change.tsx +38 -0
- package/resources/templates/default/admin/lib/tenant/forms/create-api-key.tsx +5 -5
- package/resources/templates/default/admin/lib/tenant/forms/index.ts +12 -8
- package/resources/templates/default/admin/lib/tenant/forms/invite.tsx +5 -5
- package/resources/templates/default/admin/lib/tenant/forms/login.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/forms/memberships-control.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/forms/password-reset-request.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/forms/password-reset.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin-init.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/forms/request-email-verification.tsx +35 -0
- package/resources/templates/default/admin/lib/tenant/forms/update-project-member.tsx +14 -5
- package/resources/templates/default/admin/lib/tenant/forms/verify-email.tsx +38 -0
- package/resources/templates/default/admin/lib/tenant/hooks/useInvite.ts +41 -0
- package/resources/templates/default/admin/lib/tenant/hooks/useInviteUser.tsx +32 -3
- package/resources/templates/default/admin/lib/tenant/index.ts +3 -3
- package/resources/templates/default/admin/lib/tenant/listing/api-key-list.tsx +3 -3
- package/resources/templates/default/admin/lib/tenant/listing/index.ts +4 -4
- package/resources/templates/default/admin/lib/tenant/listing/member-delete-dialog.tsx +3 -3
- package/resources/templates/default/admin/lib/tenant/listing/member-list.tsx +8 -8
- package/resources/templates/default/admin/lib/tenant/listing/person-list.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/otp/index.ts +1 -1
- package/resources/templates/default/admin/lib/tenant/otp/otp-setup.tsx +6 -6
- package/resources/templates/default/admin/lib/toast/index.ts +2 -2
- package/resources/templates/default/admin/lib/toast/toast.tsx +3 -3
- package/resources/templates/default/admin/lib/ui/alert-dialog.tsx +114 -3
- package/resources/templates/default/admin/lib/ui/avatar.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/button.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/card.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/collapsible.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/dialog.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/dimension.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/divider.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/dropdown.tsx +3 -3
- package/resources/templates/default/admin/lib/ui/input.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/label.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/loader.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/menu.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/overlay.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/popover.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/progress.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/property-list.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/scroll-area.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/select.tsx +44 -2
- package/resources/templates/default/admin/lib/ui/separator.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/sheet.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/sidebar.tsx +8 -8
- package/resources/templates/default/admin/lib/ui/skeleton.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/sortable.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/switch.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/table.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/textarea.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/toggle-group.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/toggle.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/tooltip.tsx +2 -2
- package/resources/templates/default/admin/lib/upload/dropzone.tsx +20 -3
- package/resources/templates/default/admin/lib/upload/index.ts +3 -3
- package/resources/templates/default/admin/lib/upload/repeater.tsx +5 -1
- package/resources/templates/default/admin/lib/upload/ui.tsx +2 -2
- package/resources/templates/default/admin/lib/upload/upload-progress.tsx +6 -6
- package/resources/templates/default/admin/lib/upload/view.tsx +4 -4
- package/resources/templates/default/admin/lib/utils/cn.ts +18 -0
- package/resources/templates/default/admin/lib/utils/createComponentOpenHooks.tsx +33 -0
- package/resources/templates/default/admin/lib/utils/index.ts +2 -2
- package/resources/templates/default/admin/lib/utils/uic.tsx +59 -0
- package/resources/templates/default/admin/lib/utils/use-mobile.ts +19 -0
- package/resources/templates/default/scripts/assemble-ui-lib.mjs +132 -0
- package/resources/templates/default/scripts/update-ui-lib.sh +101 -185
- package/src/commands/WorkspaceCreateCommand.ts +3 -3
- package/src/commands/index.ts +1 -1
- package/src/lib/FileSystem.ts +2 -2
- package/src/lib/TemplateInstaller.ts +1 -1
- package/src/lib/version.ts +1 -1
- package/src/run.ts +4 -4
|
@@ -3,26 +3,37 @@ set -euo pipefail
|
|
|
3
3
|
|
|
4
4
|
### Default Configuration ###
|
|
5
5
|
TEMPLATE_REPO_URL="git@github.com:contember/contember.git" # Template repository URL
|
|
6
|
-
|
|
6
|
+
PACKAGES_SUBDIR="packages" # Where the UI-lib packages live in the repo
|
|
7
7
|
OLD_COMMIT="9fc76ce46eb9d9196a88eeb01c7305b182dde7dd" # Default base commit or tag
|
|
8
8
|
NEW_COMMIT="main" # Default branch or commit with latest changes
|
|
9
|
-
TARGET_DIR="admin/lib" # Directory to map the
|
|
10
|
-
CLONE_DIR=".tmp-ui-lib-update" # Temporary clone directory
|
|
9
|
+
TARGET_DIR="admin/lib" # Directory to map the assembled content into
|
|
10
|
+
CLONE_DIR=".tmp-ui-lib-update" # Temporary clone directory (source packages)
|
|
11
|
+
BUILD_DIR=".tmp-ui-lib-build" # Temporary git repo holding the assembled lib
|
|
11
12
|
REMOTE_NAME="ui-lib-update-temp" # Temporary remote name
|
|
12
13
|
COMMIT_FILE="$TARGET_DIR/COMMIT" # File to store the new commit hash
|
|
13
14
|
FORCE_MODE=false # Default to non-force mode
|
|
14
15
|
### End Default Configuration ###
|
|
15
16
|
|
|
17
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
18
|
+
ASSEMBLE="$SCRIPT_DIR/assemble-ui-lib.mjs"
|
|
19
|
+
|
|
20
|
+
# The UI lib is assembled from these packages (base + tenant + the high-level lib).
|
|
21
|
+
# Older revisions only had the single react-ui-lib package; assemble-ui-lib.mjs
|
|
22
|
+
# detects that and falls back to the legacy single-package layout.
|
|
23
|
+
UI_LIB_PACKAGES=("react-ui-lib" "react-ui-lib-base" "react-ui-lib-tenant")
|
|
24
|
+
|
|
16
25
|
# Function to show help message
|
|
17
26
|
show_help() {
|
|
18
27
|
echo "Usage: $0 [options]"
|
|
19
28
|
echo ""
|
|
29
|
+
echo "Updates admin/lib by assembling the Contember UI-lib packages and"
|
|
30
|
+
echo "cherry-picking the upstream changes onto your (possibly customised) copy."
|
|
31
|
+
echo ""
|
|
20
32
|
echo "Options:"
|
|
21
33
|
echo " --force Replace target directory without cherry-picking"
|
|
22
34
|
echo " --from COMMIT Specify base commit, tag, or branch (default: from COMMIT file or $OLD_COMMIT)"
|
|
23
35
|
echo " --to COMMIT Specify target commit, tag, or branch (default: $NEW_COMMIT)"
|
|
24
36
|
echo " --repo URL Specify template repository URL (default: $TEMPLATE_REPO_URL)"
|
|
25
|
-
echo " --template-dir DIR Specify template directory within repo (default: $TEMPLATE_DIR)"
|
|
26
37
|
echo " --target-dir DIR Specify target directory in this project (default: $TARGET_DIR)"
|
|
27
38
|
echo " --help Show this help message"
|
|
28
39
|
echo ""
|
|
@@ -63,14 +74,6 @@ while [[ $# -gt 0 ]]; do
|
|
|
63
74
|
TEMPLATE_REPO_URL="$2"
|
|
64
75
|
shift 2
|
|
65
76
|
;;
|
|
66
|
-
--template-dir)
|
|
67
|
-
if [ -z "${2:-}" ]; then
|
|
68
|
-
echo "Error: --template-dir requires a directory path"
|
|
69
|
-
exit 1
|
|
70
|
-
fi
|
|
71
|
-
TEMPLATE_DIR="$2"
|
|
72
|
-
shift 2
|
|
73
|
-
;;
|
|
74
77
|
--target-dir)
|
|
75
78
|
if [ -z "${2:-}" ]; then
|
|
76
79
|
echo "Error: --target-dir requires a directory path"
|
|
@@ -92,15 +95,20 @@ while [[ $# -gt 0 ]]; do
|
|
|
92
95
|
esac
|
|
93
96
|
done
|
|
94
97
|
|
|
98
|
+
if [ ! -f "$ASSEMBLE" ]; then
|
|
99
|
+
echo "Error: assembler not found at $ASSEMBLE"
|
|
100
|
+
echo "Make sure scripts/assemble-ui-lib.mjs is present (it ships next to this script)."
|
|
101
|
+
exit 1
|
|
102
|
+
fi
|
|
103
|
+
|
|
95
104
|
echo "Running in $([ "$FORCE_MODE" = true ] && echo "FORCE" || echo "normal") mode"
|
|
96
105
|
echo "Using repository: $TEMPLATE_REPO_URL"
|
|
97
|
-
echo "Template directory: $TEMPLATE_DIR"
|
|
98
106
|
echo "Target directory: $TARGET_DIR"
|
|
99
107
|
|
|
100
108
|
# Ensure cleanup on exit
|
|
101
109
|
cleanup() {
|
|
102
110
|
echo "Cleaning up temporary files..."
|
|
103
|
-
rm -rf "$CLONE_DIR"
|
|
111
|
+
rm -rf "$CLONE_DIR" "$BUILD_DIR"
|
|
104
112
|
git remote remove "$REMOTE_NAME" 2>/dev/null || true
|
|
105
113
|
}
|
|
106
114
|
trap cleanup EXIT
|
|
@@ -120,68 +128,50 @@ fi
|
|
|
120
128
|
echo "Updating from: $OLD_COMMIT"
|
|
121
129
|
echo "Updating to: $NEW_COMMIT"
|
|
122
130
|
|
|
123
|
-
# Step 1: Clone the template repository with sparse checkout
|
|
131
|
+
# Step 1: Clone the template repository with sparse checkout of the UI-lib package sources
|
|
124
132
|
echo "Cloning the template repository into $CLONE_DIR..."
|
|
125
133
|
rm -rf "$CLONE_DIR"
|
|
126
134
|
mkdir -p "$CLONE_DIR"
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
git
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
echo "Fetching commit/branch: $OLD_COMMIT"
|
|
146
|
-
git fetch origin "$OLD_COMMIT" --depth=1
|
|
147
|
-
fi
|
|
148
|
-
|
|
149
|
-
if [[ "$NEW_COMMIT" =~ ^v[0-9] ]]; then
|
|
150
|
-
echo "Fetching tag: $NEW_COMMIT"
|
|
151
|
-
git fetch origin "refs/tags/$NEW_COMMIT:refs/tags/$NEW_COMMIT" --depth=1
|
|
135
|
+
(
|
|
136
|
+
cd "$CLONE_DIR"
|
|
137
|
+
git init --quiet
|
|
138
|
+
git remote add origin "$TEMPLATE_REPO_URL"
|
|
139
|
+
git sparse-checkout init --cone
|
|
140
|
+
SPARSE_PATHS=()
|
|
141
|
+
for pkg in "${UI_LIB_PACKAGES[@]}"; do
|
|
142
|
+
SPARSE_PATHS+=("$PACKAGES_SUBDIR/$pkg/src")
|
|
143
|
+
done
|
|
144
|
+
git sparse-checkout set "${SPARSE_PATHS[@]}"
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
# Step 2: Fetch the references
|
|
148
|
+
fetch_ref() {
|
|
149
|
+
local ref="$1"
|
|
150
|
+
if [[ "$ref" =~ ^v[0-9] ]]; then
|
|
151
|
+
echo "Fetching tag: $ref"
|
|
152
|
+
git -C "$CLONE_DIR" fetch origin "refs/tags/$ref:refs/tags/$ref" --depth=1
|
|
152
153
|
else
|
|
153
|
-
echo "Fetching commit/branch: $
|
|
154
|
-
git fetch origin "$
|
|
154
|
+
echo "Fetching commit/branch: $ref"
|
|
155
|
+
git -C "$CLONE_DIR" fetch origin "$ref" --depth=1
|
|
155
156
|
fi
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
git fetch origin "$OLD_COMMIT" "$NEW_COMMIT" --depth=1
|
|
160
|
-
fi
|
|
157
|
+
}
|
|
158
|
+
fetch_ref "$OLD_COMMIT"
|
|
159
|
+
fetch_ref "$NEW_COMMIT"
|
|
161
160
|
|
|
162
161
|
# Step 3: Resolve the references to actual commit hashes
|
|
163
|
-
echo "Resolving commit references..."
|
|
164
|
-
|
|
165
|
-
# Function to resolve a reference to a commit hash
|
|
166
162
|
resolve_ref() {
|
|
167
|
-
local ref
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
# Try different ways to resolve the reference
|
|
171
|
-
if hash=$(git rev-parse --quiet --verify "$ref" 2>/dev/null); then
|
|
163
|
+
local ref="$1" hash
|
|
164
|
+
if hash=$(git -C "$CLONE_DIR" rev-parse --quiet --verify "$ref" 2>/dev/null); then
|
|
172
165
|
echo "$hash"
|
|
173
|
-
elif hash=$(git rev-parse --quiet --verify "origin/$ref" 2>/dev/null); then
|
|
166
|
+
elif hash=$(git -C "$CLONE_DIR" rev-parse --quiet --verify "origin/$ref" 2>/dev/null); then
|
|
174
167
|
echo "$hash"
|
|
175
|
-
elif [[ "$ref" =~ ^v[0-9] ]] && hash=$(git rev-parse --quiet --verify "refs/tags/$ref" 2>/dev/null); then
|
|
168
|
+
elif [[ "$ref" =~ ^v[0-9] ]] && hash=$(git -C "$CLONE_DIR" rev-parse --quiet --verify "refs/tags/$ref" 2>/dev/null); then
|
|
176
169
|
echo "$hash"
|
|
177
170
|
else
|
|
178
|
-
|
|
179
|
-
git
|
|
180
|
-
|
|
181
|
-
if hash=$(git rev-parse --quiet --verify "refs/tags/$ref" 2>/dev/null); then
|
|
171
|
+
git -C "$CLONE_DIR" fetch origin "refs/tags/$ref:refs/tags/$ref" --depth=1 2>/dev/null || true
|
|
172
|
+
if hash=$(git -C "$CLONE_DIR" rev-parse --quiet --verify "refs/tags/$ref" 2>/dev/null); then
|
|
182
173
|
echo "$hash"
|
|
183
174
|
else
|
|
184
|
-
# If all else fails, return the input (might be a direct hash)
|
|
185
175
|
echo "$ref"
|
|
186
176
|
fi
|
|
187
177
|
fi
|
|
@@ -189,154 +179,80 @@ resolve_ref() {
|
|
|
189
179
|
|
|
190
180
|
OLD_COMMIT_HASH=$(resolve_ref "$OLD_COMMIT")
|
|
191
181
|
NEW_COMMIT_HASH=$(resolve_ref "$NEW_COMMIT")
|
|
192
|
-
|
|
193
182
|
echo "Resolved OLD_COMMIT to: $OLD_COMMIT_HASH"
|
|
194
183
|
echo "Resolved NEW_COMMIT to: $NEW_COMMIT_HASH"
|
|
184
|
+
NEW_COMMIT_REF="$NEW_COMMIT_HASH"
|
|
185
|
+
|
|
186
|
+
# Helper: check out the UI-lib package sources at a given commit into CLONE_DIR
|
|
187
|
+
checkout_packages() {
|
|
188
|
+
local commit="$1"
|
|
189
|
+
rm -rf "${CLONE_DIR:?}/$PACKAGES_SUBDIR"
|
|
190
|
+
for pkg in "${UI_LIB_PACKAGES[@]}"; do
|
|
191
|
+
local path="$PACKAGES_SUBDIR/$pkg/src"
|
|
192
|
+
if git -C "$CLONE_DIR" cat-file -e "$commit:$path" 2>/dev/null; then
|
|
193
|
+
git -C "$CLONE_DIR" checkout -q "$commit" -- "$path"
|
|
194
|
+
fi
|
|
195
|
+
done
|
|
196
|
+
}
|
|
195
197
|
|
|
196
|
-
#
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
# Try formatting, but don't fail if biome is not available or nothing changes
|
|
204
|
-
if command -v biome &> /dev/null; then
|
|
205
|
-
echo "Formatting code with biome..."
|
|
206
|
-
biome check --write "$TEMPLATE_DIR" 2>/dev/null || true
|
|
207
|
-
|
|
208
|
-
# Only commit if there are actual changes
|
|
209
|
-
if [[ -n $(git status --porcelain "$TEMPLATE_DIR") ]]; then
|
|
210
|
-
git add "$TEMPLATE_DIR"
|
|
211
|
-
git commit -m "Format code base at $OLD_COMMIT"
|
|
212
|
-
FORMAT_COMMIT=$(git rev-parse HEAD)
|
|
213
|
-
echo "Formatting commit created: $FORMAT_COMMIT"
|
|
214
|
-
else
|
|
215
|
-
echo "No formatting changes detected, using $OLD_COMMIT_HASH directly"
|
|
216
|
-
FORMAT_COMMIT=$OLD_COMMIT_HASH
|
|
198
|
+
# Helper: assemble admin/lib for a given commit into an absolute output directory
|
|
199
|
+
assemble_at() {
|
|
200
|
+
local commit="$1" out="$2"
|
|
201
|
+
checkout_packages "$commit"
|
|
202
|
+
node "$ASSEMBLE" --packages-dir "$PWD/$CLONE_DIR/$PACKAGES_SUBDIR" --target "$out"
|
|
203
|
+
if command -v biome &>/dev/null; then
|
|
204
|
+
biome check --write "$out" >/dev/null 2>&1 || true
|
|
217
205
|
fi
|
|
218
|
-
|
|
219
|
-
echo "Biome not found, skipping formatting step"
|
|
220
|
-
FORMAT_COMMIT=$OLD_COMMIT_HASH
|
|
221
|
-
fi
|
|
222
|
-
|
|
223
|
-
# Step 5: Checkout the new commit
|
|
224
|
-
echo "Checking out the new code..."
|
|
225
|
-
if ! git checkout "$NEW_COMMIT_HASH" -- "$TEMPLATE_DIR"; then
|
|
226
|
-
echo "Error: Failed to checkout $NEW_COMMIT_HASH"
|
|
227
|
-
exit 1
|
|
228
|
-
fi
|
|
229
|
-
|
|
230
|
-
# Capture the actual commit hash of the new commit for the COMMIT file
|
|
231
|
-
NEW_COMMIT_REF=$NEW_COMMIT_HASH
|
|
232
|
-
echo "New commit reference: $NEW_COMMIT_REF"
|
|
233
|
-
|
|
234
|
-
# Step 6: Reset and stage only the sparse directory
|
|
235
|
-
echo "Preparing changes..."
|
|
236
|
-
git reset "$FORMAT_COMMIT" -- "$TEMPLATE_DIR"
|
|
206
|
+
}
|
|
237
207
|
|
|
238
|
-
#
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
208
|
+
# Step 4: Build a temporary git repo with two commits: assembled OLD, then assembled NEW.
|
|
209
|
+
echo "Assembling UI lib for both revisions..."
|
|
210
|
+
rm -rf "$BUILD_DIR"
|
|
211
|
+
mkdir -p "$BUILD_DIR/$(dirname "$TARGET_DIR")"
|
|
212
|
+
git -C "$BUILD_DIR" init --quiet
|
|
213
|
+
git -C "$BUILD_DIR" config user.email "noreply@contember.com"
|
|
214
|
+
git -C "$BUILD_DIR" config user.name "Contember UI lib update"
|
|
243
215
|
|
|
244
|
-
|
|
216
|
+
assemble_at "$OLD_COMMIT_HASH" "$PWD/$BUILD_DIR/$TARGET_DIR"
|
|
217
|
+
git -C "$BUILD_DIR" add -A
|
|
218
|
+
git -C "$BUILD_DIR" commit -q --allow-empty -m "UI lib at $OLD_COMMIT"
|
|
245
219
|
|
|
246
|
-
|
|
247
|
-
|
|
220
|
+
rm -rf "${BUILD_DIR:?}/$TARGET_DIR"
|
|
221
|
+
assemble_at "$NEW_COMMIT_HASH" "$PWD/$BUILD_DIR/$TARGET_DIR"
|
|
222
|
+
git -C "$BUILD_DIR" add -A
|
|
248
223
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
git commit -m "Update UI lib to $NEW_COMMIT"
|
|
252
|
-
else
|
|
253
|
-
echo "No changes detected between $OLD_COMMIT and $NEW_COMMIT in $TEMPLATE_DIR"
|
|
224
|
+
if git -C "$BUILD_DIR" diff --cached --quiet; then
|
|
225
|
+
echo "No changes detected between $OLD_COMMIT and $NEW_COMMIT in $TARGET_DIR"
|
|
254
226
|
exit 0
|
|
255
227
|
fi
|
|
228
|
+
git -C "$BUILD_DIR" commit -q -m "Update UI lib to $NEW_COMMIT"
|
|
229
|
+
SQUASHED_COMMIT=$(git -C "$BUILD_DIR" rev-parse HEAD)
|
|
230
|
+
echo "Assembled change commit: $SQUASHED_COMMIT"
|
|
256
231
|
|
|
257
|
-
#
|
|
258
|
-
SQUASHED_COMMIT=$(git rev-parse HEAD)
|
|
259
|
-
echo "Commit created: $SQUASHED_COMMIT"
|
|
260
|
-
|
|
261
|
-
# Return to the main repository
|
|
262
|
-
cd - # Return to the main repository
|
|
263
|
-
|
|
232
|
+
# Step 5: Apply the change to the current project
|
|
264
233
|
if [ "$FORCE_MODE" = true ]; then
|
|
265
|
-
# FORCE MODE: directly replace the target directory
|
|
266
234
|
echo "Force mode: directly replacing $TARGET_DIR..."
|
|
267
|
-
|
|
268
|
-
# Remove the target directory if it exists
|
|
269
|
-
if [ -d "$TARGET_DIR" ]; then
|
|
270
|
-
echo "Removing existing $TARGET_DIR directory"
|
|
271
|
-
rm -rf "$TARGET_DIR"
|
|
272
|
-
fi
|
|
273
|
-
|
|
274
|
-
# Create target parent directory if needed
|
|
235
|
+
rm -rf "$TARGET_DIR"
|
|
275
236
|
mkdir -p "$(dirname "$TARGET_DIR")"
|
|
276
|
-
|
|
277
|
-
# Copy files directly from source template directory in temporary repo
|
|
278
|
-
echo "Copying new files from template to target directory"
|
|
279
|
-
cp -r "$CLONE_DIR/$TEMPLATE_DIR" "$TARGET_DIR"
|
|
280
|
-
|
|
281
|
-
# Remove files that should not be included
|
|
282
|
-
if [ -f "$TARGET_DIR/index.ts" ]; then
|
|
283
|
-
echo "Removing $TARGET_DIR/index.ts"
|
|
284
|
-
rm "$TARGET_DIR/index.ts"
|
|
285
|
-
fi
|
|
286
|
-
if [ -f "$TARGET_DIR/tsconfig.json" ]; then
|
|
287
|
-
echo "Removing $TARGET_DIR/tsconfig.json"
|
|
288
|
-
rm "$TARGET_DIR/tsconfig.json"
|
|
289
|
-
fi
|
|
290
|
-
|
|
291
|
-
# Write the new commit hash to the COMMIT file
|
|
292
|
-
echo "Writing new commit reference to $COMMIT_FILE"
|
|
237
|
+
cp -r "$BUILD_DIR/$TARGET_DIR" "$TARGET_DIR"
|
|
293
238
|
echo "$NEW_COMMIT_REF" > "$COMMIT_FILE"
|
|
294
|
-
|
|
295
|
-
echo "
|
|
296
|
-
echo "To review and commit changes: git add $TARGET_DIR && git commit -m \"Update UI lib to $NEW_COMMIT\""
|
|
239
|
+
echo "Force update complete. Review and commit the changes:"
|
|
240
|
+
echo " git add $TARGET_DIR && git commit -m \"Update UI lib to $NEW_COMMIT\""
|
|
297
241
|
else
|
|
298
|
-
|
|
299
|
-
echo "Moving files in temporary repository..."
|
|
300
|
-
cd "$CLONE_DIR"
|
|
301
|
-
mkdir -p "$(dirname "$TARGET_DIR")"
|
|
302
|
-
cp -r "$TEMPLATE_DIR" "$TARGET_DIR"
|
|
303
|
-
|
|
304
|
-
# Remove files that should not be included
|
|
305
|
-
if [ -f "$TARGET_DIR/index.ts" ]; then
|
|
306
|
-
rm "$TARGET_DIR/index.ts"
|
|
307
|
-
fi
|
|
308
|
-
if [ -f "$TARGET_DIR/tsconfig.json" ]; then
|
|
309
|
-
rm "$TARGET_DIR/tsconfig.json"
|
|
310
|
-
fi
|
|
311
|
-
|
|
312
|
-
# Add the changes
|
|
313
|
-
git add "$TARGET_DIR"
|
|
314
|
-
git commit --amend --no-edit
|
|
315
|
-
|
|
316
|
-
# Update the squashed commit reference
|
|
317
|
-
SQUASHED_COMMIT=$(git rev-parse HEAD)
|
|
318
|
-
cd - # Return to main repository
|
|
319
|
-
|
|
320
|
-
# NORMAL MODE: use cherry-pick to merge changes
|
|
321
|
-
echo "Adding the temporary repository as a remote to the main repository..."
|
|
242
|
+
echo "Cherry-picking the assembled change onto $TARGET_DIR..."
|
|
322
243
|
git remote remove "$REMOTE_NAME" 2>/dev/null || true
|
|
323
|
-
git remote add "$REMOTE_NAME" "file://$PWD/$
|
|
244
|
+
git remote add "$REMOTE_NAME" "file://$PWD/$BUILD_DIR"
|
|
324
245
|
git fetch "$REMOTE_NAME" "$SQUASHED_COMMIT"
|
|
325
246
|
|
|
326
|
-
# Cherry-pick the squashed commit
|
|
327
|
-
echo "Cherry-picking the squashed commit into the current branch..."
|
|
328
247
|
if git cherry-pick "$SQUASHED_COMMIT" --no-commit; then
|
|
329
248
|
echo "Cherry-pick completed successfully."
|
|
330
249
|
else
|
|
331
|
-
echo "Cherry-pick encountered conflicts. Please resolve them
|
|
332
|
-
echo " git cherry-pick --continue"
|
|
250
|
+
echo "Cherry-pick encountered conflicts. Please resolve them, then run:"
|
|
251
|
+
echo " git cherry-pick --continue (or stage the resolved files)"
|
|
252
|
+
echo "$NEW_COMMIT_REF" > "$COMMIT_FILE"
|
|
333
253
|
exit 1
|
|
334
254
|
fi
|
|
335
|
-
|
|
336
|
-
# Write the new commit hash to admin/lib/COMMIT
|
|
337
|
-
echo "Writing new commit reference to $COMMIT_FILE"
|
|
338
255
|
echo "$NEW_COMMIT_REF" > "$COMMIT_FILE"
|
|
339
|
-
|
|
340
256
|
echo "Process completed successfully. Review the changes and commit them."
|
|
341
257
|
fi
|
|
342
258
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Command, CommandConfiguration, Input } from '@contember/cli-common'
|
|
2
2
|
import { join } from 'node:path'
|
|
3
3
|
import chalk from 'chalk'
|
|
4
|
-
import { TemplateInstaller } from '../lib/TemplateInstaller'
|
|
5
|
-
import { getPackageVersion } from '../lib/version'
|
|
6
|
-
import { detectPackageManager } from '../lib/packageManagerDetector'
|
|
4
|
+
import { TemplateInstaller } from '../lib/TemplateInstaller.js'
|
|
5
|
+
import { getPackageVersion } from '../lib/version.js'
|
|
6
|
+
import { detectPackageManager } from '../lib/packageManagerDetector.js'
|
|
7
7
|
|
|
8
8
|
type Args = {
|
|
9
9
|
projectName: string
|
package/src/commands/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './WorkspaceCreateCommand'
|
|
1
|
+
export * from './WorkspaceCreateCommand.js'
|
package/src/lib/FileSystem.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as fs from 'node:fs/promises'
|
|
2
2
|
import { access } from 'node:fs/promises'
|
|
3
|
-
import { copy } from 'fs-extra'
|
|
4
3
|
import { tmpdir } from 'node:os'
|
|
5
4
|
|
|
6
5
|
export class FileSystem {
|
|
@@ -8,7 +7,8 @@ export class FileSystem {
|
|
|
8
7
|
writeFile = fs.writeFile
|
|
9
8
|
rename = fs.rename
|
|
10
9
|
readDir = fs.readdir
|
|
11
|
-
copy =
|
|
10
|
+
copy = (source: string, destination: string, options?: { filter?: (source: string, destination: string) => boolean }) =>
|
|
11
|
+
fs.cp(source, destination, { recursive: true, ...options })
|
|
12
12
|
unlink = fs.unlink
|
|
13
13
|
remove = fs.rm
|
|
14
14
|
pathExists = async (path: string) => {
|
package/src/lib/version.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path'
|
|
2
2
|
import fs from 'node:fs/promises'
|
|
3
|
-
import { packageRoot } from '../paths'
|
|
3
|
+
import { packageRoot } from '../paths.js'
|
|
4
4
|
|
|
5
5
|
export const getPackageVersion = async () => {
|
|
6
6
|
return JSON.parse(await fs.readFile(join(packageRoot, 'package.json'), 'utf-8')).version
|
package/src/run.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Application, CommandManager } from '@contember/cli-common'
|
|
3
|
-
import { WorkspaceCreateCommand } from './commands'
|
|
4
|
-
import { TemplateInstaller } from './lib/TemplateInstaller'
|
|
5
|
-
import { resourcesDir } from './paths'
|
|
6
|
-
import { FileSystem } from './lib/FileSystem'
|
|
3
|
+
import { WorkspaceCreateCommand } from './commands/index.js'
|
|
4
|
+
import { TemplateInstaller } from './lib/TemplateInstaller.js'
|
|
5
|
+
import { resourcesDir } from './paths.js'
|
|
6
|
+
import { FileSystem } from './lib/FileSystem.js'
|
|
7
7
|
;(async () => {
|
|
8
8
|
const commandManager = new CommandManager({
|
|
9
9
|
['workspace']: () =>
|