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

temp: x script for quickly running & seeing the diff #71

Closed
wants to merge 13 commits into from
Closed

temp: x script for quickly running & seeing the diff #71

wants to merge 13 commits into from

Conversation

kiprasmel
Copy link
Contributor

the run.js is cool, but it became annoying to create source files & undo the changes, so this just helps.

x probably shouldn't be tracked here; i myself move it into a script directory that's inside my $PATH, e.g. ~/.local/bin/.

i edit the content directly there, most often at the bottom because that's the latest stuff you see in the terminal when you run it.

running is the same as run.js - x flow cui5 path/to/dir/or/file/or/whatever

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]) but this is the first step :D

[1] facebook/jscodeshift#398
[2] #48 (comment)
Signed-off-by: Kipras Melnikovas <[email protected]>
maybe would be nicer if the interface would be `-t t1 -t t2 -t t3`
instead of current `-t t1,t2,t3` (you could separate into multiple lines
and keep it cleaner), but don't know how to do that so this works just fine.

Signed-off-by: Kipras Melnikovas <[email protected]>
Signed-off-by: Kipras Melnikovas <[email protected]>
(cherry picked from commit d53171e)
@danieldelcore
Copy link
Contributor

Great work on all of this! Sorry I've been MIA lately. I'll have a look at this tomorrow hopefully! Keep it up

@kiprasmel
Copy link
Contributor Author

yeah no worries. i think i've realized that this is nice for convenience for small things, but when you start adding more stuff, you're likely to miss it unless you also have tests - something to keep in mind.

@danieldelcore danieldelcore force-pushed the main branch 3 times, most recently from 554c39c to ad71e7b Compare April 18, 2022 09:40
@danieldelcore
Copy link
Contributor

Hey @kiprasmel 👋 How's it going?

I just noticed that you've done loads of work in your fork to setup this codeshift package:
https://github.com/pipedrive/CodeshiftCommunity/tree/temp/quick-run-script/community/%40pipedrive__convention-ui-react

Since it's quite bespoke and has its own build configuration (jest, ts, etc) have you thought about creating this as a standalone package? This means you wont need to fork and maintain the rest of the repository and just focus the codemod package that you've setup here.

This guide should show you how it's done:
https://www.codeshiftcommunity.com/docs/external-packages

Also the authoring guides explain the different publishing options and why you might want to use one over the other:
https://www.codeshiftcommunity.com/docs/authoring

In short

  • npx @codeshift/cli init @pipedrive/convention-ui-react
  • Copy source files from into the new project
  • npm build && npm publish

Then your codemods should be runnable like so:

npx @codeshift/cli -p @pipedrive/[email protected] path/to/source

The community folder is designed to be a bit restrictive so additional dependencies and build configuration to add complexity to the community etc.

@kiprasmel
Copy link
Contributor Author

hey @danieldelcore, thanks! how are you?

this branch specifically was just to showcase the x script which i thought could've been to interest for you. i think i forgot to rebase and that's why there's a lot of unrelated stuff here.

the proper branch of ours is the fork one, it should be way more up to date, if you were curious about exploring our solution:
https://github.com/pipedrive/CodeshiftCommunity/tree/fork/community/%40pipedrive__convention-ui-react

as for the community folder vs standalone package, i saw that you introduced this capability a little while ago.
we actually wanted to migrate to a standalone package, but we cannot until #97 is merged -- would it be possible to get it moving?

thanks!

@pipedrive pipedrive closed this by deleting the head repository Apr 16, 2024
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.

3 participants