Skip to content

Commit

Permalink
retract deletion of search-XX.svg assets (github#24075)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbe authored Jan 5, 2022
1 parent f94733d commit 3a8c8c4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions assets/images/octicons/search-16.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/images/octicons/search-24.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion script/find-orphaned-assets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ import path from 'path'
import program from 'commander'
import walk from 'walk-sync'

const EXCEPTIONS = new Set([
// These files are dynamically referenced in Search.tsx
// so they're referred to as `... search-${iconSize}.svg`
'assets/images/octicons/search-16.svg',
'assets/images/octicons/search-24.svg',
])

program
.description('Print all images that are in ./assets/ but not found in any markdown')
.option('-e, --exit', 'Exit script by count of orphans (useful for CI)')
Expand Down Expand Up @@ -80,7 +87,7 @@ async function main(opts) {
const content = fs.readFileSync(markdownFile, 'utf-8')
for (const imagePath of allImages) {
const needle = imagePath.split(path.sep).slice(-2).join('/')
if (content.includes(needle)) {
if (content.includes(needle) || EXCEPTIONS.has(imagePath)) {
allImages.delete(imagePath)
}
}
Expand Down

0 comments on commit 3a8c8c4

Please sign in to comment.