Skip to content

Commit 478ca6a

Browse files
authored
add "fixture flowchart" to docs (#4440)
- add "fixture flowchart wizard" to docs - added source `.sketch` file to repo - enabled skip of supporter image download in 11ty via env var `MOCHA_DOCS_SKIP_IMAGE_DOWNLOAD` for faster iteration - made the links underline on hover - Ref: #4308 Signed-off-by: Christopher Hiller <[email protected]>
1 parent 9c28990 commit 478ca6a

File tree

5 files changed

+487
-25
lines changed

5 files changed

+487
-25
lines changed

assets/mocha-fixture-wizard.sketch

66.3 KB
Binary file not shown.

docs/_data/supporters.js

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -99,32 +99,40 @@ const nodeToSupporter = node => ({
9999
categories: node.fromAccount.categories
100100
});
101101

102-
const fetchImage = async supporter => {
103-
try {
104-
const {avatar: url} = supporter;
105-
const {body: imageBuf, headers} = await needle('get', url, {timeout: 2000});
106-
if (headers['content-type'].startsWith('text/html')) {
107-
throw new TypeError('received html and expected a png; outage likely');
102+
const fetchImage = process.env.MOCHA_DOCS_SKIP_IMAGE_DOWNLOAD
103+
? async supporter => {
104+
invalidSupporters.push(supporter);
108105
}
109-
debug('fetched %s', url);
110-
const canvasImage = await loadImage(imageBuf);
111-
debug('ok %s', url);
112-
supporter.dimensions = {
113-
width: canvasImage.width,
114-
height: canvasImage.height
106+
: async supporter => {
107+
try {
108+
const {avatar: url} = supporter;
109+
const {body: imageBuf, headers} = await needle('get', url, {
110+
timeout: 2000
111+
});
112+
if (headers['content-type'].startsWith('text/html')) {
113+
throw new TypeError(
114+
'received html and expected a png; outage likely'
115+
);
116+
}
117+
debug('fetched %s', url);
118+
const canvasImage = await loadImage(imageBuf);
119+
debug('ok %s', url);
120+
supporter.dimensions = {
121+
width: canvasImage.width,
122+
height: canvasImage.height
123+
};
124+
// debug('dimensions %s %dw %dh', url, canvasImage.width, canvasImage.height);
125+
const filePath = resolve(SUPPORTER_IMAGE_PATH, supporter.id + '.png');
126+
await writeFile(filePath, imageBuf);
127+
debug('wrote %s', filePath);
128+
} catch (err) {
129+
console.error(
130+
`failed to load ${supporter.avatar}; will discard ${supporter.tier} "${supporter.name} (${supporter.slug}). reason:\n`,
131+
err
132+
);
133+
invalidSupporters.push(supporter);
134+
}
115135
};
116-
// debug('dimensions %s %dw %dh', url, canvasImage.width, canvasImage.height);
117-
const filePath = resolve(SUPPORTER_IMAGE_PATH, supporter.id + '.png');
118-
await writeFile(filePath, imageBuf);
119-
debug('wrote %s', filePath);
120-
} catch (err) {
121-
console.error(
122-
`failed to load ${supporter.avatar}; will discard ${supporter.tier} "${supporter.name} (${supporter.slug}). reason:\n`,
123-
err
124-
);
125-
invalidSupporters.push(supporter);
126-
}
127-
};
128136

129137
/**
130138
* Retrieves donation data from OC

0 commit comments

Comments
 (0)