Skip to content

Check for node version in postinstall script #4657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"test": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.2.6} MONGODB_STORAGE_ENGINE=mmapv1 TESTING=1 jasmine",
"coverage": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=3.2.6} MONGODB_STORAGE_ENGINE=mmapv1 TESTING=1 nyc jasmine",
"start": "node ./bin/parse-server",
"prepublish": "npm run build"
"prepublish": "npm run build",
"postinstall": "node -p 'require(\"./postinstall.js\")()'"
},
"engines": {
"node": ">=6.11.4"
Expand Down
50 changes: 50 additions & 0 deletions postinstall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const pkg = require('./package.json');

const version = parseFloat( process.version.substr(1) );
const minimum = parseFloat( pkg.engines.node.match(/\d+/g).join('.') );

module.exports = function () {
const openCollective = `
1111111111
1111111111111111
1111111111111111111111
11111111111111111111111111
111111111111111 11111111
1111111111111 111111
1111111111111 111111111 111111
111111111111 11111111111 111111
1111111111111 11111111111 111111
1111111111111 1111111111 111111
1111111111111111111111111 1111111
11111111 11111111
111111 1111111111111111111
11111 11111 111111111111111111
11111 11111111111111111
111111 111111111111111111
11111111111111111111111111
1111111111111111111111
111111111111111111
11111111111


Thanks for installing parse 🙏
Please consider donating to our open collective
to help us maintain this package.

👉 https://opencollective.com/parse-server

`;
process.stdout.write(openCollective);
if (version >= minimum) {
process.exit(0);
}

const errorMessage = `
⚠️ parse-server requires at least node@${minimum}!
You have node@${version}

`;

process.stdout.write(errorMessage);
process.exit(1);
};