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

Fix: Image cdn cli improvements #6189

Merged
merged 7 commits into from
Nov 20, 2023
Merged

Fix: Image cdn cli improvements #6189

merged 7 commits into from
Nov 20, 2023

Conversation

kathmbeck
Copy link
Contributor

@kathmbeck kathmbeck commented Nov 17, 2023

[🎉 Thanks for submitting a pull request! 🎉

Summary

Fixes ADN-72
& addresses feedback to request images from local server https://netlify.slack.com/archives/C05V2MLPAFN/p1700225547575989

Also updated types in the file I was editing which ended up being most of the changes. 😄


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

@kathmbeck kathmbeck changed the title Image cdn cli fixes Fix: Image cdn cli improvements Nov 17, 2023
Copy link

github-actions bot commented Nov 17, 2023

📊 Benchmark results

Comparing with 6a1cc63

  • Dependency count: 1,396 (no change)
  • Package size: 404 MB (no change)
  • Number of ts-expect-error directives: 1,536 ⬇️ 0.91% decrease vs. 6a1cc63

const path = `/${modifiers}/${encodeURIComponent(url)}`
req.url = path
const sourceImagePath = url as string
const modifiers = (await transformImageParams(query)) || `_`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addition of _ handles case where no transform params are provided.

// If the image is remote, we can just pass the URL as is
req.url = `/${modifiers}/${encodeURIComponent(sourceImagePath)}`
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This the only other functional change, uses the dev server to get the image instead of relying on the local dist directory.

fit?: string | null
position?: string | null
}

// @ts-expect-error TS(7006) FIXME: Parameter 'config' implicitly has an 'any' type.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need images on type before removing
netlify/build#5393

@kathmbeck kathmbeck marked this pull request as ready for review November 17, 2023 20:23
@kathmbeck kathmbeck requested a review from a team as a code owner November 17, 2023 20:23
sarahetter
sarahetter previously approved these changes Nov 20, 2023
@kathmbeck kathmbeck enabled auto-merge (squash) November 20, 2023 14:26
@kathmbeck kathmbeck merged commit 327ff95 into main Nov 20, 2023
35 checks passed
@kathmbeck kathmbeck deleted the image-cdn-cli-fixes branch November 20, 2023 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants