Skip to content

Commit

Permalink
Added Updated default version to Rustfmt docs config
Browse files Browse the repository at this point in the history
  • Loading branch information
gunadhya authored and calebcartwright committed Jan 21, 2021
1 parent e16d4f3 commit 19b34fe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
</div>
<script>
const RusfmtTagsUrl = 'https://api.github.com/repos/rust-lang/rustfmt/tags';
const RustfmtLatestUrl = 'https://api.github.com/repos/rust-lang/rustfmt/releases/latest';
const UrlHash = window.location.hash.replace(/^#/, '');
const queryParams = new URLSearchParams(window.location.search);
const searchParam = queryParams.get('search');
Expand All @@ -112,6 +113,16 @@
scrolledOnce: false,
},
asyncComputed: {
async updateVersion() {
let latest;
try {
latest = (await axios.get(RustfmtLatestUrl)).data;
} catch(err) {
console.log(err);
return;
}
this.version = latest.name;
},
async outputHtml() {
if (this.version !== this.oldVersion) {
const ConfigurationMdUrl =
Expand Down

0 comments on commit 19b34fe

Please sign in to comment.