-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat(cli): Setup command and codemod for OG image middleware #10485
Conversation
@cannikin Two points to add when you go to look at this:
|
I also noticed the codemod tests don't cover the case where the middleware is already setup. After thinking about it for a moment, I don't want to consider this case. The reward from doing so given the complexity required to determine if that is the case is too low in my opinion. |
I'm okay with it being Even though SSR support is experimental, the ogimage stuff should be stable and ready to go. Maybe there's a check that if you run that command, but SSR hasn't already been enabled, it errors and lists the command to run to install it? |
That's fine, as long as it just stops and doesn't end up mangling the file because it couldn't figure out what to do? Can it just error out, say something about the file contents are unexpected, and give a sample output of the import and what |
Nice one @Josh-Walker-GM - I think missing step is updating Vite.config.js to include the plugin too! :) |
183f1b9
to
41fab0f
Compare
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.
Looking good! Can we add post-setup instructions:
og:image generation is almost ready to go! You'll need to add
playwright as a dependency to the api side and then install the
headless browser packages:
yarn workspace api add playwright
cd api
yarn playwright install
Depending on how your host is configured you may need to
install additional dependencies first. If so, the `playwright install`
step will error out and give you the command to run to install
those deps.
packages/cli/src/commands/setup/middleware/ogImage/ogImageHandler.ts
Outdated
Show resolved
Hide resolved
I forgot to test this, but should this script (or maybe it does already?) error out if you try to |
Yeah the first task in the command handler checks that you have setup streaming ssr. redwood/packages/cli/src/commands/setup/middleware/ogImage/ogImageHandler.ts Lines 21 to 29 in 700341b
|
This PR introduces a setup command for the OG image generation middleware.
It did involve moving around some of the codemod utilities we have. Either because we needed to include them where we previously didn't or because they no longer made sense in the directory they were in.