Crates.io | nomad-xyz-configuration |
lib.rs | nomad-xyz-configuration |
version | 0.1.0-rc.1 |
source | src |
created_at | 2022-03-11 19:44:17.876803 |
updated_at | 2022-03-11 19:44:17.876803 |
description | Nomad project configuration file utilities |
homepage | |
repository | https://github.com/nomad-xyz/configuration |
max_upload_size | |
id | 548434 |
size | 110,309 |
This is a crate for working with nomad configuration files. These config files contain information about the state of Nomad deployments.
It also includes an auto-generated TS/WASM library.
The core library is mostly a JSON config file format. We define Rust structs and TS types for all parts of this config.
In TS, the object is a native JS object. It is not a reference to a wasm type.
Assignment and access can be done as normal. However, we have also exported
functions that perform consistency-critical operations like addNetwork
and
addCore
. We strongly recommend using these instead of assigning to the
relevant sections.
import * as configuration from "@nomad-xyz/configuration"
const config = configuration.getBuiltin("production")
console.log(`Environment: ${config.environment}`)
// TODO
$ cargo build
To build the wasm library:
$ ./package-it.sh
wasm-pack
docs are found here.
$ cargo test
$ cargo docs --open
$ cargo publish
$ ./publish_it.sh
To work around some wasm-bindgen
limitations, we currently (unfortunately)
have to manually define TS types for the rust structs. These are found in the
data
directory. When a rust struct is updated or added, the corresponding
definitions should be added in data/definitions.ts
and data/types.rs
. At
compile-time these files are combind to src/wasm/types.rs
.
In the future it'd be cool to auto-generate this code :)