Shields: CLI raster badges are broken

Created on 19 Jul 2018  ·  6Comments  ·  Source: badges/shields

As observed at https://github.com/badges/shields/pull/1774/files#r203522813, the CLI isn't generating raster badges correctly.

node lib/badge-cli.js '' '' '#bada55' .png > favicon.png

Observed output:
favicon

Expected output:

bug

Most helpful comment

# prepare a test
cat test.sh 
node lib/badge-cli.js '' '' '#bada55' .svg > favicon-tested.svg
grep 'width="22"' favicon-tested.svg

# find a bad commit
git bisect start HEAD 438e47adfb74e9a775e3fed7a5547959f343c009
git bisect run ./test.sh

# result
b216bcc17e667a2fb09bede7be0d1c67e731d767 is the first bad commit

the bad commit -> https://github.com/badges/shields/commit/b216bcc17e667a2fb09bede7be0d1c67e731d767

All 6 comments

# prepare a test
cat test.sh 
node lib/badge-cli.js '' '' '#bada55' .svg > favicon-tested.svg
grep 'width="22"' favicon-tested.svg

# find a bad commit
git bisect start HEAD 438e47adfb74e9a775e3fed7a5547959f343c009
git bisect run ./test.sh

# result
b216bcc17e667a2fb09bede7be0d1c67e731d767 is the first bad commit

the bad commit -> https://github.com/badges/shields/commit/b216bcc17e667a2fb09bede7be0d1c67e731d767

But:

node lib/badge-cli.js '' '' '#bada55' .png > favicon.png

gives me:

  • favicon in master
  • favicon in 438e47adfb74e9a775e3fed7a5547959f343c009 (random old commit)
  • favicon in b216bcc17e667a2fb09bede7be0d1c67e731d767
  • favicon in b216bcc17e667a2fb09bede7be0d1c67e731d767 (one commit before b216bcc17e667a2fb09bede7be0d1c67e731d767)

Seems like this may be a "wontfix," given discussion in #3587 and #3112.

As discussed at https://github.com/badges/shields/pull/3644#issuecomment-508947740 it seems these work fine on some systems.

I've just upgraded imagemagick, and this is what I'm seeing now:

node lib/badge-cli.js build passed :green .png > mybadge.png

mybadge

The summary of other discussions we've had is that:

  • We want this to work more reliably.
  • It'll be through an optionalDependency to keep the gh-badges footprint smaller.
  • We can switch from gm / imagemagick to Puppeteer using the more modern rasterization library convert-svg-to-png – that's the one that's being used in svg-to-image-proxy.

Whenever the change might be made, could the functionality be added on the programmatic side as well?

This functionality is being removed in #4756, so closing this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paladox picture paladox  ·  72Comments

Undistraction picture Undistraction  ·  31Comments

paulmelnikow picture paulmelnikow  ·  40Comments

paulmelnikow picture paulmelnikow  ·  30Comments

guylepage3 picture guylepage3  ·  30Comments