Skip to content

Commit 3a8c8c4

Browse files
author
Peter Bengtsson
authored
retract deletion of search-XX.svg assets (#24075)
1 parent f94733d commit 3a8c8c4

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

script/find-orphaned-assets.mjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ import path from 'path'
1212
import program from 'commander'
1313
import walk from 'walk-sync'
1414

15+
const EXCEPTIONS = new Set([
16+
// These files are dynamically referenced in Search.tsx
17+
// so they're referred to as `... search-${iconSize}.svg`
18+
'assets/images/octicons/search-16.svg',
19+
'assets/images/octicons/search-24.svg',
20+
])
21+
1522
program
1623
.description('Print all images that are in ./assets/ but not found in any markdown')
1724
.option('-e, --exit', 'Exit script by count of orphans (useful for CI)')
@@ -80,7 +87,7 @@ async function main(opts) {
8087
const content = fs.readFileSync(markdownFile, 'utf-8')
8188
for (const imagePath of allImages) {
8289
const needle = imagePath.split(path.sep).slice(-2).join('/')
83-
if (content.includes(needle)) {
90+
if (content.includes(needle) || EXCEPTIONS.has(imagePath)) {
8491
allImages.delete(imagePath)
8592
}
8693
}

0 commit comments

Comments
 (0)