Skip to content

Commit

Permalink
chore: remove unnecessary canvas dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Dec 28, 2023
1 parent 645469e commit dbf46ec
Show file tree
Hide file tree
Showing 5 changed files with 168 additions and 2,127 deletions.
8 changes: 0 additions & 8 deletions docs/_data/supporters.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

'use strict';

const {loadImage} = require('canvas');
const {writeFile, mkdir, rm} = require('fs').promises;
const {resolve} = require('path');
const debug = require('debug')('mocha:docs:data:supporters');
Expand Down Expand Up @@ -115,13 +114,6 @@ const fetchImage = process.env.MOCHA_DOCS_SKIP_IMAGE_DOWNLOAD
);
}
debug('fetched %s', url);
const canvasImage = await loadImage(imageBuf);
debug('ok %s', url);
supporter.dimensions = {
width: canvasImage.width,
height: canvasImage.height
};
// debug('dimensions %s %dw %dh', url, canvasImage.width, canvasImage.height);
const filePath = resolve(SUPPORTER_IMAGE_PATH, supporter.id + '.png');
await writeFile(filePath, imageBuf);
debug('wrote %s', filePath);
Expand Down
2 changes: 1 addition & 1 deletion docs/_includes/supporters.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Use Mocha at Work? Ask your manager or marketing team if they'd help [support](h
{%- if supporter.website -%}
<a href="{{ supporter.website }}" target="_blank" rel="noopener">
{%- endif -%}
<div class="sponsor" title="{{ supporter.name }}" style="width: {{ supporter.dimensions.width }}px; background-image: url(/images/supporters/{{ supporter.id }}.png?sprite=sponsors)"></div>
<div class="sponsor" title="{{ supporter.name }}" style="background-image: url(/images/supporters/{{ supporter.id }}.png?sprite=sponsors)"></div>
{%- if supporter.website -%}
</a>
{%- endif -%}
Expand Down
3 changes: 3 additions & 0 deletions docs/css/supporters.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
-sprite-location: url(/images/sprite-backers.png?pngquant);
-sprite-image-format: png;
-sprite-padding: 0 10;
background-position: center;
background-repeat: no-repeat;
background-size: contain;
width: 32px;
height: 32px;
}
Loading

0 comments on commit dbf46ec

Please sign in to comment.