diff --git a/baker/SiteBaker.tsx b/baker/SiteBaker.tsx index 60c6a3f5086..eaa194b7fee 100644 --- a/baker/SiteBaker.tsx +++ b/baker/SiteBaker.tsx @@ -779,6 +779,24 @@ export class SiteBaker { this.progressBar.tick({ name: "✅ baked google drive images" }) } + // We don't have an icon for every single tag (yet), but for the icons that we *do* have, + // we want to make sure that we have a corresponding tag in the database. + private async validateTagIcons() { + const allTags = await db + .knexTable("tags") + .select<{ name: string }[]>("name") + const tagNames = new Set(allTags.map((tag) => tag.name)) + const tagIcons = await fs.readdir("public/images/tag-icons") + for (const icon of tagIcons) { + const iconName = icon.split(".")[0] + if (!tagNames.has(iconName)) { + logErrorAndMaybeSendToBugsnag( + `Tag icon "${icon}" does not have a corresponding tag in the database.` + ) + } + } + } + // Bake the static assets private async bakeAssets() { if (!this.bakeSteps.has("assets")) return @@ -793,6 +811,7 @@ export class SiteBaker { await execWrapper( `rm -rf ${this.bakedSiteDir}/assets && cp -r ${BASE_DIR}/dist/assets ${this.bakedSiteDir}/assets` ) + await this.validateTagIcons() await execWrapper( `rsync -hav --delete ${BASE_DIR}/public/* ${this.bakedSiteDir}/ ${excludes}` ) diff --git a/public/images/tag-icons/Age Structure.svg b/public/images/tag-icons/Age Structure.svg new file mode 100644 index 00000000000..016eb0935c7 --- /dev/null +++ b/public/images/tag-icons/Age Structure.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Animal Welfare.svg b/public/images/tag-icons/Animal Welfare.svg new file mode 100644 index 00000000000..07fff56647b --- /dev/null +++ b/public/images/tag-icons/Animal Welfare.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/CO2 & Greenhouse Gas Emissions.svg b/public/images/tag-icons/CO2 & Greenhouse Gas Emissions.svg new file mode 100644 index 00000000000..bd30d636d31 --- /dev/null +++ b/public/images/tag-icons/CO2 & Greenhouse Gas Emissions.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/COVID-19.svg b/public/images/tag-icons/COVID-19.svg new file mode 100644 index 00000000000..bbc6f660ac6 --- /dev/null +++ b/public/images/tag-icons/COVID-19.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Cardiovascular Diseases.svg b/public/images/tag-icons/Cardiovascular Diseases.svg new file mode 100644 index 00000000000..3b480dfddd0 --- /dev/null +++ b/public/images/tag-icons/Cardiovascular Diseases.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Economic Growth.svg b/public/images/tag-icons/Economic Growth.svg new file mode 100644 index 00000000000..133b43fca93 --- /dev/null +++ b/public/images/tag-icons/Economic Growth.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Energy.svg b/public/images/tag-icons/Energy.svg new file mode 100644 index 00000000000..ed866762a8a --- /dev/null +++ b/public/images/tag-icons/Energy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Global Health.svg b/public/images/tag-icons/Global Health.svg new file mode 100644 index 00000000000..e6925c1d627 --- /dev/null +++ b/public/images/tag-icons/Global Health.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Life Expectancy.svg b/public/images/tag-icons/Life Expectancy.svg new file mode 100644 index 00000000000..0c8706d0166 --- /dev/null +++ b/public/images/tag-icons/Life Expectancy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Mental Health.svg b/public/images/tag-icons/Mental Health.svg new file mode 100644 index 00000000000..4c0249d2b39 --- /dev/null +++ b/public/images/tag-icons/Mental Health.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Pandemics.svg b/public/images/tag-icons/Pandemics.svg new file mode 100644 index 00000000000..3c3ebe1c424 --- /dev/null +++ b/public/images/tag-icons/Pandemics.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Plastic Pollution.svg b/public/images/tag-icons/Plastic Pollution.svg new file mode 100644 index 00000000000..9a2e0314e04 --- /dev/null +++ b/public/images/tag-icons/Plastic Pollution.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Population.svg b/public/images/tag-icons/Population.svg new file mode 100644 index 00000000000..9ae5c4efab3 --- /dev/null +++ b/public/images/tag-icons/Population.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Poverty.svg b/public/images/tag-icons/Poverty.svg new file mode 100644 index 00000000000..6a526632d08 --- /dev/null +++ b/public/images/tag-icons/Poverty.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Space Exploration & Satellites.svg b/public/images/tag-icons/Space Exploration & Satellites.svg new file mode 100644 index 00000000000..bce5cdb0e17 --- /dev/null +++ b/public/images/tag-icons/Space Exploration & Satellites.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Terrorism.svg b/public/images/tag-icons/Terrorism.svg new file mode 100644 index 00000000000..fe1c25de8fd --- /dev/null +++ b/public/images/tag-icons/Terrorism.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Tuberculosis.svg b/public/images/tag-icons/Tuberculosis.svg new file mode 100644 index 00000000000..11574cbb6c3 --- /dev/null +++ b/public/images/tag-icons/Tuberculosis.svg @@ -0,0 +1 @@ + \ No newline at end of file