-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #161 Build fails when there are no files in the static folder
- Loading branch information
Showing
2 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const fs = require('fs'); | ||
|
||
const folderPath = 'src/main/resources/static'; | ||
const regExpPattern = '(^.?|\.[^d]|[^.]d|[^.][^d])\.tsx?$'; | ||
|
||
function checkFilesRecursively(folderPath) { | ||
const files = fs.readdirSync(folderPath); | ||
for (const file of files) { | ||
const filePath = `${folderPath}/${file}`; | ||
if (fs.lstatSync(filePath).isDirectory()) { | ||
const found = checkFilesRecursively(filePath); | ||
if (found) { | ||
return true; // Exit with code 0 if a matching file is found | ||
} | ||
} else if (file.match(regExpPattern)) { | ||
return true; // Exit with code 0 if a matching file is found | ||
} | ||
} | ||
return false; // No matching files found in this directory | ||
} | ||
|
||
if (checkFilesRecursively(folderPath)) { | ||
process.exit(0); | ||
} else { | ||
process.exit(1); | ||
} |