Skip to content

Commit

Permalink
Merge branch 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Jan 16, 2024
2 parents 992e08c + 53a4baf commit 82c6b55
Show file tree
Hide file tree
Showing 7 changed files with 213 additions and 2,181 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/default.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
</ul>
<div class="netlify-badge">
<a href="https://www.netlify.com">
<img src="https://www.netlify.com/img/global/badges/netlify-color-accent.svg" loading="lazy">
<img src="https://www.netlify.com/img/global/badges/netlify-color-accent.svg" alt="Built with Netlify (Netlify logo)" loading="lazy">
</a>
</div>
</div>
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;
}
53 changes: 22 additions & 31 deletions lib/reporters/nyan.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function NyanCat(runner, options) {
runner.once(EVENT_RUN_END, function () {
Base.cursor.show();
for (var i = 0; i < self.numberOfLines; i++) {
write('\n');
process.stdout.write('\n');
}
self.epilogue();
});
Expand Down Expand Up @@ -102,15 +102,15 @@ NyanCat.prototype.drawScoreboard = function () {
var stats = this.stats;

function draw(type, n) {
write(' ');
write(Base.color(type, n));
write('\n');
process.stdout.write(' ');
process.stdout.write(Base.color(type, n));
process.stdout.write('\n');
}

draw('green', stats.passes);
draw('fail', stats.failures);
draw('pending', stats.pending);
write('\n');
process.stdout.write('\n');

this.cursorUp(this.numberOfLines);
};
Expand Down Expand Up @@ -144,9 +144,9 @@ NyanCat.prototype.drawRainbow = function () {
var self = this;

this.trajectories.forEach(function (line) {
write('\u001b[' + self.scoreboardWidth + 'C');
write(line.join(''));
write('\n');
process.stdout.write('\u001b[' + self.scoreboardWidth + 'C');
process.stdout.write(line.join(''));
process.stdout.write('\n');
});

this.cursorUp(this.numberOfLines);
Expand All @@ -163,25 +163,25 @@ NyanCat.prototype.drawNyanCat = function () {
var dist = '\u001b[' + startWidth + 'C';
var padding = '';

write(dist);
write('_,------,');
write('\n');
process.stdout.write(dist);
process.stdout.write('_,------,');
process.stdout.write('\n');

write(dist);
process.stdout.write(dist);
padding = self.tick ? ' ' : ' ';
write('_|' + padding + '/\\_/\\ ');
write('\n');
process.stdout.write('_|' + padding + '/\\_/\\ ');
process.stdout.write('\n');

write(dist);
process.stdout.write(dist);
padding = self.tick ? '_' : '__';
var tail = self.tick ? '~' : '^';
write(tail + '|' + padding + this.face() + ' ');
write('\n');
process.stdout.write(tail + '|' + padding + this.face() + ' ');
process.stdout.write('\n');

write(dist);
process.stdout.write(dist);
padding = self.tick ? ' ' : ' ';
write(padding + '"" "" ');
write('\n');
process.stdout.write(padding + '"" "" ');
process.stdout.write('\n');

this.cursorUp(this.numberOfLines);
};
Expand Down Expand Up @@ -213,7 +213,7 @@ NyanCat.prototype.face = function () {
*/

NyanCat.prototype.cursorUp = function (n) {
write('\u001b[' + n + 'A');
process.stdout.write('\u001b[' + n + 'A');
};

/**
Expand All @@ -224,7 +224,7 @@ NyanCat.prototype.cursorUp = function (n) {
*/

NyanCat.prototype.cursorDown = function (n) {
write('\u001b[' + n + 'B');
process.stdout.write('\u001b[' + n + 'B');
};

/**
Expand Down Expand Up @@ -264,13 +264,4 @@ NyanCat.prototype.rainbowify = function (str) {
return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
};

/**
* Stdout helper.
*
* @param {string} string A message to write to stdout.
*/
function write(string) {
process.stdout.write(string);
}

NyanCat.description = '"nyan cat"';
Loading

0 comments on commit 82c6b55

Please sign in to comment.