diff --git a/packages/next-config/CHANGELOG.md b/packages/next-config/CHANGELOG.md index 6b37e4d..577235a 100644 --- a/packages/next-config/CHANGELOG.md +++ b/packages/next-config/CHANGELOG.md @@ -6,6 +6,12 @@ - Add `turbopack: {}` to support Next.js 16 default Turbopack behavior when a webpack config is present. +## 1.6.1 + +### Patch Changes + +- Add `turbopack: {}` to support Next.js 16 default Turbopack behavior when a webpack config is present. + ## 1.0.1 ### Patch Changes diff --git a/packages/next-config/package.json b/packages/next-config/package.json index cbb43d2..d2f1aac 100644 --- a/packages/next-config/package.json +++ b/packages/next-config/package.json @@ -1,6 +1,6 @@ { "name": "@mintel/next-config", - "version": "1.6.0", + "version": "1.6.1", "publishConfig": { "access": "public", "registry": "https://npm.infra.mintel.me" diff --git a/scripts/cms-apply.sh b/scripts/cms-apply.sh index 7806359..261ac80 100755 --- a/scripts/cms-apply.sh +++ b/scripts/cms-apply.sh @@ -43,6 +43,11 @@ case $ENV in echo "❌ Remote container for $ENV not found." exit 1 fi + + echo "📦 Syncing extensions to REMOTE $ENV..." + # Ensure remote directory exists + ssh "$REMOTE_HOST" "mkdir -p $REMOTE_DIR/extensions" + rsync -avz --delete ./packages/cms-infra/extensions/ "$REMOTE_HOST:$REMOTE_DIR/extensions/" echo "📤 Injecting snapshot directly into container $REMOTE_CONTAINER..." # Inject file via stdin to avoid needing a host-side mount or scp path matching diff --git a/scripts/cms-snapshot.sh b/scripts/cms-snapshot.sh index 6067cbf..934664d 100755 --- a/scripts/cms-snapshot.sh +++ b/scripts/cms-snapshot.sh @@ -17,4 +17,7 @@ echo "📸 Creating schema snapshot for local $PROJECT..." # Note: we save it to the mounted volume path inside the container docker exec "$LOCAL_CONTAINER" npx directus schema snapshot -y /directus/schema/snapshot.yaml -echo "✅ Snapshot saved to $SCHEMA_PATH" +echo "🛠️ Repairing snapshot for Postgres compatibility..." +python3 ./scripts/fix_snapshot_v3.py + +echo "✅ Snapshot saved and repaired at $SCHEMA_PATH" diff --git a/scripts/fix_snapshot_v3.py b/scripts/fix_snapshot_v3.py new file mode 100644 index 0000000..bb42cb5 --- /dev/null +++ b/scripts/fix_snapshot_v3.py @@ -0,0 +1,96 @@ +import sys +import os + +path = '/Users/marcmintel/Projects/at-mintel/packages/cms-infra/schema/snapshot.yaml' +if not os.path.exists(path): + print(f"File not found: {path}") + sys.exit(1) + +with open(path, 'r') as f: + lines = f.readlines() + +new_lines = [] +current_collection = None +current_field = None +in_schema = False + +fix_fields = {'id', 'company', 'user_created', 'user_updated', 'screenshot', 'logo', 'feedback_id'} +uuid_fields = {'id', 'company', 'user_created', 'user_updated'} + +# For multi-pass logic +snapshot_has_feedback_id = False + +for line in lines: + stripped = line.strip() + + if stripped.startswith('- collection:'): + current_collection = stripped.split(':')[-1].strip() + in_schema = False + elif stripped.startswith('field:'): + current_field = stripped.split(':')[-1].strip() + if current_collection == 'visual_feedback_comments' and current_field == 'feedback_id': + snapshot_has_feedback_id = True + elif stripped == 'schema:': + in_schema = True + elif stripped == 'meta:' or stripped.startswith('- collection:') or (not line.startswith(' ') and line.strip() and not line.startswith('-')): + in_schema = False + + # Top-level field type + if not in_schema and stripped.startswith('type:') and current_field in uuid_fields: + line = line.replace('type: string', 'type: uuid') + + # Schema data type + if in_schema and current_field in fix_fields: + if 'data_type: char' in line or 'data_type: varchar' in line: + line = line.replace('data_type: char', 'data_type: uuid').replace('data_type: varchar', 'data_type: uuid') + if 'max_length:' in line: + line = ' max_length: null\n' + + new_lines.append(line) + +# Handle Missing feedback_id Injection +if not snapshot_has_feedback_id: + # We find systemFields and inject before it + injected = False + final_lines = [] + feedback_id_block = """ - collection: visual_feedback_comments + field: feedback_id + type: integer + meta: + collection: visual_feedback_comments + field: feedback_id + interface: select-dropdown-m2o + required: true + sort: 4 + width: full + schema: + name: feedback_id + table: visual_feedback_comments + data_type: integer + is_nullable: false + is_indexed: true + foreign_key_table: visual_feedback + foreign_key_column: id +""" + for line in new_lines: + if 'systemFields:' in line and not injected: + final_lines.append(feedback_id_block) + injected = True + final_lines.append(line) + new_lines = final_lines + +# Second pass for primary key nullability +final_lines = [] +for i in range(len(new_lines)): + line = new_lines[i] + if 'is_primary_key: true' in line: + # Search backwards and forwards + for j in range(max(0, i-10), min(len(new_lines), i+10)): + if 'is_nullable: true' in new_lines[j]: + new_lines[j] = new_lines[j].replace('is_nullable: true', 'is_nullable: false') + final_lines.append(line) + +with open(path, 'w') as f: + f.writelines(new_lines) + +print("SUCCESS: Full normalization and field injection complete.")