diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-03-11 11:42:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-11 11:42:12 -0400 |
commit | 644ac0fe4331333b994b34780f8207278ad733ff (patch) | |
tree | afbb4a9bd9a09f4702b9819fc5d346f869a6a151 /cli/tools/registry/mod.rs | |
parent | badb42fc23d45f9300052a45210cdab0415513ce (diff) |
chore: hidden tool for overwriting files with fast check output (#22822)
Not sure if we should do this, but it's a nice hidden tool that
overwrites the working tree with the fast check output.
Diffstat (limited to 'cli/tools/registry/mod.rs')
-rw-r--r-- | cli/tools/registry/mod.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cli/tools/registry/mod.rs b/cli/tools/registry/mod.rs index 7efc45dcd..b35f903c1 100644 --- a/cli/tools/registry/mod.rs +++ b/cli/tools/registry/mod.rs @@ -837,6 +837,27 @@ async fn build_and_check_graph_for_publish( colors::yellow("Warning"), ); Ok(Arc::new(graph)) + } else if std::env::var("DENO_INTERNAL_FAST_CHECK_OVERWRITE").is_ok() { + if check_if_git_repo_dirty(cli_options.initial_cwd()).await { + bail!("When using DENO_INTERNAL_FAST_CHECK_OVERWRITE, the git repo must be in a clean state."); + } + + for module in graph.modules() { + if module.specifier().scheme() != "file" { + continue; + } + let Some(js) = module.js() else { + continue; + }; + if let Some(module) = js.fast_check_module() { + std::fs::write( + js.specifier.to_file_path().unwrap(), + module.source.as_ref(), + )?; + } + } + + bail!("Exiting due to DENO_INTERNAL_FAST_CHECK_OVERWRITE") } else { log::info!("Checking for slow types in the public API..."); let mut any_pkg_had_diagnostics = false; |