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

fix: spawn jscodeshift cli using node #214

Merged
merged 2 commits into from
Aug 11, 2021

Conversation

merceyz
Copy link
Contributor

@merceyz merceyz commented Jun 7, 2021

What's the problem this PR addresses?

jest-codemods tries to spawn sh files on Windows by spawning node_modules/.bin/jscodeshift
Using require.resolve('.bin/jscodeshift') relies on an implementation detail that isn't guaranteed to exist (Yarn PnP) or point to the expected version of jscodeshift

How did you fix it?

Resolve the JS CLI directly and spawn it using node

Copy link
Owner

@skovhus skovhus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

I'm curious why we never heard about this issue. 🤔

@skovhus skovhus merged commit 6f01940 into skovhus:master Aug 11, 2021
@merceyz
Copy link
Contributor Author

merceyz commented Aug 11, 2021

Seems execa reads the shebang and spawns the correct process but either way using require.resolve('.bin/jscodeshift') relies on an implementation detail that isn't guaranteed to exist (Yarn PnP) or point to the expected version of jscodeshift

@merceyz merceyz deleted the merceyz/fix/jscodeshift-path branch August 11, 2021 19:59
@skovhus
Copy link
Owner

skovhus commented Aug 11, 2021

Seems execa reads the shebang and spawns the correct process but either way using require.resolve('.bin/jscodeshift') relies on an implementation detail that isn't guaranteed exist (Yarn PnP) or not point to the expected version of jscodeshift

Good point. Again, thanks for fixing this 👏

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

2 participants