File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -399,8 +399,12 @@ fn flatten_dependencies(dependencies: Vec<Dependency>) -> Vec<Dependency> {
399
399
pub fn read_package_name ( package_dir : & Path ) -> Result < String > {
400
400
let package_json_path = package_dir. join ( "package.json" ) ;
401
401
402
- let package_json_contents =
403
- fs:: read_to_string ( & package_json_path) . map_err ( |e| anyhow ! ( "Could not read package.json: {}" , e) ) ?;
402
+ let package_json_contents = if Path :: exists ( & package_json_path) {
403
+ fs:: read_to_string ( & package_json_path) . map_err ( |e| anyhow ! ( "Could not read package.json: {}" , e) ) ?
404
+ } else {
405
+ let rescript_json_path = package_dir. join ( "rescript.json" ) ;
406
+ fs:: read_to_string ( & rescript_json_path) . map_err ( |e| anyhow ! ( "Could not read rescript.json: {}" , e) ) ?
407
+ } ;
404
408
405
409
let package_json: serde_json:: Value = serde_json:: from_str ( & package_json_contents)
406
410
. map_err ( |e| anyhow ! ( "Could not parse package.json: {}" , e) ) ?;
You can’t perform that action at this time.
0 commit comments