-
Notifications
You must be signed in to change notification settings - Fork 16
Local support of locales serve for theme #395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: theme-sections-chunking
Are you sure you want to change the base?
Conversation
src/helper/locales.ts
Outdated
|
|
||
| Logger.debug('Response received from API:', response.status); | ||
|
|
||
| if (response.status === 200) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
early return with invalid case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
src/helper/locales.ts
Outdated
| Logger.debug('Remote data retrieved:', data); | ||
|
|
||
| // Ensure the locales folder exists | ||
| await fs.mkdir(localesFolder, { recursive: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check why recursive is used, check if it is required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
src/helper/locales.ts
Outdated
| try { | ||
| Logger.debug('Starting comparison between local and remote data'); | ||
|
|
||
| const localesFolder: string = path.resolve(process.cwd(), 'theme/locales'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done use slash here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
src/helper/locales.ts
Outdated
| return true; // Changes detected | ||
| } | ||
|
|
||
| if (JSON.stringify(localData) !== JSON.stringify(matchingItem.resource)) { // Compare the local and remote data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use lodash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
src/helper/locales.ts
Outdated
| localData = JSON.parse(await fs.readFile(path.join(localesFolder, file), 'utf-8')); | ||
| } catch (err) { | ||
| Logger.error(`Error reading file ${file}: ${(err as Error).message}`); | ||
| continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throw error and show file name that has incorrect data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
| } | ||
| }); | ||
|
|
||
| res.json({"items":localesArray}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use linter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
section chunking by removing from main bundle React
No description provided.