| 12 | var chalk = require('chalk'); |
| 13 | |
| 14 | function checkRequiredFiles(files) { |
| 15 | var currentFilePath; |
| 16 | try { |
| 17 | files.forEach(filePath => { |
| 18 | currentFilePath = filePath; |
| 19 | fs.accessSync(filePath, fs.F_OK); |
| 20 | }); |
| 21 | return true; |
| 22 | } catch (err) { |
| 23 | var dirName = path.dirname(currentFilePath); |
| 24 | var fileName = path.basename(currentFilePath); |
| 25 | console.log(chalk.red('Could not find a required file.')); |
| 26 | console.log(chalk.red(' Name: ') + chalk.cyan(fileName)); |
| 27 | console.log(chalk.red(' Searched in: ') + chalk.cyan(dirName)); |
| 28 | return false; |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | module.exports = checkRequiredFiles; |