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
Return error if deploying Meteor runtime to node.js runtime #118
Conversation
var errMessage = 'You are deploying a %s project to a %s runtime. Please select the correct runtime.'; | ||
var minMeteorVersion = parseVersion(Project.supportedVersions.Meteor); | ||
|
||
function parseVersion (str) { |
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.
This should be above where it's being called (line 221)
9090298
to
bfb7ad7
Compare
@franvarney updated |
bfb7ad7
to
2fd8d28
Compare
Return error if deploying an an outdated version of Meteor to the Meteor runtime
*/ | ||
//----------------------------------------------------------------------------- | ||
Project.prototype.detectProjectType = function (path, callback) { | ||
async.waterfall([ |
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.
why is this a waterfall
?
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.
For when we check all other project types. I did this for future reference
deploying to correct runtime.
updated |
* @param {Boolean} Returns boolean | ||
*/ | ||
//----------------------------------------------------------------------------- | ||
Project.prototype.isSupported = function (srcVersion, runtime) { |
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.
Can you add some tests for this? I think I see logic that won't work, would like to confirm:
isSupported('2.0.0', 'Meteor')
// return majorPass && minorPass && patchPass;
return true && false && true; // false
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.
maybe use a module like semver
?
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.
I can add some tests, but Meteor doesn't follow semver. This was discussed when testing the meteor version in the build image.
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.
documenting comments IRL:
even if Meteor is not semver, this function is and should probably be replaced with semver.gte(srcVersion, minVersion)
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.
Replaced custom compatibility check with semver
8955fe4
to
8bc831a
Compare
expect(supported).to.equal(true); | ||
done(); | ||
}); | ||
}); |
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.
add test for 'badly' formatted versions (eg: 1.3.2.4
)
@@ -761,8 +760,31 @@ Project.prototype.detectProjectType = function (path, callback) { | |||
*/ | |||
//----------------------------------------------------------------------------- | |||
Project.prototype.isSupported = function (srcVersion, runtime) { | |||
var imageVersion, majorPass, minorPass, patchPass; |
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.
let's not rewrite semver
, you can use that tested code by just handling the weird edge case for Meteor:
var input = 'METEOR@1.3.2.4'
var srcVersion = input.replace('METEOR@', '')
.split('.')
.slice(0, 3)
.join('.')
// srcVersion === '1.3.2', ready for `semver.gte()`
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.
This might be risky because of the way Meteor does versioning.. it's not semver. :/ I tried doing this in Demeteorizer for a while and had to make changes to the parsing logic to use semver every other Meteor release or so.
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.
If this is risky, what's the best way to do this? Or is this goal not accomplished?
c8c1f38
to
f1b94d0
Compare
f1b94d0
to
6d070f2
Compare
function (files, next) { | ||
if (files.indexOf('.meteor') !== -1) { | ||
fs.readdir(path.join(dir, '.meteor'), next); | ||
} else next('ok', false); |
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.
Why are you passing 'ok' then at line 794 setting err = null
?
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.
short circuit the waterfall
without passing an actual error. i.e.: stop running but don't fail
} | ||
], function (err, result) { | ||
if (err === 'ok') err = null; | ||
callback(err, result); |
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.
Couldn't you just pass null
and ignore err
?
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.
passing null
means the waterfall
calls the next function, this is an escape hatch
👍 |
PR looks ok to me. Maybe @jackboberg could confirm that issues have been addressed. |
👍 all my local tests performed as expected |
I have a meteor 1.2 project that was happily running on modulus as a node.js runtime. Now when I go to deploy it, it's yelling at me about "You are deploying a Meteor project to a Node.js runtime". Is there a way around this? |
@dsjoerg Unfortunately you will have to downgrade your CLI. If you have a Meteor runtime option available, we recommend creating a new project under the Meteor runtime and deploying your source. If you prefer to not go this route, you will need to downgrade your CLI so the |
Thanks @HarlanJ that worked (after I found out how to downgrade CLI, Googling for downgrade meteor CLI gets you nowhere :\ ) |
Closes #117