Skip to content

Commit

Permalink
installation: Find latest Julia version correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp authored Jan 3, 2024
1 parent 8e8e728 commit 53678c8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ $(
begin
# these special elements will automatically update to read the latest Julia version. See the JavaScript snippet at the bottom of this page to see how it works!

version = html"<auto-julia-version>1.8.2</auto-julia-version>"
pkg_version = html"<auto-julia-version short>1.8</auto-julia-version>"
version = html"<auto-julia-version>1.10.0</auto-julia-version>"
pkg_version = html"<auto-julia-version short>1.10</auto-julia-version>"

nothing
end
Expand Down Expand Up @@ -145,7 +145,8 @@ After working on your notebook (your code is autosaved when you run it), you wil
const run = f => f();
run(async () => {
const versions = await (await fetch(`https://julialang-s3.julialang.org/bin/versions.json`)).json()
const version_names = Object.keys(versions).sort().reverse()
const sortby = v => v.split("-")[0].split(".").map(parseFloat).reduce((a,b) => a*10000 + b)
const version_names = Object.keys(versions).sort((a,b) => sortby(a) - sortby(b)).reverse()
const stable = version_names.find(v => versions[v].stable)
console.log({stable})
const pkg_stable = /\\d+\\.\\d+/.exec(stable)[0]
Expand Down

0 comments on commit 53678c8

Please sign in to comment.