File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed
Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ npx repodocs https://github.com/user/repo
1717This will:
18181 . Clone the repository
19192 . Find all .md files
20- 3 . Combine them into a single file named ` username__repository-name .txt `
20+ 3 . Combine them into a single file named ` username__repository-name__latestSha__timestamp-YYYY-MM-DD .txt `
21214 . Clean up temporary files
2222
2323Each file in the combined output is separated by:
Original file line number Diff line number Diff line change 77 },
88 "main" : " ./src/index.js" ,
99 "module" : " ./src/index.js" ,
10- "files" : [
11- " src/index.js"
12- ],
10+ "files" : [" src/index.js" ],
1311 "scripts" : {
1412 "build" : " rslib build" ,
1513 "check" : " biome check --write" ,
Original file line number Diff line number Diff line change @@ -103,6 +103,18 @@ function getRepoInfo(url) {
103103 if ( ! match ) throw new Error ( 'Invalid GitHub repository URL' ) ;
104104 return { username : match [ 1 ] , repo : match [ 2 ] } ;
105105}
106+ function getRepoMetadata ( tmpDir ) {
107+ const sha = execSync ( 'git rev-parse --short HEAD' , { cwd : tmpDir } )
108+ . toString ( )
109+ . trim ( ) ;
110+ const date = execSync ( 'git show -s --format=%ci HEAD' , { cwd : tmpDir } )
111+ . toString ( )
112+ . trim ( )
113+ . replace ( / \s + .* $ / , '' ) // Remove timezone
114+ . replace ( / [: -] / g, '' ) ; // Remove separators
115+
116+ return { sha, date } ;
117+ }
106118
107119async function main ( ) {
108120 const repoUrl = process . argv [ 2 ] ;
@@ -115,10 +127,11 @@ async function main() {
115127 try {
116128 const repoInfo = getRepoInfo ( repoUrl ) ;
117129 const tmpDir = await cloneRepo ( repoUrl ) ;
130+ const metadata = getRepoMetadata ( tmpDir ) ;
118131 const mdFiles = await findMarkdownFiles ( tmpDir ) ;
119132 const output = await processFiles ( mdFiles , tmpDir , repoInfo ) ;
120133
121- const outputFile = `${ repoInfo . username } __${ repoInfo . repo } .txt` ;
134+ const outputFile = `${ repoInfo . username } __${ repoInfo . repo } __ ${ metadata . sha } __ ${ metadata . date } .txt` ;
122135 await fs . writeFile ( outputFile , output ) ;
123136 console . log ( `Combined documentation saved to ${ outputFile } ` ) ;
124137
You can’t perform that action at this time.
0 commit comments