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

gatsby-image codemod #28112

Merged
merged 68 commits into from
Dec 4, 2020
Merged

gatsby-image codemod #28112

merged 68 commits into from
Dec 4, 2020

Conversation

laurieontech
Copy link
Contributor

This is the initial progress towards a codemod for converting gatsby-image projects to use gatsby-plugin-image.

Main missing pieces:

  • CLI support so users can run it
  • Not currently supporting all the changes to the resolvers, only the most common ones (e.g. no support for tracedSVGOptions)

[ch16947]

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 16, 2020
@laurieontech laurieontech added topic: media Related to gatsby-plugin-image, or general image/media processing topics and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Nov 16, 2020
@ascorbic
Copy link
Contributor

ascorbic commented Nov 17, 2020

Amazing work! That's loads more than I thought we would have done now! Is there a reason you're not putting it in gatsby-codemods? Using JSCodeShift would give you all the cli stuff for free, along with nice things like dry-run support and lots of test helpers.

@laurieontech
Copy link
Contributor Author

@ascorbic Per consultation with @wardpeet we opted to move away from jscodeshift for this one. And it's likely to be a separate package that's included in both gatsby-image and gatsby-plugin-image, but haven't officially landed on that yet.

@wardpeet
Copy link
Contributor

The reason I opted out is that jscodeshift is that recast doesn't have great documentation. After some digging we can set recast parser to Babylon and probably re-use the babel code and have our cake and eat it too.

…e.js

Co-authored-by: Kyle Gill <kylerobertgill@gmail.com>
Copy link
Contributor

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@laurieontech laurieontech merged commit 726a5fe into master Dec 4, 2020
@delete-merged-branch delete-merged-branch bot deleted the image-codemod branch December 4, 2020 15:58
"@babel/plugin-syntax-jsx": "^7.12.1",
"@babel/plugin-syntax-typescript": "^7.12.1",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm late, but starting from Babel 7.8.0 this was enabled by default (because it reached Stage 4), so you don't need the syntax plugin anymore! (blog post)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: media Related to gatsby-plugin-image, or general image/media processing topics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants