From edebcd632e2b61aa0011487503ade6a2f0ae53f0 Mon Sep 17 00:00:00 2001 From: Florian Hammerschmidt Date: Thu, 12 Oct 2023 10:45:24 +0200 Subject: [PATCH] Support rescript.json --- src/build/packages.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/build/packages.rs b/src/build/packages.rs index afdf2ab..9e97dfa 100644 --- a/src/build/packages.rs +++ b/src/build/packages.rs @@ -173,10 +173,20 @@ fn get_package_dir(package_name: &str, is_root: bool) -> String { } fn read_bsconfig(package_dir: &str) -> bsconfig::T { - if package_dir == "" { - return bsconfig::read("bsconfig.json".to_string()); + let prefix = if package_dir == "" { + "".to_string() + } else { + package_dir.to_string() + "/" + }; + + let rescript_json_path = prefix.to_string() + "rescript.json"; + let bsconfig_json_path = prefix.to_string() + "bsconfig.json"; + + if Path::new(&rescript_json_path).exists() { + bsconfig::read(rescript_json_path) + } else { + bsconfig::read(bsconfig_json_path) } - bsconfig::read(package_dir.to_string() + "/bsconfig.json") } /// # Make Package