From 8a578a07ce1078aec57c8ac0a775ddacfa433771 Mon Sep 17 00:00:00 2001 From: Alexander Lyon Date: Tue, 6 Feb 2024 02:13:43 +0000 Subject: [PATCH] log a message when encountering empty package names rather than erroring --- .../src/package_graph/builder.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/turborepo-repository/src/package_graph/builder.rs b/crates/turborepo-repository/src/package_graph/builder.rs index 3974405f5a8aea..358a651b30e47c 100644 --- a/crates/turborepo-repository/src/package_graph/builder.rs +++ b/crates/turborepo-repository/src/package_graph/builder.rs @@ -281,7 +281,18 @@ impl<'a, T: PackageDiscovery> BuildState<'a, ResolvedPackageManager, T> { }?; for (path, json) in package_jsons { - self.add_json(path, json)?; + match self.add_json(path, json) { + Ok(()) => {} + Err(Error::PackageJsonMissingName(_)) => { + // previous implementations of turbo would silently ignore package.json files + // that didn't have a name field (well, actually, if two or more had the same + // name, it would throw a 'name clash' error, but that's a different story) + // + // let's try to match that behavior, but log a debug message + tracing::debug!("ignoring package.json at {} since it has no name", &path); + } + Err(err) => return Err(err), + } } let Self {