-
Notifications
You must be signed in to change notification settings - Fork 461
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
Remote transform initial pass #95
Conversation
4581dcd
to
0958bd5
Compare
if (/^http/.test(transformFile)) { | ||
if (transformFile.indexOf('https') !== 0) { | ||
console.log( | ||
clc.whiteBright.bgRed('ERROR') + ' Remote transforms only support https. %s', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No real reason. Maybe security?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed this constraint
0958bd5
to
737c7b7
Compare
Merged with 027cd02. The merge conflict was a a bit tricky to solve, I hope I did everything correctly :P (test still pass!) |
Released with v0.3.15. |
…acebook#95) See benjamn/recast#365 for more context. It looks like the recast printer includes all JSX on the same line by default, which can lead to really ugly code with deeply nested React elements. However, if we put a `'\n'` text node around all adjacent children, it will format the JSX in the typical multiline way, properly indented, so this commit changes the script to do that. Ideally, we might want to keep some expressions inline, e.g. by determining whether the child expressions will fit nicely on one line, but that seems sort of nontrivial with just the AST, so we just use multiline JSX always for now. To keep strings correct, we need to be a little more careful about translating child string literals. Since each child will be on its own line, leading and trailing whitespace will be removed, so if the string literal starts or ends with whitespace, or is an empty string, we fall back to an expression container with a normal JS string.
An initial pass at including remote support for the transform flag.
jscodeshift -t https://raw.githubusercontent.com/reactjs/react-codemod/master/transforms/react-to-react-dom.js .
One constraint is the remote transform must be entirely self-contained.
Closes #94.