eui icon indicating copy to clipboard operation
eui copied to clipboard

Fix i18ntokens generation

Open tkajtoch opened this issue 7 months ago β€’ 2 comments

Summary

This fixes the generation of i18ntokens.json and i18ntokens_changelog.json files used to determine whether there have been any changes to i18n token names or default messages since the last release.

This PR also includes a few cleanup items to make EUI build scripts easier to understand.

i18ntokens files need to be created on build, but committed only during release to enable testing in Kibana.

QA

  1. Checkout this branch locally
  2. Run yarn workspace @elastic/eui run build to build EUI and confirm there are changes to packages/eui/i18ntokens.json and packages/eui/i18ntokens_changelog.json files
  3. Run yarn workspace @elastic/eui run prerelease to run the prerelease script executed during the release process by release CLI and confirm the changes in packages/eui/i18ntokens.json and packages/eui/i18ntokens_changelog.json are committed as chore(eui): update i18ntokens
  4. Drop the created commit

tkajtoch avatar May 08 '25 15:05 tkajtoch

I spent quite some time fixing the bug pointed out above by @acstll. I'm back from PTO and will push the changes I had in progress shortly.

tkajtoch avatar Jun 24 '25 13:06 tkajtoch

@acstll I ended up having to refactor the whole i18ntokens logic and spent lots of time understanding what's even happening there. The code is very similar to the original one but simplified in places where that was straightforward to do. The bug you reported is finally fixed!

FYI the i18ntokens.json changes heavily because the new logic, specifically the globIterator traverses files in a different order. The keys are the same but sorted a different way.

tkajtoch avatar Jul 01 '25 10:07 tkajtoch

:green_heart: Build Succeeded

History

  • :broken_heart: Build #656 failed 7e0e468cef8e1aa6313876a20a9706b655c016e5
  • :broken_heart: Build #653 failed 72fa6245e9b4a5dfc18fab303ac8d26b0e3d1ead
  • :green_heart: Build #294 succeeded 0c205b595bf5ee34f621d372de4b774a00684492

cc @tkajtoch

elasticmachine avatar Jul 08 '25 13:07 elasticmachine

@acstll I had to fix one more thing with the usage of glob.sync - it turned out to not copy the files as it was supposed to. Could you take one more look at the latest commit before we merge it?

tkajtoch avatar Jul 08 '25 13:07 tkajtoch

[nit/suggestion] have you considered adding // @ts-check to the top of the new .mjs files?

I haven't πŸ€” I'm happy to explore it if you don't mind adding it separately. I'd like to read more about it first

tkajtoch avatar Jul 08 '25 13:07 tkajtoch

:green_heart: Build Succeeded

History

  • :green_heart: Build #4289 succeeded 7e0e468cef8e1aa6313876a20a9706b655c016e5
  • :green_heart: Build #4023 succeeded 0c205b595bf5ee34f621d372de4b774a00684492

cc @tkajtoch

elasticmachine avatar Jul 08 '25 13:07 elasticmachine

@acstll I had to fix one more thing with the usage of glob.sync - it turned out to not copy the files as it was supposed to. Could you take one more look at the latest commit before we merge it?

I built main, the previous glob.sync change, and latest and in fact there was something wrong previously, lots of files were missing… (how did you notice? πŸ˜…)

🟒 I can confirm the latest commit generates the right amount of files (is in main).

Screenshot 2025-07-08 at 17 19 33


[nit/suggestion] have you considered adding // @ts-check to the top of the new .mjs files?

I haven't πŸ€” I'm happy to explore it if you don't mind adding it separately. I'd like to read more about it first

definitely, not at all πŸ‘

acstll avatar Jul 08 '25 15:07 acstll

how did you notice? πŸ˜…

I noticed an error while trying to run the website dev server about a missing JSON file :D

tkajtoch avatar Jul 08 '25 20:07 tkajtoch