Skip to content

Add the assemble.mjs file to enable generating the final merged [locale].json files by using the ilib-assemble#491

Open
gouniLee wants to merge 8 commits intodevelopmentfrom
assembleJson2
Open

Add the assemble.mjs file to enable generating the final merged [locale].json files by using the ilib-assemble#491
gouniLee wants to merge 8 commits intodevelopmentfrom
assembleJson2

Conversation

@gouniLee
Copy link
Copy Markdown
Contributor

@gouniLee gouniLee commented Apr 7, 2026

Checklist

  • At least one test case is included for this feature or bug fix.
  • ReleaseNotes has added or is not needed.
  • This PR has passed all of the test cases on Nodejs and Chrome Browser.
  • This PR has passed all of the test cases on QT/QML.
  • This is an API breaking change.
  • Requires a major version change.

Description

  • Add the assemble.mjs file to enable generating the final merged [locale].json files by using the `ilib-assemble tool
    • Specify the features to use in the ilib-inc.js file, the assemble.mjs file scans it (including its dependencies)
    • Extracts the list of JSON data being used. It reads the locale JSON data corresponding to the locale list received as an option, merges them all,
    • Generates a [locale].json file. Since the timezone files have a slightly different directory structure, they are handled separately in a different .mjs file.

related PR

Usage:

  • ilib-assemble --mergeJson --ilibincPath ./js/assembleData/ilib-inc.js --localefile ./js/assembleData/locales.json --customLocalePath ./js/assembleData/customData assembled
  • The output files are generated under the assemble/ directory as [locale].json files, e.g., ko-KR.json.

@gouniLee gouniLee self-assigned this Apr 7, 2026
@gouniLee gouniLee requested a review from ehoogerbeets April 7, 2026 05:46
@gouniLee gouniLee changed the title Add the assembleJson.mjs file to enable generating the final merged [locale].json files by using the `ilib-assemble tool Add the assembleJson.mjs file to enable generating the final merged [locale].json files by using the ilib-assemble tool Apr 9, 2026
@gouniLee gouniLee changed the title Add the assembleJson.mjs file to enable generating the final merged [locale].json files by using the ilib-assemble tool Add the assembleJson.mjs file to enable generating the final merged [locale].json files by using the ilib-assemble Apr 9, 2026
@gouniLee gouniLee changed the title Add the assembleJson.mjs file to enable generating the final merged [locale].json files by using the ilib-assemble Add the assemble.mjs file to enable generating the final merged [locale].json files by using the ilib-assemble Apr 15, 2026
@@ -0,0 +1,50 @@
{
"ethiopic": {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this file in the PR?

@@ -0,0 +1,154 @@
import path from 'path';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Need standard file header

const file = queue.shift();
const fileContent = readFile(path.join(process.cwd(), "js/lib", file));
if (fileContent) {
fileCache.set(file, fileContent);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since the reDependentPattern is re-used, you need to reset the index to re-initialize it before using it with another string:

reDependentPattern.lastIndex = 0;

jsFiles.forEach(file => {
const fileContent = fileCache.get(file) || readFile(path.join(process.cwd(), "js/lib", file));
if (fileContent) {
for (const match of fileContent.matchAll(reDataPattern)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here

* @returns {object} Flat map of timezone ID to parsed timezone data
*/
function assembleZoneinfoData(zoneinfoPath, readFile) {
const zoneinfoData = {};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is missing zonetab.json and a few other things. Please take a look at https://github.com/iLib-js/ilib-webpack-plugin/blob/master/ilib-webpack-plugin.js#L196 for how this should be updated

@@ -0,0 +1,67 @@
import path from 'path';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Need standard ilib open-source header

}
result[locale]["ilib.data.zoneinfo"] = zoneinfoData;
});
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Need special handling for charsets, charmaps, and normalizations. Please see https://github.com/iLib-js/ilib-webpack-plugin/blob/master/ilib-webpack-plugin.js#L157

Comment thread build.properties
@@ -1,4 +1,4 @@
# Copyright (c) 2012-2024, JEDLSoft
# Copyright (c) 2012-2026, JEDLSoft
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Copyright (c) 2012-2026, JEDLSoft
# Copyright (c) 2012-2024, 2026, JEDLSoft

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.

2 participants