Mix task to refresh popular_packages.txt#4
Mix task to refresh popular_packages.txt#4adamwight wants to merge 2 commits intoJamesLavin:mainfrom
Conversation
Includes an update to the file demonstrating output. Closes JamesLavin#3
|
Ah too bad—I just realized that |
|
This looks cool, @adamwight. Many thanks for taking time to share this contribution! I'm traveling and visiting family this week. Will be home this weekend and will run this and look carefully then. |
The erlang :json dependency isn't available until OTP 27, but this repo depends on elixir 1.17 so must support any OTP 25+
|
Depends on Jason now. Thanks for the fun project! I plan to use it to collect a few epubs and load them onto a reader, very convenient to have this tool. |
There was a problem hiding this comment.
Could just as well be another subcommand delegated from the main entry point.
| defp build_popular_list() do | ||
| 1..@page_count | ||
| |> Enum.flat_map(&fetch_page/1) | ||
| |> Enum.map(& &1["name"]) |
There was a problem hiding this comment.
I love this task, but should we sort this list before writing it to a file so we don't modify the file just to re-order package names? I'm seeing many pointless "changes." For example:
-credo
bunt
+credo
recon
websock
telemetry_poller
@@ -46,16 +46,16 @@ finch
phoenix_ecto
expo
jose
-nimble_parsec
phoenix_live_view
+nimble_parsec
httpoison
verl
tzdata
tesla
combine
hex_core
-rebar3_hex
phoenix_view
+rebar3_hex
phoenix_live_dashboard
dialyxir
timex
@@ -69,9 +69,9 @@ earmark_parser
makeup_elixir
makeup
joken
-ex_doc
-ex_aws
gen_stage
+ex_aws
+ex_doc
|
|
||
| @base_url "https://hex.pm/api/packages" | ||
| @file_path File.cwd!() <> "/popular_packages.txt" | ||
| @page_count 11 |
There was a problem hiding this comment.
I chose 1,100 packages (@page_count of 11) quite arbitrarily. Seems a reasonable default.
I'll happily merge this PR with a hard-coded value of 11 here, but it would be even better if your Mix task let the caller specify a different value for their personal use. Just an idea. Feel free to ignore.
Includes an update to the file demonstrating output.
Closes #3