hypermod-community icon indicating copy to clipboard operation
hypermod-community copied to clipboard

fix standalone transform runs - resolve path of transform

Open kiprasmel opened this issue 4 years ago • 7 comments

in the issue you linked [1] from jscodeshift, i think you forgot the path.resolve for non-http(s) imports (not even sure how they'd work tbh).

i tried running a local transform and it didn't work, but with this fix it did regardless of where i called the packages/cli/bin/codeshift-cli.js from. i think you might've been using the packages and not the --transforms flag so i understand why you could've missed it 😅

tbh there are more improvements to make w/ the local transforms (see [2] & I'll create more later) but this is the first step :D

seen here: https://github.com/facebook/jscodeshift/blob/aea20523d9d616e7debc7bc00b66835284278555/bin/jscodeshift.js#L142

[1] https://github.com/facebook/jscodeshift/issues/398 [2] https://github.com/CodeshiftCommunity/CodeshiftCommunity/issues/48#issuecomment-955049880

kiprasmel avatar Oct 29 '21 23:10 kiprasmel

This is fantastic mate! Thanks so much for contributing 🤙 Could you please run yarn changeset and follow the prompts to make sure the CLI gets versioned? A patch should do :)

danieldelcore avatar Nov 01 '21 07:11 danieldelcore

Also looks like there are some tests that need to be updated 🙏

danieldelcore avatar Nov 01 '21 07:11 danieldelcore

Thank you c:

Could you please run yarn changeset and follow the prompts to make sure the CLI gets versioned?

Will try tmr.

A patch should do :)

Pretty sure this would be a breaking change since it will make broken behavior no longer broken but i assume nobody was using it so should be fine lol

Also looks like there are some tests that need to be updated 🙏

uh oh, seems that they are marking the now-correct behavior as wrong? not sure if i have the time to dig into them tbh, any chance you could take a look?

also, should we consider the https? imports, as mentioned in [1]?

  /^https?/.test(options.transform) ? options.transform : path.resolve(options.transform),

kiprasmel avatar Nov 01 '21 20:11 kiprasmel

Can do, I'll have a look at this asap!

danieldelcore avatar Nov 08 '21 00:11 danieldelcore

in addition to this, i stopped using require.resolve in the codeshift.config.js.

kiprasmel avatar Jan 17 '22 09:01 kiprasmel

fyi @danieldelcore i've rebased again (same w/ #97 which depends on this). i see you removed the path import so i had to re-add it again hehe

kiprasmel avatar Feb 10 '22 15:02 kiprasmel

hey @danieldelcore - any updates on this? this is a prerequisite for https://github.com/CodeshiftCommunity/CodeshiftCommunity/pull/97 which would help get rid of our fork!

i can solve the merge conflicts but that's less relevant -- main question is - how do i fix the tests not passing, and what else should i do to get it merged? thanks!

kiprasmel avatar Jul 08 '22 14:07 kiprasmel