@@ -20,7 +20,7 @@ const EXCEPTIONS = new Set([
2020] )
2121
2222program
23- . description ( 'Print all images that are in ./assets/ but not found in any markdown ' )
23+ . description ( 'Print all images that are in ./assets/ but not found in any source files ' )
2424 . option ( '-e, --exit' , 'Exit script by count of orphans (useful for CI)' )
2525 . option ( '-v, --verbose' , 'Verbose outputs' )
2626 . option ( '--json' , 'Output in JSON format' )
@@ -83,8 +83,8 @@ async function main(opts) {
8383
8484 verbose && console . log ( `${ allImages . size . toLocaleString ( ) } images found in total.` )
8585
86- for ( const markdownFile of sourceFiles ) {
87- const content = fs . readFileSync ( markdownFile , 'utf-8' )
86+ for ( const sourceFile of sourceFiles ) {
87+ const content = fs . readFileSync ( sourceFile , 'utf-8' )
8888 for ( const imagePath of allImages ) {
8989 const needle = imagePath . split ( path . sep ) . slice ( - 2 ) . join ( '/' )
9090 if ( content . includes ( needle ) || EXCEPTIONS . has ( imagePath ) ) {
@@ -94,7 +94,7 @@ async function main(opts) {
9494 }
9595
9696 if ( verbose && allImages . size ) {
97- console . log ( 'The following files are not mentioned anywhere in any Markdown file' )
97+ console . log ( 'The following files are not mentioned anywhere in any source file' )
9898 }
9999 if ( json ) {
100100 console . log ( JSON . stringify ( [ ...allImages ] , undefined , 2 ) )
0 commit comments