1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 07:44:48 -05:00

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.
This commit is contained in:
David Sherret 2024-03-11 11:42:12 -04:00 committed by GitHub
parent badb42fc23
commit 644ac0fe43
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;