-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 issue with custom logo generation in badge-maker (#9644) #9645
Conversation
|
Thanks. I will have a look over this but first I really need to re-read #4947 From memory we never progressed it because there were some things we didn't really reach an agreement on. #9476 may decide one of them for us. Adding just base64 is a reasonable first step, but I want to be sure we're not doing it in a way that impacts how we would want to add named logos. |
Thank you for response! |
At some point in the past I looked at adopting a proper argument parsing library like yargs or commander. Because of the slightly non-standard way the arguments are currently parsed (positional argument 5 can be either That doesn't mean we can't do it. It would make much more sense to have flags like Lets not load it into this PR though. This PR is a relatively small change. Re-working the CLI is going to be a bigger job, so lets not block this PR on doing that as well. |
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.
We'll need to update the documentation in
https://github.com/badges/shields/tree/master/badge-maker#format
to cover the new params.
badge-maker/index.d.ts
Outdated
logoPosition?: number | ||
logoWidth?: number |
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.
I don't think there is a strong case for exposing logoPosition
and logoWidth
in the badge-maker package. logoPosition
is not exposed at all by shields.io. logoWidth
kind of is available by accident but it is not documented and we may deprecate or quietly remove it at some point.
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.
What do you think about adding but marking logoWidth
as deprecated? I think it should be more clear.
Also I remove logoPosition
from make-badge.js
also as it does not used at all.
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 things stand right now, logoWidth
is not exposed in the public API at the library level. If you call makeBadge()
with a logoWidth
, it will throw ValidationError: Unexpected field 'logoWidth'
I don't think we should expose logoWidth
as deprecated and then remove it again later. Lets just keep this as it stands (i.e: not exposed) at the library layer.
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.
Ok, and what do you think about removing logoWidth
from makeBadge
function then as I did in this commit?
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.
I will reply to this, but I don't have time immediately
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.
Although it is not exposed via the NPM package, logoWidth
is exposed via shields.io.
https://img.shields.io/badge/foo-bar-blue?logo=javascript
https://img.shields.io/badge/foo-bar-blue?logo=javascript&logoWidth=50
I would like to remove it, but just deleting the param here is not in isolation a massively helpful thing to do.
I've raised an issue about this: #10285
@zavoloklom any chance you could address Chris's feedback in the coming weeks? :) |
Hi, I'll do it this week |
I added description for |
@chris48s Hi! I'll make all necessary changes and left comments. I'll squash my commits when you say it's ok to |
Don't worry about squashing or rebasing. We squash-merge PRs on this project anyway. Just keep pushing more commits to the branch. It is easier to see what has changed between rounds of review that way. |
* allow `logo`, `logoPosition`, `logoWidth`, and `links` as expected keys * add validation for `logo`, `logoPosition`, `logoWidth`, and `links` keys * add validation tests
I feel like this PR adds a couple of features that are nearly ready to go but we're also going round in circles on some other things. I'm going to close this PR but I'm going to move the ideas you've raised here to the following 3 places:
|
Looking forward to see these changes! |
allow
logo
,logoPosition
,logoWidth
, andlinks
as expected keysadd validation for
logo
,logoPosition
,logoWidth
, andlinks
keysadd validation tests