Skip to content

Commit 0e433fc

Browse files
committed
Read bs-dev-dependencies if --dev was passed.
1 parent f26d5c9 commit 0e433fc

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

rewatch/src/build/packages.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,16 @@ fn read_dependencies(
297297
project_root: &Path,
298298
workspace_root: &Option<PathBuf>,
299299
show_progress: bool,
300+
build_dev_deps: bool,
300301
) -> Vec<Dependency> {
301-
return parent_config
302-
.bs_dependencies
303-
.to_owned()
304-
.unwrap_or_default()
302+
let mut dependencies = parent_config.bs_dependencies.to_owned().unwrap_or_default();
303+
304+
// Concatenate dev dependencies if build_dev_deps is true
305+
if build_dev_deps && let Some(dev_deps) = parent_config.bs_dev_dependencies.to_owned() {
306+
dependencies.extend(dev_deps);
307+
}
308+
309+
dependencies
305310
.iter()
306311
.filter_map(|package_name| {
307312
if registered_dependencies_set.contains(package_name) {
@@ -360,7 +365,8 @@ fn read_dependencies(
360365
&canonical_path,
361366
project_root,
362367
workspace_root,
363-
show_progress
368+
show_progress,
369+
build_dev_deps
364370
);
365371

366372
Dependency {
@@ -371,7 +377,7 @@ fn read_dependencies(
371377
dependencies,
372378
}
373379
})
374-
.collect::<Vec<Dependency>>();
380+
.collect()
375381
}
376382

377383
fn flatten_dependencies(dependencies: Vec<Dependency>) -> Vec<Dependency> {
@@ -461,6 +467,7 @@ fn read_packages(
461467
project_root: &Path,
462468
workspace_root: &Option<PathBuf>,
463469
show_progress: bool,
470+
build_dev_deps: bool,
464471
) -> Result<AHashMap<String, Package>> {
465472
let root_config = read_config(project_root)?;
466473

@@ -477,6 +484,7 @@ fn read_packages(
477484
project_root,
478485
workspace_root,
479486
show_progress,
487+
build_dev_deps,
480488
));
481489
dependencies.iter().for_each(|d| {
482490
if !map.contains_key(&d.name) {
@@ -596,7 +604,7 @@ pub fn make(
596604
show_progress: bool,
597605
build_dev_deps: bool,
598606
) -> Result<AHashMap<String, Package>> {
599-
let map = read_packages(root_folder, workspace_root, show_progress)?;
607+
let map = read_packages(root_folder, workspace_root, show_progress, build_dev_deps)?;
600608

601609
/* Once we have the deduplicated packages, we can add the source files for each - to minimize
602610
* the IO */

0 commit comments

Comments
 (0)