Open tnrich opened 7 years ago
Hey @jurassix , I've started work on a vscode extension here: https://github.com/tnrich/vscode-js-path-refactor
It seems like I might already be close to having something that works, just needs a bit more debugging.
I might need to ask you some questions about certain things I was slightly unclear on. One of them that comes to mind: Why were you importing the transforms like this:
const transform = require.resolve(
'refactoring-codemods/lib/transformers/import-relative-transform',
);
@tnrich it's been awhile. But I'm betting that the jscodeshift/Runner requires a path to the transform
const result = Runner.run(transform, roots, options);
require.resolve()
-> https://nodejs.org/api/modules.html#modules_require_resolve
Use the internal require() machinery to look up the location of a module, but rather than loading the module, just return the resolved filename.
@tnrich it's awesome that your moving forward with the vscode version!
@jurassix okay awesome I get that now. Thanks!
Okay I added a first pass here:
https://marketplace.visualstudio.com/items?itemName=tnrich.js-path-refactor
I'd love any feedback!
One thing I changed is that I force the user to choose the scope of where they want to apply the transforms because in my giant repo I usually only want to have it act on sub folders, not the entire project.
Cheers!
Posting this here to show you and partially so I can link to the url :)
Love it! Now if you can only make file drag-n-drop fire the codemod! In atom there were no good hooks besides creating a whole TreeView.
Hey @jurassix ,
I know we talked a while back on some thread about adding this to sublime and you said you were more interested in adding it to vscode. I'm using vscode now and would love to have this plugin there :)
Lemme know how I can help!