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

Explicitly set Hex package files #283

Merged
merged 1 commit into from
Dec 29, 2023
Merged

Conversation

wojtekmach
Copy link
Contributor

Closes #265

Sanity check:

% mix hex.build --unpack -o pkg
% iex
Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

Interactive Elixir (1.17.0-dev) - press Ctrl+C to exit (type h() ENTER for help)
iex> Mix.install([:req, {:bandit, path: "pkg"}])
iex> {:ok, _} = Bandit.start_link(scheme: :http, plug: fn conn, _ -> Plug.Conn.send_resp(conn, 200, "hi") end)

14:12:40.784 [info] Running #Function<41.105768164/2 in :erl_eval.expr/6> with Bandit 1.1.2 at 0.0.0.0:4000 (http)
iex> Req.get!("http://localhost:4000")
%Req.Response{
  status: 200,
  headers: %{
    "cache-control" => ["max-age=0, private, must-revalidate"],
    "date" => ["Fri, 29 Dec 2023 13:12:40 GMT"],
    "vary" => ["accept-encoding"]
  },
  body: "hi",
  trailers: %{},
  private: %{}
}

Closes mtrudel#265

Sanity check:

    % mix hex.build --unpack -o pkg
    % iex
    Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

    Interactive Elixir (1.17.0-dev) - press Ctrl+C to exit (type h() ENTER for help)
    iex> Mix.install([:req, {:bandit, path: "pkg"}])
    iex> {:ok, _} = Bandit.start_link(scheme: :http, plug: fn conn, _ -> Plug.Conn.send_resp(conn, 200, "hi") end)

    14:12:40.784 [info] Running #Function<41.105768164/2 in :erl_eval.expr/6> with Bandit 1.1.2 at 0.0.0.0:4000 (http)
    iex> Req.get!("http://localhost:4000")
    %Req.Response{
      status: 200,
      headers: %{
        "cache-control" => ["max-age=0, private, must-revalidate"],
        "date" => ["Fri, 29 Dec 2023 13:12:40 GMT"],
        "vary" => ["accept-encoding"]
      },
      body: "hi",
      trailers: %{},
      private: %{}
    }
@@ -16,7 +16,8 @@ defmodule Bandit.MixProject do
package: [
maintainers: ["Mat Trudel"],
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/mtrudel/bandit"}
links: %{"GitHub" => "https://github.com/mtrudel/bandit"},
files: ["lib", "mix.exs", "README*", "LICENSE*", "CHANGELOG*"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This also might be a good idea:

Suggested change
files: ["lib", "mix.exs", "README*", "LICENSE*", "CHANGELOG*"]
files: ["lib", "mix.exs", "*.md"]
% mix hex.build
Building bandit 1.1.2
  Dependencies:
    thousand_island ~> 1.0 (app: thousand_island)
    plug ~> 1.14 (app: plug)
    websock ~> 0.5 (app: websock)
    hpax ~> 0.1.1 (app: hpax)
    telemetry ~> 0.4 or ~> 1.0 (app: telemetry)
  App: bandit
  Name: bandit
  Files:
    lib
    (...)
    mix.exs
    CHANGELOG.md
    CODE_OF_CONDUCT.md
    README.md
    SECURITY.md

@mtrudel
Copy link
Owner

mtrudel commented Dec 29, 2023

I'll take it from the horse's mouth that this is the right way to do it! Thanks @wojtekmach ; I'll be copying this into my other projects as well.

@mtrudel mtrudel merged commit 682cd2c into mtrudel:main Dec 29, 2023
27 checks passed
@mtrudel
Copy link
Owner

mtrudel commented Dec 29, 2023

Oh wait - what about the stuff in assets/; that'll be required to build docs locally, no?

@wojtekmach
Copy link
Contributor Author

assets aren’t used in Hex package. They are present in your local checkout when you run mix docs so it’s all good. :)

@wojtekmach wojtekmach deleted the wm-hex-files branch December 29, 2023 18:26
@wojtekmach
Copy link
Contributor Author

Ah, you can keep the defaults but exclude what you don't need:

exclude_patterns: ~w[priv]

lmk if you want me to send a PR!

@mtrudel
Copy link
Owner

mtrudel commented Jan 24, 2024

Do I need to?

@wojtekmach
Copy link
Contributor Author

Nope, it's fine as is. Just letting you know there's another way, created basically for this scenario, to solve the problem. :)

@mtrudel
Copy link
Owner

mtrudel commented Jan 24, 2024

Got it. I'm going to be passing over my other projects and applying this as needed, so it's great to know.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add CHANGELOG to package files
2 participants