Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): make extract cmd asynchronous execution #1170

Merged
merged 1 commit into from
Nov 26, 2021

Conversation

SergeyPoluektov
Copy link
Contributor

Some custom extractors are required to have async execution. For instance, in order to extract messages from Svelte+Typescript you need to preprocess svelte files before compilation. Preprocessing is an async operation in Svelte (see doc). But lingui-cli extract command doesn't support async extract method from custom extractor – see catalog.make method in packages/cli/src/lingui-extract.ts and all function calls down to extract method of a particular extractor.

This PR adds support for async extractors by awaiting for extract is finished before calling traverse function in Catalog.collect method

@vercel
Copy link

vercel bot commented Nov 22, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/lingui-js/js-lingui/2Vj1zugYn8G1u2i6cXKVDsJewAjJ
✅ Preview: Failed

[Deployment for 1eb4d63 failed]

@semoal
Copy link
Contributor

semoal commented Nov 26, 2021

I would love to receive a pull request with a real example of Lingui + Svelte in our monorepo mate, I'm not experienced with Svelte and would love to get Lingui compatible with him.

@semoal semoal changed the title feat(cli): make extract cmd async feat(cli): make extract cmd asynchronous execution Nov 26, 2021
@semoal semoal merged commit f99d8b1 into lingui:main Nov 26, 2021
@SergeyPoluektov
Copy link
Contributor Author

I would love to receive a pull request with a real example of Lingui + Svelte in our monorepo mate, I'm not experienced with Svelte and would love to get Lingui compatible with him.

Yes, that would be great to have in there. I'll prepare an example with Svelte and a custom extractor.

@SergeyPoluektov SergeyPoluektov deleted the feat/async-extract branch November 26, 2021 14:34
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