extract-react-intl-messages icon indicating copy to clipboard operation
extract-react-intl-messages copied to clipboard

feat: implement caching results feature

Open lightnet328 opened this issue 4 years ago • 2 comments

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:

  • Using https://github.com/royriojas/file-entry-cache (file-entry-cache を使いました)
    • This is being used also ESLint (ESLint などでも使用されています)

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:

  • [x] Documentation
  • [x] Tests
  • [x] Ready to be merged

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

lightnet328 avatar May 10 '20 12:05 lightnet328

@akameco Could you review this please?

Mikadv avatar Feb 28 '22 00:02 Mikadv

@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)

fastmx avatar May 19 '23 08:05 fastmx