Skip to content
Merged

Dev #967

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
1ad1de6
refactor: enhance locale extraction and taxonomy handling by ensuring…
AishDani Feb 17, 2026
e9539ec
Merge branch 'feature/wordpress' of https://github.com/contentstack/m…
AishDani Feb 17, 2026
0e05dd1
refactor: improve safety checks in taxonomy extraction by simplifying…
AishDani Feb 17, 2026
4f32ebc
Merge pull request #959 from contentstack/feature/wordpress
sayalijoshi27 Feb 17, 2026
55b67ac
refactor: migrate from CRA to Vite by updating environment variables …
shobhitupadhyayy Feb 17, 2026
39698f5
chore: update docker-compose and Dockerfile for improved build proces…
shobhitupadhyayy Feb 17, 2026
ff7494e
Merge pull request #960 from contentstack/chore/cra-to-vite-migration
umeshmore45 Feb 17, 2026
051ecd8
fix: update button loading state and default text in AddStack compone…
shobhitupadhyayy Feb 17, 2026
285943c
Merge pull request #961 from contentstack/chore/cra-to-vite-migration
umeshmore45 Feb 17, 2026
fc391f1
fix: update default CMS type handling in Migration component to ensur…
AishDani Feb 18, 2026
78d3875
Merge pull request #963 from contentstack/feature/wordpress
umeshmore45 Feb 18, 2026
12e234a
fix: resolve modular block merge failures during CT mapping
shobhitupadhyayy Feb 19, 2026
7488b13
Merge pull request #964 from contentstack/aem/fix
sayalijoshi27 Feb 19, 2026
c687f32
feat: Hide mandatory toggle for Taxonomy field types in advanced prop…
sauravraw Feb 20, 2026
99372cc
Merge pull request #966 from contentstack/bugfix/cmg-811
sauravraw Feb 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 8 additions & 28 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 16 additions & 20 deletions api/src/services/contentMapper.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,19 +442,21 @@ const getExistingContentTypes = async (req: Request) => {
let selectedContentType = null;

if (contentTypeUID) {
const [res] = await safePromise(
const [err, res] = await safePromise(
https({
method: 'GET',
url: `${baseUrl}/${contentTypeUID}`,
headers,
}),
);

selectedContentType = {
title: res?.data?.content_type?.title,
uid: res?.data?.content_type?.uid,
schema: res?.data?.content_type?.schema,
};
if (!err) {
selectedContentType = {
title: res?.data?.content_type?.title,
uid: res?.data?.content_type?.uid,
schema: res?.data?.content_type?.schema,
};
}
}
return {
contentTypes: processedContentTypes,
Expand Down Expand Up @@ -549,27 +551,21 @@ const getExistingGlobalFields = async (req: Request) => {
let selectedGlobalField = null;

if (globalFieldUID) {
const [res] = await safePromise(
const [err, res] = await safePromise(
https({
method: 'GET',
url: `${baseUrl}/${globalFieldUID}`,
headers,
}),
);

// if (err) {
// throw new Error(
// `Error fetching selected global field: ${
// err.response?.data || err.message
// }`
// );
// }

selectedGlobalField = {
title: res?.data?.global_field?.title,
uid: res?.data?.global_field?.uid,
schema: res?.data?.global_field?.schema,
};
if (!err) {
selectedGlobalField = {
title: res?.data?.global_field?.title,
uid: res?.data?.global_field?.uid,
schema: res?.data?.global_field?.schema,
};
}
}

return { globalFields: processedGlobalFields, selectedGlobalField };
Expand Down
56 changes: 31 additions & 25 deletions api/src/utils/content-type-creator.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,29 +160,24 @@ function buildFieldSchema(item: any, marketPlacePath: string, parentUid = ''): a
}
}

if (blockSchema.length > 0) {
blocks.push({
title: blockRawUid, // Keep original for title
uid: blockUid, // Snake case for uid
schema: removeDuplicateFields(blockSchema)
});
}
blocks.push({
title: blockRawUid, // Keep original for title
uid: blockUid, // Snake case for uid
schema: removeDuplicateFields(blockSchema)
Comment on lines +163 to +166
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty blocks are now always pushed to the blocks array, even when blockSchema is empty. This could result in modular blocks with empty schemas being created. The previous logic filtered out blocks with no fields. Consider whether empty blocks should be allowed or if the length check should be restored.

Suggested change
blocks.push({
title: blockRawUid, // Keep original for title
uid: blockUid, // Snake case for uid
schema: removeDuplicateFields(blockSchema)
const cleanedBlockSchema = removeDuplicateFields(blockSchema);
if (!cleanedBlockSchema || cleanedBlockSchema.length === 0) {
continue;
}
blocks.push({
title: blockRawUid, // Keep original for title
uid: blockUid, // Snake case for uid
schema: cleanedBlockSchema

Copilot uses AI. Check for mistakes.
});
}

if (blocks.length > 0) {
return {
data_type: "blocks",
display_name: item?.display_name || rawUid, // Keep original for display
field_metadata: {},
uid: itemUid, // Snake case uid
multiple: true,
mandatory: false,
unique: false,
non_localizable: false,
blocks: removeDuplicateFields(blocks)
};
}
return null;
return {
data_type: "blocks",
display_name: item?.display_name || rawUid, // Keep original for display
field_metadata: {},
uid: itemUid, // Snake case uid
multiple: true,
mandatory: false,
unique: false,
non_localizable: false,
blocks: removeDuplicateFields(blocks)
};
Comment on lines +170 to +180
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The early return with null has been removed. Previously, if blocks array was empty after processing, the function returned null. Now it always returns a modular_blocks field structure, even with an empty blocks array. This could create modular block fields with no blocks, which may not be valid in Contentstack. Consider whether this change is intentional or if the null check should be restored.

Copilot uses AI. Check for mistakes.
}

if (fieldType === 'group') {
Expand Down Expand Up @@ -316,14 +311,25 @@ export function buildSchemaTree(fields: any[], parentUid = '', parentType = '',

if (hasChildren) {
if (fieldType === 'modular_blocks') {
// Get modular block children
// Get modular block children (check both current and backup UIDs)
const mbChildren = fields.filter(f => {
if (!f) return false;
const fUid = f?.contentstackFieldUid || '';
if (!fUid || !fieldUid) return false;
return f?.contentstackFieldType === 'modular_blocks_child' &&
fUid.startsWith(fieldUid + '.') &&
!fUid.substring(fieldUid.length + 1).includes('.');
if (f?.contentstackFieldType !== 'modular_blocks_child') return false;

if (fUid.startsWith(fieldUid + '.') &&
!fUid.substring(fieldUid.length + 1).includes('.')) {
return true;
}

if (oldFieldUid && oldFieldUid !== fieldUid &&
fUid.startsWith(oldFieldUid + '.') &&
!fUid.substring(oldFieldUid.length + 1).includes('.')) {
return true;
}

return false;
});

result.schema = mbChildren.map(child => {
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ services:
restart: unless-stopped
environment:
- NODE_ENV=${NODE_ENV:-production}
- REACT_APP_API_URL=${REACT_APP_API_URL:-http://localhost:5001}
- REACT_APP_UPLOAD_API_URL=${REACT_APP_UPLOAD_API_URL:-http://localhost:4002}
- VITE_BASE_API_URL=${VITE_BASE_API_URL:-http://localhost:5001/}
- VITE_UPLOAD_SERVER=${VITE_UPLOAD_SERVER:-http://localhost:4002/}
networks:
- migration-network
security_opt:
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fs = require('fs');
const path = require('path');

const apiEnvContent = `APP_TOKEN_KEY=MIGRATION_V2\nPORT=5001\n`;
const uiEnvContent = `REACT_APP_WEBSITE_BASE_URL="http://localhost:3000/"\nREACT_APP_BASE_API_URL="http://localhost:5001/"\nREACT_APP_API_VERSION=v2\nREACT_APP_HOST="http://localhost:3000"\nREACT_APP_UPLOAD_SERVER="http://localhost:4002/"\nREACT_APP_OFFLINE_CMS=true\n`;
const uiEnvContent = `VITE_WEBSITE_BASE_URL="http://localhost:3000/"\nVITE_BASE_API_URL="http://localhost:5001/"\nVITE_API_VERSION=v2\nVITE_HOST="http://localhost:3000"\nVITE_UPLOAD_SERVER="http://localhost:4002/"\nVITE_OFFLINE_CMS=true\n`;
const uploadAPIEnvContent = `PORT=4002\nNODE_BACKEND_API=http://localhost:5001\n`;

const envFilePaths = {
Expand Down
12 changes: 6 additions & 6 deletions ui/.env.local
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
REACT_APP_WEBSITE_BASE_URL="http://localhost:3000/"
REACT_APP_BASE_API_URL="http://localhost:5001/"
REACT_APP_API_VERSION=v2
REACT_APP_HOST="http://localhost:3000"
REACT_APP_UPLOAD_SERVER="http://localhost:4002/"
REACT_APP_OFFLINE_CMS=true
VITE_WEBSITE_BASE_URL="http://localhost:3000/"
VITE_BASE_API_URL="http://localhost:5001/"
VITE_API_VERSION=v2
VITE_HOST="http://localhost:3000"
VITE_UPLOAD_SERVER="http://localhost:4002/"
VITE_OFFLINE_CMS=true
4 changes: 1 addition & 3 deletions ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,4 @@ yarn-error.log*


# .npmrc
.npmrc

!.env.local
.npmrc
3 changes: 2 additions & 1 deletion ui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ USER nodeapp

EXPOSE 3000

CMD [ "npm", "run", "start" ]
# Build at container startup so VITE_* env vars from docker-compose
CMD [ "sh", "-c", "npm run build && npx vite preview --port 3000 --host" ]
Comment on lines +23 to +24
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Building at container startup is problematic for production deployments. This approach means: 1) Every container restart rebuilds the entire application, increasing startup time significantly, 2) Build tools and source code remain in the production image, increasing image size and attack surface, 3) Build failures at runtime are harder to detect than at image build time. Consider building during the Docker image creation (before CMD) and using a multi-stage build to separate build dependencies from the runtime image.

Copilot uses AI. Check for mistakes.
8 changes: 4 additions & 4 deletions ui/public/index.html → ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
name="description"
content="Contentstack Migrations tool for easily migrate content between stacks or from other CMS platforms to Contentstack."
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="apple-touch-icon" href="/logo192.png" />

<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="manifest" href="/manifest.json" />

<title>Contentstack Migration Tool</title>

Expand All @@ -24,9 +24,8 @@
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
rel="preload"
as="style"
href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100..900&display=swap"
Expand Down Expand Up @@ -71,5 +70,6 @@
<a href="#root" class="skip-to-main-content-link">Skip to main content</a>

<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
Loading