Skip to content

Instantly share code, notes, and snippets.

@nilz3ro
Last active December 14, 2015 16:36
Show Gist options
  • Save nilz3ro/38ac76ad2cb88e0a3cd3 to your computer and use it in GitHub Desktop.
Save nilz3ro/38ac76ad2cb88e0a3cd3 to your computer and use it in GitHub Desktop.
npm-scripts compatible way to exit if you are not using the supported node version for your project.
(function() {
var message = '';
var exitCode = 0;
var supportedNodeVersion = 'v0.10.36';
if(process.version === supportedNodeVersion) {
message = 'You are using the supported node version for this project, Continuing.';
}
else {
message = 'You must use node v0.10.36 while developing this project. Exiting.';
exitCode = 1;
}
console.log(message);
process.exit(exitCode);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment