File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ function RandomizeNames() {
3939 fs . writeFileSync ( astroFile , fileContent , "utf-8" ) ;
4040 }
4141}
42+
4243function FindAstroFiles ( dir : string ) : string [ ] {
4344 let results : string [ ] = [ ] ;
4445 const list = fs . readdirSync ( dir ) ;
@@ -65,6 +66,18 @@ function Revert() {
6566 path . join ( pagesDir , `${ oldPath . replace ( "/" , "" ) } .astro` ) ,
6667 ) ;
6768 }
69+
70+ const AstroFiles = FindAstroFiles ( process . cwd ( ) ) ;
71+ for ( const astroFile of AstroFiles ) {
72+ let fileContent = fs . readFileSync ( astroFile , "utf-8" ) ;
73+
74+ for ( const [ oldName , newName ] of Object . entries ( RenamedFiles ) ) {
75+ const regex = new RegExp ( `"${ newName } "` , "g" ) ;
76+ fileContent = fileContent . replace ( regex , `"${ oldName } "` ) ;
77+ }
78+
79+ fs . writeFileSync ( astroFile , fileContent , "utf-8" ) ;
80+ }
6881}
6982
7083const port = Number . parseInt ( process . env . PORT as string ) || inConfig . port || 8080 ;
You can’t perform that action at this time.
0 commit comments