UNPKG

reinstall-node-modules

Version:

(re)install node modules only if they have changed

18 lines (15 loc) 434 B
const fs = require('fs'); const path = require('path'); /** * Returns parsed JSON of a dedicated config file if it exists * * @param {string} fileName * @returns {Object} */ function getConfigFile(fileName = 'reinstall-node-modules.json') { if (fs.existsSync(path.join(process.cwd(), fileName))) { return JSON.parse(fs.readFileSync(path.join(process.cwd(), fileName))); } return {}; } module.exports = getConfigFile;