-
-
Save bouyagas/ed8c246f31acfc1409f4fa7fe173d8c0 to your computer and use it in GitHub Desktop.
Node/Npm script to force update project dependencies (command: npm run update:packages)
This file contains hidden or 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
“scripts”: { | |
“update:packages”: “node wipe-dependencies.js && | |
rm -rf node_modules && npm update --save-dev | |
&& npm update --save” | |
}, |
This file contains hidden or 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
var fs = require('fs'), | |
wipeDependencies = function() { | |
var file = fs.readFileSync('package.json'), | |
content = JSON.parse(file); | |
for (var devDep in content.devDependencies) { | |
content.devDependencies[devDep] = '*'; | |
} | |
for (var dep in content.dependencies) { | |
content.dependencies[dep] = '*'; | |
} | |
fs.writeFileSync('package.json', JSON.stringify(content,null,2)); | |
}; | |
if (require.main === module) { | |
wipeDependencies(); | |
} else { | |
module.exports = wipeDependencies; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment