-
-
Notifications
You must be signed in to change notification settings - Fork 802
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
Add export package info command #4298
base: main
Are you sure you want to change the base?
Conversation
8db0fdd
to
e858ca1
Compare
d2d59b7
to
0d0f3df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful, thank you!
Let's make it always render all the fields, even if they are the defaults. This will make it easier to understand what all the fields are.
It would also be good to have some round-trip tests, to ensure that a config file serialised and then deserialise doesn't have a bug that results in data-loss.
source: compiler-core/src/config.rs | ||
expression: json | ||
--- | ||
{"name":"my_project","version":"1.0.0","gleam":">= 0.30.0","licences":["Apache-2.0","MIT"],"description":"Pretty complex config","documentation":{"pages":[{"title":"My Page","path":"my-page.html","source":"./path/to/my-page.md"}]},"dependencies":{"my_other_project":{"path":"../my_other_project"},"gleam_stdlib":{"version":">= 0.18.0 and < 2.0.0"}},"dev-dependencies":{"gleeunit":{"version":">= 1.0.0 and < 2.0.0"}},"repository":{"type":"github","user":"example","repo":"my_dep"},"links":[{"title":"Home page","href":"https://example.com/"}],"erlang":{"application_start_module":"my_app/application","extra_applications":["inets","ssl"]},"javascript":{"typescript_declarations":true,"runtime":"nodejs","deno":{"allow_env":["DATABASE_URL"],"allow_net":["example.com:443"],"allow_ffi":true,"allow_read":["./database.sqlite"]}},"internal_modules":["my_app/internal"]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include the toml in the snapshot and pretty print the JSON 🙏
See the other snapshot for examples of how we format them with both the input and the output
)] | ||
// gleam version field in Hex format (for [de]serialization purposes) | ||
pub gleam: Option<version::Range>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be part of the gleam_version
field rather than a second one. They are tightly coupled as being two representations of the same thing, so it is invalid to have one without the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, this was bothering me
gleam_version_constraint format was that of pubgrub's. Now it's hex's.
d617496
to
bac0155
Compare
Closes #4240
Serialize
trait toPackageConfig
and all types it depends on.gleam export package-info --out [out]
commandgleam export package-interface
format forgleam_version_constraint
, which was being exported like:"gleam-version-constraint":"1.8.0 <= v"
because it relied on pubgrub. Now it uses hexpm format and emits>= 1.8.0
.Notice that now
PackageConfig
hasgleam
, which is a 1:1 field for the gleam.toml field and is serializable, andgleam_version
, which is still used as it used to, but it's skipped on serialization.