(dir, extension)
| 22 | } |
| 23 | |
| 24 | function getFilesInDir(dir, extension) { |
| 25 | let filesList = []; |
| 26 | |
| 27 | const files = fs.readdirSync(dir); |
| 28 | files.forEach(file => { |
| 29 | const fullPath = path.join(dir, file); |
| 30 | const stat = fs.statSync(fullPath); |
| 31 | |
| 32 | if (stat.isFile() && fullPath.endsWith(extension)) { |
| 33 | filesList.push(fullPath); |
| 34 | } |
| 35 | else if (stat.isDirectory()) { |
| 36 | filesList = filesList.concat(getFilesInDir(fullPath, extension)); |
| 37 | } |
| 38 | }); |
| 39 | |
| 40 | return filesList; |
| 41 | } |
| 42 | |
| 43 | function replaceInFile(filePath, searchString, replacement) { |
| 44 | const data = fs.readFileSync(filePath, 'utf-8'); |
no test coverage detected