Skip to content

Don't consider versions with build metadata to be unstable #1835

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
Sep 11, 2019
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
23 changes: 2 additions & 21 deletions app/routes/crate/version.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { observer } from '@ember/object';
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import semver from 'semver';

import fetch from 'fetch';
import ajax from 'ember-fetch/ajax';
Expand All @@ -20,27 +21,7 @@ export default Route.extend({
const controller = this.controllerFor(this.routeName);
const maxVersion = crate.get('max_version');

const isUnstableVersion = version => {
const versionLen = version.length;
let majorMinorPatchChars = 0;
let result = false;

for (let i = 0; i < versionLen; i++) {
const char = version.charAt(i);

if (!isNaN(parseInt(char)) || char === '.') {
majorMinorPatchChars++;
} else {
break;
}
}

if (versionLen !== majorMinorPatchChars) {
result = true;
}

return result;
};
const isUnstableVersion = version => !!semver.prerelease(version);

const fetchCrateDocumentation = () => {
if (!crate.get('documentation') || crate.get('documentation').substr(0, 16) === 'https://docs.rs/') {
Expand Down
3 changes: 3 additions & 0 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ module.exports = function(defaults) {
app.import('node_modules/timekeeper/lib/timekeeper.js', {
using: [{ transformation: 'cjs', as: 'timekeeper' }],
});
app.import('node_modules/semver/semver.js', {
using: [{ transformation: 'cjs', as: 'semver' }],
});

return app.toTree();
};
126 changes: 123 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"prettier": "^1.13.4",
"qunit-dom": "^0.8.4",
"sass": "^1.23.0-module.beta.1",
"semver": "^6.3.0",
"timekeeper": "^2.1.0"
},
"engines": {
Expand Down