oranda icon indicating copy to clipboard operation
oranda copied to clipboard

Read oranda config from Cargo and package.json

Open SaraVieira opened this issue 3 years ago • 1 comments

After playing arround with twelf I could not figure out how to get the options from just a part of a file.

In the package.json I just want the oranda key

cc @Gankra

SaraVieira avatar Sep 29 '22 22:09 SaraVieira

axoproject exposes workspace.metadata.* and package.metadata.*

Here are the relevant parts of the code to copy from cargo-dist:

https://github.com/axodotdev/cargo-dist/blob/7ff2861dfd979a74396f7e78d147d4883ceea59a/cargo-dist/src/tasks.rs#L917-L939

https://github.com/axodotdev/cargo-dist/blob/7ff2861dfd979a74396f7e78d147d4883ceea59a/cargo-dist/src/tasks.rs#L2477-L2485

https://github.com/axodotdev/cargo-dist/blob/7ff2861dfd979a74396f7e78d147d4883ceea59a/cargo-dist/src/tasks.rs#L228-L246

Relevant details:

  • parse_metadata_table is just serde_json::deserialize (cuz cargo-metadata transforms the toml to json)
  • merge_workspace_config applies domain-specific rules for combining workspace.* into the specific package config
  • make_relative_to applies the logic that all paths in that config are relative to that file

Gankra avatar May 19 '23 23:05 Gankra