Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork19
Comments
feat: allow providing custom runner per transform file thru codeshiftConfig#97
feat: allow providing custom runner per transform file thru codeshiftConfig#97kiprasmel wants to merge 2 commits intohypermod-io:mainfrom
Conversation
c1905e9 toceed347Comparekiprasmel commentedJan 26, 2022
would be great to review if possible@danieldelcore 🙏 |
e063471 to1013148Comparedanieldelcore commentedJan 28, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Really interesting, could you give me some more background as to how this all fits together? As I understand it, instead of only being able to modify js / ts files you want to be able to provide a custom runner to begin to support other types of files like css? Can you share an example codeshift.config with me? Also i've just merged some fixes/improvements, you might want to rebase 😄 |
kiprasmel commentedJan 28, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@danieldelcore hey! yes, correct, we want to have independance from upstream (you) so that we don't need to wait to get some custom runner merged (sometimes it could be very specific even, and you might not even need it merged, and that's fine), while still utilizing your CLI w/o publishing our own, and this unlocks the door. this could even be used if e.g. you want to do more steps before/after the codemod run, e.g. doing some pre-processing, or idk updating some npm dependencies -- you can basically add any code there. the value is that we don't need to create wrapper CLIs around it, and just use the @codeshift/cli as it is. re: updates -- coolio, rebased smoothly. an example I already linked to --https://github.com/pipedrive/CodeshiftCommunity/pull/22
and you can read on how to use the codemods (we have a simple wrapper you can try running the demo files. i just added a new one for scss: the only concern is -- will this work if we publish our npm package? i haven't had a chance to try that; i need to first extract into a separate repository. but ideally we'd figure this out here before i do that. and maybe a slight change i'd do is renaming wdyt? would be very useful. |
1013148 tobfbf31aComparee0eed72 toc8a7ddfCompare554c39c toad71e7bComparein 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]hypermod-io#48 (comment)Signed-off-by: Kipras Melnikovas <kipras@kipras.org>
…Configdepends on:-hypermod-io#63example on how it could be used:-https://github.com/pipedrive/CodeshiftCommunity/pull/22 - though note we might refactor into separate PRs, idk, preferably would use directly from upstream (you).fixes a lot of cases for us:1. we have a postcss codemod that we want to run,while still utilizing the @codeshift/cli.though, i don't know if these changes will workif we're using a remote package, will they?2. we'll want to do some global pre-processingon files before running our codemod.though, there's still no way to provide the codemodas a __function__ instead of an __import path__ to jscodeshift,which will force us to do dependency injectioninstead of just passing the pre-processed resultsas an argument to a function.this is where the considerations to fork jscodeshiftcome into play again:-hypermod-io#67Signed-off-by: Kipras Melnikovas <kipras@kipras.org>
facba25 to5248c0eCompare
Uh oh!
There was an error while loading.Please reload this page.
depends on:
kiprasmel:patch-1but cannot do that here),and regardless, we need to merge it first, before this one.
example on how it could be used:
preferably would use directly from upstream (you).
fixes a lot of cases for us:
while still utilizing the @codeshift/cli.
though, i don't know if these changes will work
if we're using a remote package, will they?
on files before running our codemod.
though, there's still no way to provide the codemod
as afunction instead of animport path to jscodeshift,
which will force us to do dependency injection
instead of just passing the pre-processed results
as an argument to a function.
this is where the considerations to fork jscodeshift
come into play again: