Skip to content

Commit

Permalink
fix: package detail version should be a successful build
Browse files Browse the repository at this point in the history
  • Loading branch information
favoyang committed Dec 10, 2019
1 parent c63340d commit b340c0d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions docs/.vuepress/theme/layouts/PackageDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
data-tooltip="Non-semver tags will not be built."
>
Non-semver Tags
<i class="fa fa-info-circle"></i>
</h2>
<p>{{ packageInvalidTagsString }}</p>
</section>
Expand Down Expand Up @@ -171,20 +172,18 @@ export default {
return this.$package.displayName || this.$package.name;
},
packageVersion() {
let releases = this.$data.packageInfo.releases;
if (releases && releases.length) return releases[0].version;
return "";
if (this.currentRelease) return this.currentRelease.rel.version;
else return "-";
},
packagePublishedAt() {
let releases = this.$data.packageInfo.releases;
if (releases && releases.length) {
if (this.currentRelease) {
try {
const date = new Date(releases[0].updatedAt);
const date = new Date(this.currentRelease.rel.updatedAt);
return util.timeAgoFormat(date);
// eslint-disable-next-line no-empty
} catch (error) {}
}
return "";
return "-";
},
packageReleases() {
let releases = this.$data.packageInfo.releases;
Expand Down Expand Up @@ -220,6 +219,12 @@ export default {
}
return [];
},
currentRelease() {
const pkgs = this.packageReleases.filter(
x => x.state == ReleaseState.Succeeded
);
return pkgs.length ? pkgs[0] : null;
},
packageInvalidTags() {
return this.$data.packageInfo.invalidTags || [];
},
Expand Down

0 comments on commit b340c0d

Please sign in to comment.