jeffijoe / typesync

Install missing TypeScript typings for dependencies in your package.json.
MIT License
1.53k stars 22 forks source link

EISDIR error on 0.13.1 and 0.13.2 #128

Closed bduff9 closed 3 weeks ago

bduff9 commented 3 weeks ago

Hello! We have been using your tool for a while however it started breaking today for us on the latest version. 0.13.1 also breaks with the below error however 0.13.0 works fine.

❯ npx typesync
»  TypeSync v0.13.2
✖  EISDIR: illegal operation on a directory, read
Stack:
Error: EISDIR: illegal operation on a directory, read
jeffijoe commented 3 weeks ago

@lishaduck this seems like it could be related to #126 ?

lishaduck commented 3 weeks ago

Oh, yeah. Everything was mocked in tests, so it didn't verify dir/file differences, which I refactored to fix the tests :) I'll take a look.

EDIT: Feel free to revert #126 until I fix it. EDIT 2: I'll either get to this tonight (unlikely) or Saturday.

lishaduck commented 3 weeks ago

Funny, dependabot just tried to update it in my project: https://github.com/PSDTools/psdtools.github.io/actions/runs/11505963460/job/32028840120

jeffijoe commented 3 weeks ago

Since I can't reproduce this myself (I don't use workspaces), I'm gonna need one of you to try this alpha release to see if adding nodir to glob does the trick: typesync@0.13.3-alpha.0

lishaduck commented 3 weeks ago

No, now it doesn't get the workspaces at all.

jeffijoe commented 3 weeks ago

I'm not sure where it's attempting tor read a directory as a file - we only read files in 2 places, the workspace resolver and the package json file, and the former is wrapped in a try-catch.

lishaduck commented 3 weeks ago

Ok, figured it out. readPackageFile expects a package.json, but I gave it a directory. I'll look into it further. Here's the line erroring: https://github.com/jeffijoe/typesync/blob/19ac36d544e4e34bd7ed8b2cabbf0a42c74a6f04/src/type-syncer.ts#L118

lishaduck commented 3 weeks ago

Ok, I think I fixed it (it was a bug in my original impl, but I'd worked around it without realizing it; I fixed the workaround in #126, but then the bug was exposed). I'll test it and probably send in a PR in ~2 hours.

jeffijoe commented 3 weeks ago

0.13.3 released, thanks @lishaduck !

lishaduck commented 3 weeks ago

Do you want to deprecate 0.13.1 & .2?

jeffijoe commented 3 weeks ago

Done.