resolve-tspaths icon indicating copy to clipboard operation
resolve-tspaths copied to clipboard

Paths with special characters are not properly handled

Open tee-yankov opened this issue 1 year ago • 3 comments

Hi there! Thank you for maintaining this library. My colleagues and I recently stumbled onto a bug that left us scratching our heads for a while, until we figured out the specific reason our build process was failing for only one person on the team.

We concluded that resolve-tspaths just doesn't handle paths with special characters well.

To reproduce this, have a path such as:

/home/user/Projects/MyProject (MP)/tsconfig.json

Then running resolve-tspaths --verbose in that directory. This will result in resolve-tspaths detecting no files to process, even though there are such files. We saw that filesToProcess from the --verbose output was just empty in this case. The fix for us was simply changing the path to something like:

/home/user/Projects/MyProject/tsconfig.json

Which works perfectly fine! Spaces didn't seem to be an issue in my tests.

Thanks again, and don't hesitate to reach out if you need further reproduction steps.

tee-yankov avatar Aug 09 '24 10:08 tee-yankov

Hi @tee-yankov, thanks for the issue!

Do you suspect that the spaces or the parentheses are causing the issue? And are you suggesting that resolve-tspaths is failing to find the tsconfig.json file, or the actual files that it needs to process?

Best way forward would be if you could provide an example repo that I could clone and run to investigate. 😁

benyap avatar Aug 12 '24 04:08 benyap

Hey @benyap, thank you for the quick reply!

I'm pretty sure it's the parentheses that are causing the issue. It didn't seem like resolve-tspaths was unable to find the tsconfig.json file, but that it wasn't able to find any files for processing.

I will absolutely provide a repo where this is reproducible in the next few days, apologies for not doing it in the first place.

Thanks again!

tee-yankov avatar Aug 12 '24 08:08 tee-yankov

Hey @benyap super sorry for the delay on this, but I was swamped. I've provided a repro repo here

Just please make sure to clone the project with something along the lines of

git clone [email protected]:tee-yankov/resolvepaths-repro-rpr-.git "resolvepaths-repro (rpr)"

so that the problematic characters are in the path. If you run npm run build like that, resolve-tspaths will find 0 files to process. If you just change the folder name to, for example resolvepaths-repro, then it correctly detects 1 file to process.

Cheers, and let me know if you need any further help from me!

tee-yankov avatar Aug 21 '24 14:08 tee-yankov

@all-contributors add @tee-yankov for bug report

benyap avatar Sep 19 '24 09:09 benyap

@benyap

I've put up a pull request to add @tee-yankov! :tada:

allcontributors[bot] avatar Sep 19 '24 09:09 allcontributors[bot]

Hey @tee-yankov, thanks for your bug report and your patience. This has been fixed in v0.8.20 and should be available in the latest version of the package! (v0.8.22)

benyap avatar Sep 19 '24 10:09 benyap