Skip to content

Commit 1683ae2

Browse files
fhammerschmidtjfrolich
authored andcommitted
Support rescript.json
1 parent 9ac21aa commit 1683ae2

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/build/packages.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,20 @@ fn get_package_dir(package_name: &str, is_root: bool) -> String {
173173
}
174174

175175
fn read_bsconfig(package_dir: &str) -> bsconfig::T {
176-
if package_dir == "" {
177-
return bsconfig::read("bsconfig.json".to_string());
176+
let prefix = if package_dir == "" {
177+
"".to_string()
178+
} else {
179+
package_dir.to_string() + "/"
180+
};
181+
182+
let rescript_json_path = prefix.to_string() + "rescript.json";
183+
let bsconfig_json_path = prefix.to_string() + "bsconfig.json";
184+
185+
if Path::new(&rescript_json_path).exists() {
186+
bsconfig::read(rescript_json_path)
187+
} else {
188+
bsconfig::read(bsconfig_json_path)
178189
}
179-
bsconfig::read(package_dir.to_string() + "/bsconfig.json")
180190
}
181191

182192
/// # Make Package

0 commit comments

Comments
 (0)