-
-
Notifications
You must be signed in to change notification settings - Fork 372
check node version on postinstall & while initiating a new project #171
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
Conversation
|
Travis checks are failing because If we update the build on travis, that would fix the tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice @reznord! Thanks for all this 😄
However, how do you feel about going the much simpler route, something like this:
const pkg = require('../../package');
const version = parseFloat( process.version.substr(1) );
const minimum = parseFloat( pkg.engines.node.match(/\d+/g).join('.') );
// ^^ or just hard-code?
if (version >= minimum) {
return true;
}
// uh oh... log & exit|
Either way |
|
@developit Are you opposed to moving this This way, we can let the tests run without doing any fancy side stepping. Currently, this will be fine with downloads since a |
|
Yup, I'm fine with that. Could almost be a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay then, sorry @reznord 😆 😭 few changes:
-
Move
lib/check-engine.jsto root (maybe asversion.jsorcheck.js?) -
Add the new root file to
"files"in package.json -
Update the paths in
scripts&src/index.js
Thank you 🙏
I can take care of this too if you don't have time.
lukeed
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks~!
package.json
Outdated
| "lint": "eslint src tests", | ||
| "pretest": "npm run -s build", | ||
| "postinstall": "node lib/lib/check-engine.js", | ||
| "postinstall": "babel-node check.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't do this. babel-node is in devDeps so it would break user install. How about rewrite check.js with CommonJS modules ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right. Forgot not all babel pkgs are normal deps.
Let's rewrite to ES5 and just use node.
lukeed
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfecto
|
@reznord Your commit message make me laugh :D
And you're using template literal |
Bad time for a commit I'd say :P (2AM) anyways, its all sorted :P |
|
Template literals ftw! 🎉 |
Fixes #169