Skip to content

fix: extract-template command#1279

Merged
semoal merged 1 commit into
lingui:mainfrom
timofei-iatsenko:main
Sep 12, 2022
Merged

fix: extract-template command#1279
semoal merged 1 commit into
lingui:mainfrom
timofei-iatsenko:main

Conversation

@timofei-iatsenko
Copy link
Copy Markdown
Collaborator

Issue:

If you don't have a *.pot file on the disk the command will fail with:

catalogStats[catalog.templateFile] = Object.keys(catalog.readTemplate()).length;
TypeError: Cannot convert undefined or null to object

If you create a file manually (just empty file), the command will complete successfully but catalog statistics will show outdated info.

Catalog statistics for /translates/messages.pot: 0 messages

Both problems caused by catalog.makeTemplate which is async function, but code don't await for its execution.

This PR tackle this issue, and adds await for these async calls.

@vercel
Copy link
Copy Markdown

vercel Bot commented Aug 25, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
js-lingui ✅ Ready (Inspect) Visit Preview Aug 25, 2022 at 1:22PM (UTC)

@timofei-iatsenko timofei-iatsenko changed the title extract-template command fix: extract-template command Aug 25, 2022
@timofei-iatsenko
Copy link
Copy Markdown
Collaborator Author

I also quite surprised that there are no even primitive smoke tests covering cli commands.

@semoal semoal merged commit a69ed8f into lingui:main Sep 12, 2022
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