diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-03-07 11:30:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-07 17:30:30 +0100 |
commit | 594d8397ad46a90389bec9a76afde1bc7f1fa35b (patch) | |
tree | 9238e775513197042429fd9340cdc9bf792e7cd7 /cli/tools | |
parent | 87a08fc3b2d0ed1e5a197628fa7091cb656c9058 (diff) |
fix(publish): properly display graph validation errors (#22775)
The graph validation errors were displaying cryptically during publish.
This fixes that.
Diffstat (limited to 'cli/tools')
-rw-r--r-- | cli/tools/bench/mod.rs | 15 | ||||
-rw-r--r-- | cli/tools/lint/mod.rs | 4 | ||||
-rw-r--r-- | cli/tools/registry/mod.rs | 6 | ||||
-rw-r--r-- | cli/tools/test/mod.rs | 13 |
4 files changed, 16 insertions, 22 deletions
diff --git a/cli/tools/bench/mod.rs b/cli/tools/bench/mod.rs index 2f0d59f49..43b7103cd 100644 --- a/cli/tools/bench/mod.rs +++ b/cli/tools/bench/mod.rs @@ -7,7 +7,6 @@ use crate::colors; use crate::display::write_json_to_stdout; use crate::factory::CliFactory; use crate::factory::CliFactoryBuilder; -use crate::graph_util::graph_valid_with_cli_options; use crate::graph_util::has_graph_root_local_dependent_changed; use crate::module_loader::ModuleLoadPreparer; use crate::ops; @@ -526,14 +525,10 @@ pub async fn run_benchmarks_with_watch( Permissions::from_options(&cli_options.permissions_options())?; let graph = module_graph_creator - .create_graph(graph_kind, bench_modules.clone()) + .create_graph(graph_kind, bench_modules) .await?; - graph_valid_with_cli_options( - &graph, - factory.fs().as_ref(), - &bench_modules, - cli_options, - )?; + module_graph_creator.graph_valid(&graph)?; + let bench_modules = &graph.roots; let bench_modules_to_reload = if let Some(changed_paths) = changed_paths { @@ -542,7 +537,7 @@ pub async fn run_benchmarks_with_watch( for bench_module_specifier in bench_modules { if has_graph_root_local_dependent_changed( &graph, - &bench_module_specifier, + bench_module_specifier, &changed_paths, ) { result.push(bench_module_specifier.clone()); @@ -556,7 +551,7 @@ pub async fn run_benchmarks_with_watch( let worker_factory = Arc::new(factory.create_cli_main_worker_factory().await?); - // todo(THIS PR): why are we collecting specifiers twice in a row? + // todo(dsherret): why are we collecting specifiers twice in a row? // Seems like a perf bug. let specifiers = collect_specifiers(bench_options.files, is_supported_bench_path)? diff --git a/cli/tools/lint/mod.rs b/cli/tools/lint/mod.rs index 1240b391f..ee7350fb4 100644 --- a/cli/tools/lint/mod.rs +++ b/cli/tools/lint/mod.rs @@ -184,7 +184,9 @@ async fn lint_files( .filter_map(|p| ModuleSpecifier::from_file_path(p).ok()) .collect::<HashSet<_>>(); futures.push(deno_core::unsync::spawn(async move { - let graph = module_graph_creator.create_publish_graph(&members).await?; + let graph = module_graph_creator + .create_and_validate_publish_graph(&members, true) + .await?; // todo(dsherret): this isn't exactly correct as linting isn't properly // setup to handle workspaces. Iterating over the workspace members // should be done at a higher level because it also needs to take into diff --git a/cli/tools/registry/mod.rs b/cli/tools/registry/mod.rs index 9c670ebc1..7b940592f 100644 --- a/cli/tools/registry/mod.rs +++ b/cli/tools/registry/mod.rs @@ -812,8 +812,10 @@ async fn build_and_check_graph_for_publish( diagnostics_collector: &PublishDiagnosticsCollector, packages: &[WorkspaceMemberConfig], ) -> Result<Arc<deno_graph::ModuleGraph>, deno_core::anyhow::Error> { - let graph = module_graph_creator.create_publish_graph(packages).await?; - graph.valid()?; + let build_fast_check_graph = !allow_slow_types; + let graph = module_graph_creator + .create_and_validate_publish_graph(packages, build_fast_check_graph) + .await?; // todo(dsherret): move to lint rule collect_invalid_external_imports(&graph, diagnostics_collector); diff --git a/cli/tools/test/mod.rs b/cli/tools/test/mod.rs index eb0cdd4ce..13cf9f774 100644 --- a/cli/tools/test/mod.rs +++ b/cli/tools/test/mod.rs @@ -10,7 +10,6 @@ use crate::factory::CliFactory; use crate::factory::CliFactoryBuilder; use crate::file_fetcher::File; use crate::file_fetcher::FileFetcher; -use crate::graph_util::graph_valid_with_cli_options; use crate::graph_util::has_graph_root_local_dependent_changed; use crate::module_loader::ModuleLoadPreparer; use crate::ops; @@ -1612,14 +1611,10 @@ pub async fn run_tests_with_watch( let permissions = Permissions::from_options(&cli_options.permissions_options())?; let graph = module_graph_creator - .create_graph(graph_kind, test_modules.clone()) + .create_graph(graph_kind, test_modules) .await?; - graph_valid_with_cli_options( - &graph, - factory.fs().as_ref(), - &test_modules, - &cli_options, - )?; + module_graph_creator.graph_valid(&graph)?; + let test_modules = &graph.roots; let test_modules_to_reload = if let Some(changed_paths) = changed_paths { @@ -1628,7 +1623,7 @@ pub async fn run_tests_with_watch( for test_module_specifier in test_modules { if has_graph_root_local_dependent_changed( &graph, - &test_module_specifier, + test_module_specifier, &changed_paths, ) { result.push(test_module_specifier.clone()); |