diff --git a/Cargo.toml b/Cargo.toml index 547f21f56..df5d78966 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,3 @@ [workspace] -members = ["config", "macros", "ts-rs", "example"] +members = ["macros", "ts-rs", "example"] resolver = "2" diff --git a/README.md b/README.md index 43c3c1e25..fa77842c8 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ We recommend doing this in your tests. ### get started ```toml [dependencies] -ts-rs = "8.0" +ts-rs = "8.1" ``` ```rust diff --git a/config/Cargo.toml b/config/Cargo.toml deleted file mode 100644 index 72af9577d..000000000 --- a/config/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "ts-rs-config" -version = "5.1.0" -edition = "2021" - -[dependencies] -serde = { version = "1", features = ["derive"] } -toml = "0.5" -anyhow = "1" -once_cell = "1.8" \ No newline at end of file diff --git a/config/README.md b/config/README.md deleted file mode 100644 index 25ce33371..000000000 --- a/config/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# ts-rs-config -This crate contains the config for future ts-rs versions. -Currently, it's not really possible no use the config within the proc macro due to issues regarding incremental compilation. -A workaround would be to have `include_str!("ts.toml")` everywhere, but I don't think we should do that. -Instead, let's wait for https://github.com/rust-lang/rust/issues/73921 \ No newline at end of file diff --git a/config/src/lib.rs b/config/src/lib.rs deleted file mode 100644 index 50b86d97e..000000000 --- a/config/src/lib.rs +++ /dev/null @@ -1,62 +0,0 @@ -use std::{ - path::{Path, PathBuf}, - sync::Arc, -}; - -use anyhow::Result; -use once_cell::sync::OnceCell; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize)] -pub struct Config { - ambient_declarations: bool, - out_dir: String, -} - -impl Default for Config { - fn default() -> Self { - Self { - ambient_declarations: false, - out_dir: "typescript".to_owned(), - } - } -} - -static CONFIG_INSTANCE: OnceCell> = OnceCell::new(); - -impl Config { - const FILE_NAME: &'static str = "ts.toml"; - - pub fn get() -> Result> { - match CONFIG_INSTANCE.get() { - None => { - let cfg = Arc::new(Self::load()?); - CONFIG_INSTANCE.set(cfg.clone()).ok(); - Ok(cfg) - } - Some(cfg) => Ok(cfg.clone()), - } - } - - fn load() -> Result { - let manifest_dir = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR")?); - let config = Self::try_load_from_dir(&manifest_dir)?.unwrap_or_default(); - Ok(config) - } - - fn try_load_from_dir(dir: &Path) -> Result> { - let path = { - let mut path = PathBuf::from(dir); - path.push(Self::FILE_NAME); - path - }; - match path.is_file() { - true => { - let content = std::fs::read_to_string(path)?; - let parsed = toml::from_str::(&content)?; - Ok(Some(parsed)) - } - false => Ok(None), - } - } -} diff --git a/macros/Cargo.toml b/macros/Cargo.toml index a6cb27ebc..921ddcc8d 100644 --- a/macros/Cargo.toml +++ b/macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ts-rs-macros" -version = "8.0.0" +version = "8.1.0" authors = ["Moritz Bischof "] edition = "2021" description = "derive macro for ts-rs" diff --git a/ts-rs/Cargo.toml b/ts-rs/Cargo.toml index e649523f1..9f36e22f0 100644 --- a/ts-rs/Cargo.toml +++ b/ts-rs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ts-rs" -version = "8.0.0" +version = "8.1.0" authors = ["Moritz Bischof "] edition = "2021" license = "MIT" @@ -40,7 +40,7 @@ chrono = { version = "0.4", features = ["serde"] } [dependencies] heapless = { version = ">= 0.7, < 0.9", optional = true } -ts-rs-macros = { version = "=8.0.0", path = "../macros" } +ts-rs-macros = { version = "=8.1.0", path = "../macros" } dprint-plugin-typescript = { version = "0.89", optional = true } chrono = { version = "0.4", optional = true } bigdecimal = { version = ">= 0.0.13, < 0.5", features = [ diff --git a/ts-rs/src/lib.rs b/ts-rs/src/lib.rs index 8b8cda087..5f6827a99 100644 --- a/ts-rs/src/lib.rs +++ b/ts-rs/src/lib.rs @@ -40,7 +40,7 @@ //! ## get started //! ```toml //! [dependencies] -//! ts-rs = "8.0" +//! ts-rs = "8.1" //! ``` //! //! ```rust