8000 feat: implement caching results feature by lightnet328 · Pull Request #75 · akameco/extract-react-intl-messages · GitHub
[go: up one dir, main page]

Skip to content

Conversation

lightnet328
Copy link
Contributor
@lightnet328 lightnet328 commented May 10, 2020

What:

  • The caching extracted messages mechanism is added (抽出したメッセージをキャッシュする機構が追加されました)

Why:

  • To improve the execution speed (実行速度向上のため)
    • I think it would be helpful developers run extract-react-intl-messages every commits using such as husky (毎コミット時に extract-react-intl-messages を実行するのに役立つと思います)

How:

Execution times

No cache:

❯ for i in (seq 10); node ./dist/cli.js -l=en,ja -f=yaml -o example/i18n -d en 'example/**/*.{js,tsx}'; end
251.4197530001402
250.03716799989343
266.06751700118184
242.8640739992261
283.9868559986353
266.40737199783325
247.75863299891353
251.24494099989533
290.3648740015924
247.3809519968927

Generating cache at first time:

❯ node ./dist/cli.js -l=en,ja -f=yaml -o example/i18n -d en 'example/**/*.{js,tsx}' --cache
289.2617129981518

Using cache:

❯ for i in (seq 10); node ./dist/cli.js -l=en,ja -f=yaml -o example/i18n -d en 'example/**/*.{js,tsx}' --cache; end
30.542565997689962
30.521627999842167
29.862549997866154
29.630907997488976
29.91888900101185
29.894377999007702
29.31828700006008
32.4129530005157
31.972685001790524
29.03057499974966

Checklist:

  • Documentation
  • Tests
  • Ready to be merged

Thank you for developing this plugin! I like this CLI tool the best!

8000

@Mikadv
Copy link
Mikadv commented Feb 28, 2022

@akameco Could you review this please?

@fastmx
Copy link
fastmx commented May 19, 2023

@akameco it it's super desired function 🙏
In our case running extract-messages on precommit takes significant amount of time (60s due to amount of files)

@akameco akameco merged commit bcac5d1 into akameco:master Jul 28, 2025
@akameco
Copy link
Owner
akameco commented Jul 28, 2025

Thank you very much for the PR.
I sincerely apologize for the extremely delayed response.
After investigating, it appears that react-intl has also migrated to FormatJS and the official library now has similar functionality, so I'm thinking of deprecating this tool itself.
However, since there are still people using it, I plan to incorporate this feature and release it.

PRありがとうございます。
非常に遅くなって申し訳ございません。
調べたところreact-intlもFormatJSに移行し本家も同様の機能が付いたようなので、このツール自体非推奨にしようと思います。
ただ、まだ使っている人がいるので、この機能を取り込んでリリースしようと思います。

@Mikadv
Copy link
Mikadv commented Jul 28, 2025

That is very kind. Thank you very much @akameco.

I appreciate that you came back and do this for us!


After investigating, it appears that react-intl has also migrated to FormatJS and the official library now has similar functionality, so I'm thinking of deprecating this tool itself.

The thing is that that doesn't work for us. When we have messages inside defineMessages() it doesn't work with formatjs but it does with your lib.

@akameco
Copy link
Owner
akameco commented Jul 28, 2025

I see. That's how it is. In that case, I think I'll just do the release without marking it as deprecated.

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.

4 participants

0