* fixes #144 - do not delete scripts folder if it is not empty * fixes 144 - do not remove scripts forlder if not empty, checking for DS_store file * fixes 144 - do not remove scripts forlder if not empty, checking DS_store is the only remaining file * Update scripts/setupTypeScript.js * Apply suggestions from code review Co-authored-by: Orta Therox <orta.therox+github@gmail.com>
This commit is contained in:
parent
16e4763560
commit
0ed46da681
1 changed files with 12 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue