-
Notifications
You must be signed in to change notification settings - Fork 5
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
[ASSETS-36125] Update SVG creation logic #216
Conversation
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.
Seems there was no (visible) change in this rendition
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.
Off-by-one change - logic change leads to width being 1 px smaller.
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.
Off-by-one change - logic change leads to width being 1 px smaller.
@@ -1091,7 +1091,8 @@ describe("api.js", () => { | |||
assert.ok(!fs.existsSync(renditionDir)); | |||
}); | |||
|
|||
it('should send metrics - rendition and activation with cgroup metrics', async () => { | |||
it.skip('should send metrics - rendition and activation with cgroup metrics', async () => { |
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.
Flaky: sometimes (most often) hangs, sometimes runs. Keeping for local testing.
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.
is this hanging happening in prod too?
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #216 +/- ##
==========================================
- Coverage 56.95% 55.35% -1.60%
==========================================
Files 12 12
Lines 834 840 +6
==========================================
- Hits 475 465 -10
- Misses 359 375 +16 ☔ View full report in Codecov by Sentry. |
Covered in the worker tests! |
@@ -15,7 +15,7 @@ jobs: | |||
if: "!contains(github.event.head_commit.message, '[ci skip]')" | |||
strategy: | |||
matrix: | |||
node-version: [14.17] | |||
node-version: [18.4.0] |
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.
Even more tests hang/fail without this update, because when installing some libs warn of a bad (outdated) node engine.
@@ -634,13 +634,21 @@ async function imagePostProcess(intermediateRendition, rendition, directories) { | |||
|
|||
function convertSvg(img, instructions) { | |||
// ImageMagick automatically keeps aspect ratio | |||
// Only using width because ImageMagick will use the smallest value whether it be width or height | |||
const width = instructions.width || SVG_DEFAULT_WIDTH; | |||
let imageSize = SVG_DEFAULT_WIDTH; |
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.
Would be used only if nothing is set in instructions at all.
// image magick will keep aspect ratio | ||
imageSize = `${instructions.width}x${instructions.height}`; | ||
} else if(instructions.width) { | ||
imageSize = `${instructions.width}x`; |
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.
The x
is left for clarity in the command param, to know we got width only (width is considered to be by default the first value in the command param).
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.
do we want to log wether we only got with or height or got both instead of having to examine the cmd?
} else if(instructions.width) { | ||
imageSize = `${instructions.width}x`; | ||
} else if(instructions.height) { | ||
imageSize = `x${instructions.height}`; |
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.
The x is left for clarity in the command param to know we got height only, and to make sure aspect ratio is kept, since height is the second param (and the first param, width, is "empty").
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.
a few qs, but LGTM :)
// image magick will keep aspect ratio | ||
imageSize = `${instructions.width}x${instructions.height}`; | ||
} else if(instructions.width) { | ||
imageSize = `${instructions.width}x`; |
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.
do we want to log wether we only got with or height or got both instead of having to examine the cmd?
@@ -1091,7 +1091,8 @@ describe("api.js", () => { | |||
assert.ok(!fs.existsSync(renditionDir)); | |||
}); | |||
|
|||
it('should send metrics - rendition and activation with cgroup metrics', async () => { | |||
it.skip('should send metrics - rendition and activation with cgroup metrics', async () => { |
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.
is this hanging happening in prod too?
🎉 This PR is included in version 4.6.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
We had some logic for default sizes of SVG files that only took width into account. This PR updates this logic to look at both width and height when picking (default) sizes for rendition generation.
Fixes # ASSETS-36125
Types of changes
Checklist:
addedupdated tests to cover my changes.