diff --git a/scripts/setupTypeScript.js b/scripts/setupTypeScript.js index b1257dd..f26d1c5 100644 --- a/scripts/setupTypeScript.js +++ b/scripts/setupTypeScript.js @@ -97,8 +97,18 @@ fs.writeFileSync(tsconfigPath, tsconfig) if (!argv[2]) { // Remove the script fs.unlinkSync(path.join(__filename)) - // Remove the scripts folder - fs.rmdirSync(path.join(__dirname)) + + // Check for Mac's DS_store file, and if it's the only one left remove it + const remainingFiles = fs.readdirSync(path.join(__dirname)) + if (remainingFiles.length === 1 && remainingFiles[0] === '.DS_store') { + fs.unlinkSync(path.join(__dirname, '.DS_store')) + } + + // Check if the scripts folder is empty + if (fs.readdirSync(path.join(__dirname)).length === 0) { + // Remove the scripts folder + fs.rmdirSync(path.join(__dirname)) + } } // Adds the extension recommendation