jscodeshift
jscodeshift copied to clipboard
Fetch directly from astexplorer
Add support for jscodeshift -t http://astexplorer.net/#/QaBzVS9XHK
This would be amazing
It's not possible right now, since we don't run our own server. But we have to solve the parse situation anyway, so probably afterwards :)
I was thinking the same for babel (although probably out of scope) babel src -d lib --plugins http://astexplorer.net/#/QaBzVS9XHK
. You could parse the html and output a hidden div with the plugin code haha.
What would be fun to do is to use requirefromtwitter/twpm
Looks like this is already supported! Currently jscodeshift lets you pass a url to the --transform
cli arg. Which means you can pass raw files from github or gist.
So the workflow from astexplorer is admittedly convoluted but still works so 🤷
- Write a transform
- Press 'Snippet' in the top nav
- Then 'Share'.
- A modal will show up with three options. Go to the provided 'Gist' URL
- That will take you to a gist with a couple of files. Your transform will be one of them.
- Now scroll down to your
transform.js
and pressraw
- Copy the url to the raw transform
- Run jscodeshift with that url as the transform param.
Example: jscodeshift --transform="https://gist.githubusercontent.com/astexplorer/294702b0d5b73c3e1f44e630fa81ccbf/raw/80ef86991585ee03001c4de49cb61d1eb8f789e6/transform.js" path/to/code