refactor(docs-infra): remove image size exclusion list (#41292)
In #41253 the size of contributor images was limited, but some images were already too large. So an exclusion list was added. These images have now been reduced, so the exclusion list is no longer needed. The files were reduced by a combination of running them through the https://tinyjpg.com/ online service and manually setting their size to 168px wide or tall using the MacOS Image Preview app. PR Close #41292
This commit is contained in:
parent
2548921a19
commit
5bc0a472bd
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// Imports
|
// Imports
|
||||||
const {existsSync, readFileSync, statSync} = require('fs');
|
const {existsSync, readFileSync, statSync} = require('fs');
|
||||||
const {basename, join, resolve} = require('path');
|
const {join, resolve} = require('path');
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
const MAX_IMAGE_SIZE = 30 * 1024; // 30kb
|
const MAX_IMAGE_SIZE = 30 * 1024; // 30kb
|
||||||
|
@ -11,18 +11,6 @@ const IMAGES_DIR = join(CONTENT_DIR, 'images/bios');
|
||||||
const CONTRIBUTORS_PATH = join(CONTENT_DIR, 'marketing/contributors.json');
|
const CONTRIBUTORS_PATH = join(CONTENT_DIR, 'marketing/contributors.json');
|
||||||
const EXISTING_GROUPS = new Set(['Angular', 'GDE', 'Collaborators']);
|
const EXISTING_GROUPS = new Set(['Angular', 'GDE', 'Collaborators']);
|
||||||
|
|
||||||
// The list of profile images that exceed specified `MAX_IMAGE_SIZE` limit.
|
|
||||||
// These images were added before the size check was introduced. Exclude these images
|
|
||||||
// from size check for now, but still check other images (more importantly run the check
|
|
||||||
// for new PRs where profile images are added).
|
|
||||||
const EXCLUDE_FROM_SIZE_CHECK = new Set([
|
|
||||||
'alainchautard.png', 'ahsanayaz.jpg', 'alan-agius4.jpg', 'andrew-kushnir.jpg',
|
|
||||||
'brian-love.jpg', 'cexbrayat.jpg', 'christianliebel.jpg', 'patovargas.png', 'gerardsans.jpg',
|
|
||||||
'jessicajaniuk.jpg', 'JiaLiPassion.jpg', 'juristr.jpg', 'katerina.jpg', 'kimmaida.jpg',
|
|
||||||
'kyliau.jpg', 'lacolaco.jpg', 'leonardo.jpg', 'nirkaufman.jpg', 'sajee.jpg', 'sonukapoor.jpg',
|
|
||||||
'tracylee.jpg', 'twerske.jpg', 'wesgrimes.jpg'
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Run
|
// Run
|
||||||
_main();
|
_main();
|
||||||
|
|
||||||
|
@ -43,9 +31,7 @@ function _main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that there are no images that exceed the size limit.
|
// Check that there are no images that exceed the size limit.
|
||||||
const tooLargeImages = expectedImages
|
const tooLargeImages = expectedImages.filter(path => statSync(path).size > MAX_IMAGE_SIZE);
|
||||||
.filter(path => !EXCLUDE_FROM_SIZE_CHECK.has(basename(path)))
|
|
||||||
.filter(path => statSync(path).size > MAX_IMAGE_SIZE);
|
|
||||||
if (tooLargeImages.length > 0) {
|
if (tooLargeImages.length > 0) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`The following pictures exceed maximum size limit of ${MAX_IMAGE_SIZE / 1024}kb:` +
|
`The following pictures exceed maximum size limit of ${MAX_IMAGE_SIZE / 1024}kb:` +
|
||||||
|
|
Loading…
Reference in New Issue