refactor: enhance locale extraction process with async handling and i…#1013
Merged
umeshmore45 merged 8 commits intodevfrom Mar 31, 2026
Merged
refactor: enhance locale extraction process with async handling and i…#1013umeshmore45 merged 8 commits intodevfrom
umeshmore45 merged 8 commits intodevfrom
Conversation
…mproved error logging - Replaced synchronous file reading with asynchronous methods for better performance. - Introduced concurrency control to optimize the processing of multiple files. - Added regex matching for language extraction and improved directory skipping logic. - Enhanced logging for progress tracking and error handling during file operations.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors extractLocales in the Sitecore migration library to use asynchronous filesystem APIs, add bounded concurrency for file processing, and improve logging while extracting locale values from data.json exports.
Changes:
- Replaced sync directory/file IO with async (
fs.promises) and introduced a 3-phase pipeline (collect paths → extract → process concurrently). - Added a fast-path regex-based locale extraction by reading only the first 128 KiB of each
data.json, with a JSON-parse fallback. - Expanded directory skipping and added progress/error logging.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Updated regex patterns to improve the efficiency of language extraction from metadata blocks. - Introduced a fast-path strategy to locate the language key within a limited slice of the JSON structure, enhancing performance. - Maintained fallback to full JSON parsing for compatibility with various file formats.
…es.js - Added checks for null or invalid directory and file path inputs to prevent runtime errors. - Enhanced logging for invalid inputs to aid in debugging. - Ensured that the locale extraction process gracefully handles empty or non-array paths.
…es.js - Improved error logging to provide more informative messages when reading directories and files. - Added optional chaining to safely access properties of directory entries. - Introduced a limit variable for concurrency control to ensure robust processing of file paths.
vikrantraut
previously approved these changes
Mar 27, 2026
vikrantraut
reviewed
Mar 27, 2026
…ocales.js - Updated input validation to use optional chaining for safer property access. - Improved handling of potential null or empty directory and file path scenarios. - Ensured robust processing by checking the length of paths with optional chaining.
…ocales.js - Updated input validation to use optional chaining for safer property access. - Improved handling of potential null or empty directory and file path scenarios. - Ensured robust processing by checking the length of paths with optional chaining.
vikrantraut
approved these changes
Mar 27, 2026
vikrantraut
approved these changes
Mar 31, 2026
vikrantraut
approved these changes
Mar 31, 2026
vikrantraut-cstk
approved these changes
Mar 31, 2026
dipakchordiya
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…mproved error logging