@@ -30,17 +30,17 @@ async function removeTestInfraStructure() {
3030 await updateLaunchJsonFile ( ) ;
3131 // delete this script
3232 await unlinkFileAsync ( "./convertToSingleHost.js" ) ;
33+ await deleteSupportFiles ( ) ;
3334}
3435
3536async function updatePackageJsonFile ( ) {
36- // update package.json to reflect selected host
3737 const packageJson = `./package.json` ;
3838 const data = await readFileAsync ( packageJson , "utf8" ) ;
3939 let content = JSON . parse ( data ) ;
4040
41- // remove scripts that are unrelated to the selected host
41+ // remove scripts that are unrelated to testing or this file
4242 Object . keys ( content . scripts ) . forEach ( function ( key ) {
43- if ( key === "convert-to-single-host" || key === "test" ) {
43+ if ( key === "convert-to-single-host" || key . includes ( "test" ) ) {
4444 delete content . scripts [ key ] ;
4545 }
4646 } ) ;
@@ -68,7 +68,7 @@ async function updateLaunchJsonFile() {
6868function deleteFolder ( folder ) {
6969 try {
7070 if ( fs . existsSync ( folder ) ) {
71- fs . readdirSync ( folder ) . forEach ( function ( file , index ) {
71+ fs . readdirSync ( folder ) . forEach ( function ( file ) {
7272 const curPath = `${ folder } /${ file } ` ;
7373
7474 if ( fs . lstatSync ( curPath ) . isDirectory ( ) ) {
@@ -84,8 +84,17 @@ function deleteFolder(folder) {
8484 }
8585}
8686
87+ async function deleteSupportFiles ( ) {
88+ await unlinkFileAsync ( "CONTRIBUTING.md" ) ;
89+ await unlinkFileAsync ( "LICENSE" ) ;
90+ await unlinkFileAsync ( "README.md" ) ;
91+ await unlinkFileAsync ( "SECURITY.md" ) ;
92+ await unlinkFileAsync ( ".npmrc" ) ;
93+ await unlinkFileAsync ( "package-lock.json" ) ;
94+ }
95+
8796/**
88- * Remove test infrastructure from project.
97+ * Remove test infrastructure and repo support files from project.
8998 */
9099removeTestInfraStructure ( ) . catch ( ( err ) => {
91100 console . error ( `Error: ${ err instanceof Error ? err . message : err } ` ) ;
0 commit comments