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: configurable and extendable extractors with Lingui config #1065

Merged
merged 2 commits into from
May 18, 2021

Conversation

semoal
Copy link
Contributor

@semoal semoal commented May 18, 2021

Now with this pull request users can create his own extractors:

type ExtractorType = {
  match(filename: string): boolean
  extract(filename: string, targetDir: string, options?: any): void
}

Little breaking change

Before we had two extractors [babel, typescript], the typescript step it's useless since babel support typescript practically out of the box, since this compiling it's done twice first by babel and then by typescript was causing a lot of failures on Typescript projects with bad origin's and strange errors about NODE_ENV.

Related issues:
#1058
#1047

Now if your package it's pure Typescript and doesn't contain Babel, you could just use typescript extractor instead of using the babel one.

  extractors: [
    require.resolve("@lingui/cli/api/extractors/typescript")
  ],
  • Document this feature

@vercel
Copy link

vercel bot commented May 18, 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/C83s2x5c8LrpmgGv14dGbzZR5VUz
✅ Preview: https://js-lingui-git-feat-extractors-lingui-js.vercel.app

@semoal
Copy link
Contributor Author

semoal commented May 18, 2021

@nathanforce

@github-actions
Copy link

github-actions bot commented May 18, 2021

size-limit report 📦

Path Size
./packages/core/build/cjs/core.production.min.js 2.78 KB (0%)
./packages/detect-locale/build/cjs/detect-locale.production.min.js 798 B (0%)
./packages/react/build/cjs/react.production.min.js 4.85 KB (0%)

@codecov
Copy link

codecov bot commented May 18, 2021

Codecov Report

Merging #1065 (4a9b4c9) into main (78ad09f) will increase coverage by 0.14%.
The diff coverage is 80.00%.

❗ Current head 4a9b4c9 differs from pull request most recent head 9fcfb89. Consider uploading reports for the commit 9fcfb89 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1065      +/-   ##
==========================================
+ Coverage   83.06%   83.20%   +0.14%     
==========================================
  Files          53       53              
  Lines        1624     1620       -4     
  Branches      443      441       -2     
==========================================
- Hits         1349     1348       -1     
- Misses        158      159       +1     
+ Partials      117      113       -4     
Impacted Files Coverage Δ
packages/cli/src/api/catalog.ts 81.56% <ø> (ø)
packages/conf/src/index.ts 80.76% <ø> (ø)
packages/cli/src/api/extract.ts 88.46% <50.00%> (+4.59%) ⬆️
packages/cli/src/api/extractors/index.ts 69.23% <100.00%> (+10.89%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ff7a235...9fcfb89. Read the comment docs.

@semoal semoal changed the title feat: extractors are now configurable and extendable trough Lingui config feat: configurable and extendable extractors with Lingui config May 18, 2021
@semoal semoal merged commit 263ee59 into main May 18, 2021
@semoal semoal deleted the feat-extractors branch May 18, 2021 10:05
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.

None yet

1 participant