i18next-parser icon indicating copy to clipboard operation
i18next-parser copied to clipboard

Potential bug with glob handling

Open PeterKottas opened this issue 4 years ago • 4 comments

🐛 Bug Report

I want to use the following glob which appears correct: https://www.digitalocean.com/community/tools/glob?comments=true&glob=%2F%2A%2A%2F%21%28%2A.d%29.%7Bts%2Ctsx%7D&matches=false&tests=%2F%2F%20This%20will%20match%20as%20it%20ends%20with%20%27.js%27&tests=%2Fhello%2Fworld.ts&tests=%2Fhello%2Fworld.tsx&tests=%2F%2F%20This%20won%27t%20match%21&tests=%2Fhello%2Fworld.d.ts&tests=%2Ftest%2Fsome%2Fglobs

However when I try it with parser:

i18next './pathToFiles/**/!(*.d).{tsx,ts}'

It returns

error Command failed with exit code 255.

and no other meaningful output.

Expected behavior

It should either work or at least provide a meaningful error if I am doing something wrong.

  • runtime version: v12.14.1
  • i18next version: i.e. 3.11.0
  • os: Windows

PeterKottas avatar Jul 15 '21 10:07 PeterKottas

If I test your path in the tool you shared, it does not seem valid: Screen Shot 2021-07-15 at 7 54 54 AM

karellm avatar Jul 15 '21 11:07 karellm

You are putting the glob in the place where you should put the test strings. Find the updated version of the tester here: https://www.digitalocean.com/community/tools/glob?comments=true&glob=.%2FpathToFiles%2F%2A%2A%2F%21%28%2A.d%29.%7Bts%2Ctsx%7D&matches=false&tests=%2F%2F%20This%20will%20match%20as%20it%20ends%20with%20%27.js%27&tests=.%2FpathToFiles%2Fworld.ts&tests=.%2FpathToFiles%2Fworld.tsx&tests=%2F%2F%20This%20won%27t%20match%21&tests=%2FpathToFiles%2Fworld.d.ts&tests=%2FsomeDifferentPath%2Fsome%2Fglobs

Before I only tested the general idea, now it matches the one I use with the parser exactly.

PeterKottas avatar Jul 15 '21 14:07 PeterKottas

My bad! Do other glob work? Are you sure it is related to this?

karellm avatar Jul 15 '21 16:07 karellm

No worries, I've been using

i18next './pathToFiles/**/*.{tsx,ts}'

with no problems for a while. But we added a lot of d.ts files that should be filtered out to speed things up. That's when the issue appeared.

PeterKottas avatar Jul 15 '21 16:07 PeterKottas