chore(i18n): fix lunaria pre-commit hook with force: true#2528
chore(i18n): fix lunaria pre-commit hook with force: true#2528ghostdevv merged 1 commit intonpmx-dev:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
📝 WalkthroughWalkthroughThe Lunaria initialization in Changes
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
MatteoGabriele
left a comment
There was a problem hiding this comment.
Thanks for this one. I've encountered it many times!
force: true for lunaria instance (#2527)|
just tweaked the title :p |
🔗 Linked issue
Fixes #2527.
🧭 Context
This resolves issue where lunaria cache becomes stale after rebasing or merging, which causes lunaria to crash and fail git pre-commit hook. Instead configure lunaria to bypass git caching and always read the latest commit from git history.
📚 Description
Configures
force: truewhen creating lunaria instance to bypass git commit cache.Here's what I found from investigating this issue.
Lunaria by default uses a cache, stored in
./node_modules/.cache/lunaria, to keep track of the latest commit hash per locale file, like this:This cache is reused between builds (or calls to lunaria instance in git pre-commit hook). Cache helps to skip looking into older commits when looking for the latest commit for each locale file. But this cache can become stale, for example after rebase operations.
For example, you made a change in locale file, committed, cache updated. Then imagine you rebased your branch, hashes change. This causes lunaria to fail to find that last commit in git database.
When this happens lunaria just aborts process completely instead of throwing, so we can't even capture this error to retry.
Discord thread: https://discord.com/channels/1464542801676206113/1493012869174923476