Skip to content
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

Add "version" string and parsed "versionInfo" #1878

Merged
merged 1 commit into from May 27, 2019

Conversation

IvanGoncharov
Copy link
Member

Fixes #1726

@IvanGoncharov IvanGoncharov added the PR: feature 🚀 requires increase of "minor" version number label May 20, 2019
@IvanGoncharov IvanGoncharov assigned mjmahone and unassigned mjmahone May 20, 2019
@IvanGoncharov
Copy link
Member Author

IvanGoncharov commented May 20, 2019

Since 14.0.0 was advertised as a stable release but we plan to release 15.0.0 with some breaking changes. I think some 3rd-party libs/tools will be forced to support both 14.x.x and 15.x.x in the same code base.
For example, graphql-compose supports 0.13.0 and 14.0.0 using ugly version detection hack: https://github.com/graphql-compose/graphql-compose/blob/0ac3cc16948e7dce098705ff1163801d1f284a0a/src/utils/graphqlVersion.js

@mjmahone @Neitsch @nodkz @martijnwalraven Can you please take a look?

assert(
packageJSON.version === require('../dist/version').version,
'Version in package.json and version.js should match',
);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check guarantees that package.json and version.js are always in sync.

const { preReleaseTag } = parseSemver(packageJSON.version);
if (preReleaseTag != null) {
const [tag] = preReleaseTag.split('.');
assert(tag === 'rc', 'Only "rc" tag is supported.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the code had this check before, but I'm just curious why only rc is supported?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martijnwalraven Thanks for the review 👍
It was added to prevent issues similar to #1375
These scripts are run by Travis and package automatically published so I'm trying to use "fail fast" design for them. Especially since I don't have NPM keys to do a manual fix if something goes wrong.
If we decide to use other tags in future it will be a matter of just adding them here.

@martijnwalraven
Copy link
Contributor

This looks great! Really happy it pre-parses the version components so we don't have to do that at runtime.

@nodkz
Copy link
Contributor

nodkz commented May 21, 2019

Looks great! Thanks a lot!

@IvanGoncharov IvanGoncharov merged commit e2fe67e into graphql:master May 27, 2019
@IvanGoncharov
Copy link
Member Author

Thanks for review 👍
Merged 🎉

IvanGoncharov added a commit to IvanGoncharov/graphql-js that referenced this pull request May 27, 2019
Happened because graphql#1878 was authored before '14.3.1' release but merged
after it.
Also add 'npm run build' to CI to prevent simular problems in future
IvanGoncharov added a commit to IvanGoncharov/graphql-js that referenced this pull request May 27, 2019
Happened because graphql#1878 was authored before '14.3.1' release but merged
after it.
Also add 'npm run build' to CI to prevent simular problems in future
IvanGoncharov added a commit that referenced this pull request May 27, 2019
Happened because #1878 was authored before '14.3.1' release but merged
after it.
Also add 'npm run build' to CI to prevent simular problems in future
@IvanGoncharov IvanGoncharov deleted the versionJS branch August 29, 2019 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: feature 🚀 requires increase of "minor" version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export library version number
4 participants