@@ -3,15 +3,18 @@ import { readFile } from "node:fs/promises";
33import { parse } from "./parse.js" ;
44import path , { dirname , normalize } from "node:path/posix" ;
55import { isAbsolute } from "node:path" ;
6- const findAllFilesInGit = async ( ) => {
6+ const findAllFiles = async ( ) => {
77 return await new Promise ( ( resolve , reject ) => {
8- exec ( "git ls-files -z " , ( error , stdout , stderr ) => {
8+ exec ( "find . -mindepth 1 -name node_modules -prune -o -name . git -prune -o -print0 " , ( error , stdout , stderr ) => {
99 if ( error )
1010 reject ( error ) ;
1111 if ( stderr )
12- reject ( new Error ( `git ls-files outputted on stderr: ${ stderr } ` ) ) ;
12+ reject ( new Error ( `'find' outputted on stderr: ${ stderr } ` ) ) ;
1313 else
14- resolve ( stdout . split ( "\0" ) . filter ( Boolean ) ) ;
14+ resolve ( stdout
15+ . split ( "\0" )
16+ . filter ( Boolean )
17+ . map ( ( s ) => s . substring ( 2 ) ) ) ;
1518 } ) ;
1619 } ) ;
1720} ;
@@ -34,7 +37,7 @@ const showError = (filename, sourceLocation, code, message) => {
3437const externalLinkPattern = / ^ \w + : / ;
3538const isExternalLink = ( t ) => externalLinkPattern . test ( t ) ;
3639const main = async ( ) => {
37- const gitFiles = await findAllFilesInGit ( ) ;
40+ const gitFiles = await findAllFiles ( ) ;
3841 // For now, we assume that there are no case clashes
3942 const lowercaseGitFiles = gitFiles . map ( ( s ) => s . toLocaleLowerCase ( ) ) ;
4043 const markdownFilenames = findMarkdownFiles ( gitFiles ) ;
0 commit comments