@@ -331,14 +331,14 @@ fn read_dependencies(
331331 let ( config, canonical_path) =
332332 match read_dependency ( package_name, parent_path, project_root, workspace_root) {
333333 Err ( error) => {
334- if show_progress {
335- println ! (
336- "{} {} Error building package tree. {}" ,
337- style( "[1/2]" ) . bold( ) . dim( ) ,
338- CROSS ,
339- error
340- ) ;
341- }
334+ if show_progress {
335+ println ! (
336+ "{} {} Error building package tree. {}" ,
337+ style( "[1/2]" ) . bold( ) . dim( ) ,
338+ CROSS ,
339+ error
340+ ) ;
341+ }
342342
343343 let parent_path_str = parent_path. to_string_lossy ( ) ;
344344 log:: error!(
@@ -356,9 +356,9 @@ fn read_dependencies(
356356 "We could not build package tree '{package_name}', at path '{parent_path_str}'. Error: {error}" ,
357357 ) ;
358358 std:: process:: exit ( 2 )
359- }
360- }
359+ }
361360 }
361+ }
362362 } ;
363363
364364 let is_pinned = parent_config
@@ -374,7 +374,7 @@ fn read_dependencies(
374374 project_root,
375375 workspace_root,
376376 show_progress,
377- build_dev_deps
377+ build_dev_deps,
378378 ) ;
379379
380380 Dependency {
@@ -413,7 +413,13 @@ pub fn read_package_name(package_dir: &Path) -> Result<String> {
413413 . ok_or_else ( || anyhow ! ( "No name field found in package.json" ) )
414414}
415415
416- fn make_package ( config : config:: Config , package_path : & Path , is_pinned_dep : bool , is_root : bool ) -> Package {
416+ fn make_package (
417+ config : config:: Config ,
418+ package_path : & Path ,
419+ is_pinned_dep : bool ,
420+ is_root : bool ,
421+ project_root : & Path ,
422+ ) -> Package {
417423 let source_folders = match config. sources . to_owned ( ) {
418424 Some ( config:: OneOrMore :: Single ( source) ) => get_source_dirs ( source, None ) ,
419425 Some ( config:: OneOrMore :: Multiple ( sources) ) => {
@@ -452,6 +458,11 @@ This inconsistency will cause issues with package resolution.\n",
452458 ) ;
453459 }
454460
461+ let is_local_dep = {
462+ package_path. starts_with ( project_root)
463+ && !package_path. components ( ) . any ( |c| c. as_os_str ( ) == "node_modules" )
464+ } ;
465+
455466 Package {
456467 name : package_name,
457468 config : config. to_owned ( ) ,
@@ -466,7 +477,7 @@ This inconsistency will cause issues with package resolution.\n",
466477 . expect ( "Could not canonicalize" ) ,
467478 dirs : None ,
468479 is_pinned_dep,
469- is_local_dep : !package_path . components ( ) . any ( |c| c . as_os_str ( ) == "node_modules" ) ,
480+ is_local_dep,
470481 is_root,
471482 }
472483}
@@ -481,7 +492,7 @@ fn read_packages(
481492
482493 // Store all packages and completely deduplicate them
483494 let mut map: AHashMap < String , Package > = AHashMap :: new ( ) ;
484- let root_package = make_package ( root_config. to_owned ( ) , project_root, false , true ) ;
495+ let root_package = make_package ( root_config. to_owned ( ) , project_root, false , true , project_root ) ;
485496 map. insert ( root_package. name . to_string ( ) , root_package) ;
486497
487498 let mut registered_dependencies_set: AHashSet < String > = AHashSet :: new ( ) ;
@@ -496,7 +507,7 @@ fn read_packages(
496507 ) ) ;
497508 dependencies. iter ( ) . for_each ( |d| {
498509 if !map. contains_key ( & d. name ) {
499- let package = make_package ( d. config . to_owned ( ) , & d. path , d. is_pinned , false ) ;
510+ let package = make_package ( d. config . to_owned ( ) , & d. path , d. is_pinned , false , project_root ) ;
500511 map. insert ( d. name . to_string ( ) , package) ;
501512 }
502513 } ) ;
0 commit comments