checkPlugin: Improve readability of `files` assignment

pull/5323/head
Richard Hansen 2021-06-17 17:13:17 -04:00
parent b546867adb
commit b50c6d07d4
1 changed files with 5 additions and 8 deletions

View File

@ -136,17 +136,14 @@ fs.readdir(pluginPath, (err, rootFiles) => {
return console.log(`Unable to scan directory: ${err}`);
}
// rewriting files to lower case
const files = [];
// some files we need to know the actual file name. Not compulsory but might help in the future.
let readMeFileName;
let repository;
for (let i = 0; i < rootFiles.length; i++) {
if (rootFiles[i].toLowerCase().includes('readme')) readMeFileName = rootFiles[i];
files.push(rootFiles[i].toLowerCase());
}
const files = rootFiles.map((f) => {
const fl = f.toLowerCase();
if (fl.includes('readme')) readMeFileName = f;
return fl;
});
if (!files.includes('.git')) throw new Error('No .git folder, aborting');
prepareRepo();