wojtekmach / hex_tar Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Right now hex_tar:create
and hex_tar:unpack
works with the metadata in the following format:
Meta = [
{app, <<"foo">>},
{name, <<"foo">>},
{version, <<"1.0.0">>},
{description, <<"description">>},
{build_tools, <<"rebar3">>},
{files, [<<"foo.erl">>, <<"bar.erl">>]},
{licenses, [<<"Apache 2.0">>]},
{requirements, [
{<<"bar">>,
[
{app, <<"bar">>},
{optional, false},
{requirement, <<"~> 0.1">>}
]
}
]},
{links, {<<"GitHub">>, <<"https://github.com/hexpm/foo">>}}
],
This is almost exactly the same as https://github.com/hexpm/specifications/blob/master/package_metadata.md, the only difference is we use atom keys instead of binary keys as in the spec.
The problem is that it's not quite the same as in either spec or how hex and hexpm uses it. We want to expose a format that will be convenient to use by existing and future tooling, as well as folks playing with the tarballs like in https://github.com/wojtekmach/hex_tar/blob/master/README.md#example.
I think we have these options:
above. Pros: atoms imply "safe" keys, looks nice in Elixir (because keyword)
1.
, except use binaries. Pros: exactly the same as per spec
1.
, except represent requirements as:
[{app, <<"bar">>}, {requirements, #{"foo" => #{app => "foo", ...}}}]
This is what rebar3_hex
does. metadata.config
which is against spec.
maps with atom keys and requirements as:
#{app => "bar", requirements => [#{app => "foo", name => "foo", ...}]}
This is what Mix.Tasks.Hex.prepare_package
returns (and Hex.Tar.create
takes)
above, but with binary keys. This is what Hexpm.Web.ReleaseTar.metadata
returns
maps with atom keys and requirements:
#{app => <<"foo">>, requirements => #{<<"bar">> => #{app => "bar", ...}}}
Pros: I guess closer to spec
The downside of using maps is that they're unordered so we'd need to do extra work to keep them in order when persisting into metadata.config
so that it's reproducible.
I think all options are viable, personally I like 6 the most. Thoughts?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.