Skip to content

Commit

Permalink
Add latest flag to docs_config.js (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdavies authored Oct 3, 2024
1 parent d7a408d commit 2d7c252
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/hexdocs/bucket.ex
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ defmodule Hexdocs.Bucket do
for version <- versions do
%{
version: "v#{version}",
url: Hexdocs.Utils.hexdocs_url(repository, "/#{package}/#{version}")
url: Hexdocs.Utils.hexdocs_url(repository, "/#{package}/#{version}"),
latest: Hexdocs.Utils.latest_version?(package, version, versions)
}
end

Expand Down
6 changes: 4 additions & 2 deletions test/hexdocs/queue_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,13 @@ defmodule Hexdocs.QueueTest do
assert Jason.decode!(json) == [
%{
"url" => "http://localhost/#{URI.encode(Atom.to_string(test))}/3.0.0",
"version" => "v3.0.0"
"version" => "v3.0.0",
"latest" => true
},
%{
"url" => "http://localhost/#{URI.encode(Atom.to_string(test))}/1.0.0",
"version" => "v1.0.0"
"version" => "v1.0.0",
"latest" => false
}
]
end
Expand Down

0 comments on commit 2d7c252

Please sign in to comment.