Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump dependents to newer versions. #15

Merged
merged 8 commits into from
Feb 5, 2023
Merged

Bump dependents to newer versions. #15

merged 8 commits into from
Feb 5, 2023

Conversation

mogeko
Copy link
Collaborator

@mogeko mogeko commented Feb 1, 2023

I plan to bump dependents to newer versions. It seems that Poison has changed the API, so errors can occur. I will update it manually and check it one by one.

Then I'm going to set up GitHub Dependabot, which automatically monitors dependencies and securely updates them.

To-do list:

  • :poison ~> 5.0 (abandon, reason)
  • :dialyxir ~> 1.2
  • :ex_doc ~> 0.27
  • :credo ~> 1.6

To-do list out of this pr (for tracking):

@mogeko mogeko added the dependencies Pull requests that update a dependency file label Feb 1, 2023
Copy link
Owner

@folz folz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plan sounds good, thank you!

@mogeko
Copy link
Collaborator Author

mogeko commented Feb 5, 2023

I gave up bump Poison to version 5.0.

Poison has adjusted the Poison.Decode in this commit.

https://github.com/devinus/poison/blob/282188af948da8460029e5e37ecefbad496fddfd/lib/poison/decoder.ex#L20-L25

They replaced options[:keys] with Map.get(options, :keys), which means that we must use Map instead of Keyword as options. Otherwise, an error will be reported.

iex(1)> Bento.decode("li1e3:twoli3eee")
** (BadMapError) expected a map, got: []
    (elixir 1.14.3) lib/map.ex:534: Map.get([], :as, nil)
    lib/poison/decoder.ex:21: Poison.Decode.transform/2
    (bento 1.0.0-dev) lib/bento.ex:77: Bento.decode/2
    iex:1: (file)

If we want to upgrade to version 5.0 of Poison without breaking changes, we have to use a polyfill like:

def decode(iodata, options \\ []) do
  with {:ok, parsed} <- Parser.parse(iodata) do
    {:ok, Poison.Decode.transform(parsed, Map.new(options))}
  end
end

It's too ugly to accept!

So I decided to pin the version of Poison to 3.1.

On the other hand, I found that we only used the function Poison.Decode.transform/2, and the development of Poison does not seem to be very active. Maybe we can implement it ourselves.

@mogeko mogeko merged commit a739379 into folz:master Feb 5, 2023
@mogeko mogeko deleted the dev branch February 5, 2023 20:08
mogeko added a commit to mogeko/bento that referenced this pull request Feb 5, 2023
I forgot to implement it in PR folz#15.
@mogeko mogeko restored the dev branch February 6, 2023 02:23
@mogeko mogeko deleted the dev branch February 6, 2023 02:26
mogeko added a commit that referenced this pull request Feb 8, 2023
* build: setup GitHub Dependabot

I forgot to implement it in PR #15.

* build(ci): migrate CI from Travis to GitHub Action

* fix(ci): fix a formatting error

See: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrixinclude

* fix(ci): repair compatibility between Elixir & OTP

See: https://hexdocs.pm/elixir/1.14.3/compatibility-and-deprecations.html#compatibility-between-elixir-and-erlang-otp

* build(ci): setup matrix for job `build`

* fix(ci): fix a syntax error

* docs: reset badges in README.md

* build(ci): run benchmark in CI

* build(ci): publish to hex.pm after git tag added

TODO: Need GitHub Action Secrets: `HEX_API_KEY`

* build(ci): setup GitHub Dependabot for GitHub Action

* fix(ci): fix a syntax error

See: https://docs.github.com/en/actions/learn-github-actions/expressions#operators

* fix(ci): only run benchmark manually

See: https://stackoverflow.com/questions/62325286/run-github-actions-when-pull-requests-have-a-specific-label

* build(ci): classify PR through actions/labeler

* build: run dialyzer test in CI

* fix(ci): distinguish the OS version when using cache

* build(ci): more refined control caching

* fix(ci): deps should be needed for job test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants