-
Notifications
You must be signed in to change notification settings - Fork 1
Release 2.3.0 #77
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
base: main
Are you sure you want to change the base?
Release 2.3.0 #77
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.
This looks promising indeed! 👍
@import
not supporting third-party types is indeed baffling and somewhat concerning. As a workaround, we could import and re-export those types in types.ts
though?
Some of the suggested changes from faucet-pipeline/faucet-pipeline-static#71 apply here as well (e.g. Y U NO ESM, explicit paths with ./
, TypeScript configuration, @import
formatting), but I opted not to add redundant noise here while we're still discussing such nuances over there.
lib/index.js
Outdated
@@ -141,9 +109,16 @@ async function optimizeSVG(sourcePath) { | |||
return output.data; | |||
} catch(error) { | |||
abort(`Only SVG can be converted to SVG: ${sourcePath}`); | |||
return ""; // XXX: this is for typescript :joy: |
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.
@ts-expect-error
perhaps? But yeah, annoying...
Also, you might want to use repr
in such error messages. (Same elsewhere, possibly also in faucet-static? I don't recall at this moment.)
lib/index.js
Outdated
image.resize({ | ||
width: metadata.width * scale, | ||
height: metadata.height * scale | ||
}); |
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.
YMMV, but destructuring could make this a little less verbose and thus more readable?
let { width, height } = await image.metadata();
if(width && height) {
image.resize({
width: width * scale,
height: height * scale
});
}
In fact, this made me realize a potential bug: Should we worry about zero values in that if
statement? You never know what kind of weird input people have...
lib/index.js
Outdated
function withFileExtension(...extensions) { | ||
return filename => extensions.includes(extname(filename)); | ||
} | ||
|
||
// extname follows this annoying idea that the dot belongs to the extension | ||
/** | ||
* extname follows this annoying idea that the dot belongs to the extension |
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.
As a ranty comment, this seemed fine - as a docstring, it seems more confusing than helpful? At least I had to spend a few cycles trying to decode the intent here.
However, I believe faucet-static does the same thing, so perhaps that should become a reusable utility (i.e. it shouldn't be inlined after all 🙈 )?
You misunderstood that. The types I'm importing are in faucet-pipeline-static/lib/types.ts. But you can't import them from a comment... 😭 For me, this puts a giant question mark into the "TS Doc" effort in these two projects, and I'm considering removing the TS stuff in both... |
I've created a minimal test case for the JSDoc imports issue:
|
Uh oh!
There was an error while loading. Please reload this page.