Skip to content

Dev#958

Merged
sayalijoshi27 merged 54 commits intopre-stagefrom
dev
Feb 16, 2026
Merged

Dev#958
sayalijoshi27 merged 54 commits intopre-stagefrom
dev

Conversation

@umeshmore45
Copy link
Contributor

No description provided.

AishDani and others added 30 commits January 12, 2026 13:08
… type extraction and schema generation features
…my; update build script in package.json for improved compatibility
…rvice and migration libraries found by copilot
…o and @aws-sdk/client-s3, to latest versions for improved functionality
… packages, including @contentstack/cli-utilities, @aws-sdk/client-s3, and cheerio, to latest versions for improved functionality and compatibility
…ock.json and package.json to latest versions for improved functionality and compatibility
…n package.json; refactor setupWordPressBlocks function for cleaner code
…ing file details during validation failures. Merge config data with Redux state to maintain user input integrity. Update Migration page logic to ensure non-empty values are prioritized, improving overall data consistency.
…e modules. Upgrade axios to version 1.13.5 and jsonpath to version 1.2.0. Clean up package.json and package-lock.json files by removing deprecated and unnecessary entries to enhance project maintainability.
…grade @contentstack/cli-utilities to version 1.17.1, axios to version 1.13.5, and qs to version 6.14.2. Add new dependencies and ensure all packages are up-to-date for improved functionality and security.
…ponent logic to prioritize non-empty config values over existing Redux state during file uploads. This enhances data integrity and consistency in the migration process.
sauravraw and others added 18 commits February 13, 2026 18:55
…ing 'qs' to version 6.14.2 and 'tmp' to version 0.2.5. Remove deprecated 'os-tmpdir' dependency and clean up package-lock.json files to streamline project structure and enhance maintainability.
…lob' dependency and add several new development dependencies, including 'brace-expansion', 'glob', 'minimatch', 'inflight', and 'path-is-absolute', enhancing project functionality and maintainability.
…endency management while retaining 'diff' version specification for compatibility.
…ency from overrides and add 'webpack-dev-server' to enhance development capabilities. Additionally, new dependencies for @jsonjoy.com modules are introduced in package-lock.json to improve functionality and maintainability.
…to streamline project dependencies. Refactor contentful.service.ts to eliminate reliance on 'jsonpath' by implementing direct item-level processing for arrays, enhancing code clarity and maintainability.
…ersion 6.14.2 across multiple modules, enhancing functionality. Clean up package structure by ensuring consistency in dependency management.
…o upgrade ESLint and related plugins to the latest versions, enhancing code quality and linting capabilities. Clean up outdated dependencies for improved maintainability.
…s for various dependencies, ensuring better security and consistency in package management.
…ed plugins to version 8.51.0, 7.33.2, and 4.6.0 respectively, improving code quality and linting capabilities. Remove outdated ESLint dependencies to enhance maintainability.
Enhance LoadSelectCms and LoadUploadFile components to preserve exist…
…pendencies for WordPress integration, including @wordpress/block-library and @wordpress/blocks. Remove migration-wordpress package and clean up unused dependencies to enhance maintainability. Adjust build script in migration-wordpress package.json for improved efficiency.
…d-out code and improving variable naming for clarity
…moving commented-out code and improving variable naming for clarity
@umeshmore45 umeshmore45 requested a review from a team as a code owner February 16, 2026 12:49
@umeshmore45 umeshmore45 requested review from Copilot and removed request for a team February 16, 2026 12:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors parts of the WordPress migration flow across upload-api and api, adds new WordPress schema/content-type extraction utilities, and updates the UI mapping experience and dependency/build setup.

Changes:

  • Update upload validation/processing and mapper generation for WordPress (including XML handling and passing runtime config into the WordPress mapper generator).
  • Introduce a new TypeScript-based migration-wordpress implementation (schema mapping, extraction utilities, block parsing setup) and adjust build/dependency setup across migration packages.
  • Update UI state-merging for file_details, modular blocks handling in Content Mapper, and UID display styling.

Reviewed changes

Copilot reviewed 43 out of 54 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
upload-api/src/services/fileProcessing.ts Removes Cheerio-based XML rewriting; parses XML from buffer string directly.
upload-api/src/services/createMapper.ts Passes config into WordPress mapper generation; adds broader migration-data cleanup.
upload-api/src/generate-schema.d.ts Adds local TS module typings for generate-schema.
upload-api/src/controllers/wordpress/index.ts Switches to TS imports from migration-wordpress; deletes migration data on mapper save.
upload-api/package.json Changes build to build all migration-* packages before tsc; updates deps/devDeps.
upload-api/migration-wordpress/utils/parseUtil.ts Adds JSDOM-based global setup and Gutenberg block parsing bootstrap.
upload-api/migration-wordpress/utils/index.ts Switches restrictedUid export to ESM default export.
upload-api/migration-wordpress/utils/helper.ts Replaces legacy JS helper with TS helper utilities (XML parse, file IO, mkdir).
upload-api/migration-wordpress/utils/helper.js Deletes legacy JS helper implementation.
upload-api/migration-wordpress/tsconfig.json Adds TS config for the migration-wordpress sub-package.
upload-api/migration-wordpress/package.json Updates entrypoints and adds build/clean/start scripts.
upload-api/migration-wordpress/libs/schemaMapper.ts Adds WordPress block → Contentstack field schema mapping.
upload-api/migration-wordpress/libs/extractTerms.ts Generates Terms content-type mapping JSON.
upload-api/migration-wordpress/libs/extractTaxonomy.ts Extracts taxonomy UID list for categories/parents.
upload-api/migration-wordpress/libs/extractLocale.ts TS rewrite of locale extraction from exported JSON.
upload-api/migration-wordpress/libs/extractLocale.js Deletes legacy JS locale extraction.
upload-api/migration-wordpress/libs/extractItems.ts Generates modular-block-heavy CT schemas from parsed Gutenberg blocks.
upload-api/migration-wordpress/libs/extractCategories.ts Generates Categories content-type mapping JSON.
upload-api/migration-wordpress/libs/extractAuthor.ts Generates Author content-type mapping JSON.
upload-api/migration-wordpress/libs/contenttypemapper.js Deletes legacy JS content type mapper.
upload-api/migration-wordpress/libs/content_types.js Deletes legacy JS WordPress content-types schema generator.
upload-api/migration-wordpress/libs/contentTypes.ts New TS extractContentTypes orchestration and file output.
upload-api/migration-wordpress/interface/interface.ts Adds TS interfaces for fields, blocks, config types.
upload-api/migration-wordpress/index.ts New TS package entry exporting extraction utilities.
upload-api/migration-wordpress/index.js Deletes legacy CJS entrypoint.
upload-api/migration-wordpress/generate-schema.d.ts Adds package-local typings for generate-schema.
upload-api/migration-wordpress/constants/index.json Adds block-name → type mapping constants.
upload-api/migration-wordpress/config/index.json Adds WordPress content key mapping config.
upload-api/migration-sitecore/package.json Removed.
upload-api/migration-contentful/package.json Removed.
upload-api/migration-aem/package.json Adds @types/uuid to devDependencies.
upload-api/migration-aem/package-lock.json Lockfile updates for the above dependency changes.
ui/src/pages/Migration/index.tsx Improves merge logic so config/Redux file_details don’t clobber each other.
ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx Preserves existing file_details on validation failure; improves success/failure branching.
ui/src/components/LegacyCms/Actions/LoadSelectCms.tsx Merges config into existing Redux file_details without overwriting non-empty values.
ui/src/components/ContentMapper/index.tsx Treats modular blocks as blocks; improves UID row rendering; adds blocks/modular child matching logic.
ui/src/components/ContentMapper/index.scss Adds UID flex row styling and truncation behavior.
ui/package.json Dependency cleanup and override updates.
package.json Updates root dependencies/overrides and removes unused devDependencies.
package-lock.json Regenerated lockfile to reflect dependency changes.
api/src/utils/wordpressParseUtil.ts Adds WordPress block parsing + HTML attribute extraction utilities for API usage.
api/src/utils/mimeTypes.ts Adds extension→MIME map helper.
api/src/utils/content-type-creator.utils.ts Adjusts modular blocks UID/title derivation when building CT schema.
api/src/services/migration.service.ts Replaces many WordPress steps with consolidated createTaxonomy / createEntry calls.
api/src/services/contentful.service.ts Removes jsonpath usage; replaces array reference replacement with direct sys-link processing.
api/src/constants/index.ts Changes migration author directory name constant to singular.
api/package.json Adds WordPress parser deps (@wordpress/block-serialization-default-parser, cheerio), removes unused deps, adds overrides.
Files not reviewed (5)
  • ui/package-lock.json: Language not supported
  • upload-api/migration-aem/package-lock.json: Language not supported
  • upload-api/migration-contentful/package-lock.json: Language not supported
  • upload-api/migration-sitecore/package-lock.json: Language not supported
  • upload-api/migration-wordpress/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +32 to +38
const readFile = function (filePath: any, parse: any) {
parse = typeof parse == 'undefined' ? true : parse;
filePath = path.resolve(filePath);
var data;
if (fs.existsSync(filePath)) data = parse ? JSON.parse(fs.readFileSync(filePath, 'utf-8')) : data;
return data;
};
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

readFile returns undefined whenever parse is false because it never reads the file contents in that branch (: data uses the uninitialized variable). Read the file as a string when parse === false (and only JSON.parse when parse === true).

Copilot uses AI. Check for mistakes.
Comment on lines 8 to 12
"scripts": {
"build": "npm run clean && tsc",
"clean": "rimraf build",
"start": "ts-node index.ts",
"test": "echo \"Error: no test specified\" && exit 1"
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

This package defines build/clean/start scripts that require rimraf, tsc, and ts-node, but it no longer declares any dependencies/devDependencies. npm --prefix migration-wordpress run build (used by upload-api’s root build) will fail unless those tools are installed locally or the build script installs them (as other migration-* packages do).

Copilot uses AI. Check for mistakes.
Comment on lines 6 to 8
"scripts": {
"build": "npm --prefix migration-aem run build && tsc",
"build": "for d in migration-*; do npm --prefix $d run build; done && tsc",
"test": "echo \"Error: no test specified\" && exit 1",
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The build script uses a bash for d in ...; do ...; done loop, which will fail on Windows shells. If this repo is expected to build cross-platform, consider using an npm workspace/lerna/turbo setup or a Node-based script instead of shell-specific syntax.

Copilot uses AI. Check for mistakes.
Comment on lines 37 to 39
if (data?.data?.content_mapper?.length) {
deleteFolderSync(path.join(process.cwd(), MIGRATION_DATA_CONFIG.DATA));
logger.info('Validation success:', {
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

deleteFolderSync(path.join(process.cwd(), MIGRATION_DATA_CONFIG.DATA)) relies on the current working directory and can delete an unintended folder if the process is started from a different path. Consider resolving the deletion target relative to the upload-api root (similar to getUploadApiRoot() used in src/services/createMapper.ts) to make cleanup safe and deterministic.

Copilot uses AI. Check for mistakes.
AUTHORS_DIR_NAME: 'authors',
AUTHORS_FILE_NAME: 'en-us.json',
AUTHORS_MASTER_FILE: 'authors.json',
AUTHORS_DIR_NAME: "author",
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

AUTHORS_DIR_NAME was changed from authors to author, but other parts of the API (e.g., WordPress migration logic and mapperKeys lookups) still appear to use the plural key/name. This inconsistency will break folder paths and/or mapper key resolution unless all dependent code and generated content-type UIDs are updated to match.

Suggested change
AUTHORS_DIR_NAME: "author",
AUTHORS_DIR_NAME: "authors",

Copilot uses AI. Check for mistakes.
line-height: 1.2!important;
// max-width: 200px;
display: -webkit-box;
-webkit-line-clamp: 1;
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The comment says the UID text is limited to 2 lines, but -webkit-line-clamp is set to 1. Either update the comment or change the clamp value to match the intended behavior.

Suggested change
-webkit-line-clamp: 1;
-webkit-line-clamp: 2;

Copilot uses AI. Check for mistakes.
Comment on lines +11 to +14
if (typeof window === 'undefined') {
global.window = {} as any;
global.document = {} as any;
}
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

global.window / global.document assignments will fail under strict TypeScript because window/document are not declared on global. Use globalThis as any (or declare globals in a global.d.ts) consistently to avoid compile errors when building the migration-wordpress package.

Copilot uses AI. Check for mistakes.
Comment on lines +155 to +162
const existingBlock: Field | undefined = schemas.find((schemaItem: Field) =>
result?.otherCmsField === schemaItem?.otherCmsField &&
schemaItem?.contentstackFieldType === result?.contentstackFieldType &&
schemaItem?.contentstackField === result?.contentstackField &&
result?.contentstackFieldUid?.includes(parentUid)
);
item?.contentstackFieldUid?.includes(parentUid) ;
if (existingBlock && typeof existingBlock === 'object' && 'advanced' in existingBlock) {
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

In the array branch, result?.contentstackFieldUid?.includes(parentUid) can be called with parentUid === null, and there is also a stray statement item?.contentstackFieldUid?.includes(parentUid); that has no effect. This can cause runtime/type issues and should be removed/guarded (e.g., only call includes when parentUid is a non-empty string).

Copilot uses AI. Check for mistakes.
@sayalijoshi27 sayalijoshi27 merged commit aaf5f4f into pre-stage Feb 16, 2026
12 of 13 checks passed
@sayalijoshi27 sayalijoshi27 deleted the dev branch February 16, 2026 13:22
@sayalijoshi27 sayalijoshi27 restored the dev branch February 16, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments