Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(publish): rename --no-fast-check to --no-zap #22214

Merged
merged 4 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
David's review
  • Loading branch information
bartlomieju committed Feb 1, 2024
commit 8d745abab8cc20fe1a189bbc1eeb5abf36499517
10 changes: 5 additions & 5 deletions cli/args/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ pub struct VendorFlags {
pub struct PublishFlags {
pub token: Option<String>,
pub dry_run: bool,
pub no_fast_check: bool,
pub no_zap: bool,
}

#[derive(Clone, Debug, Eq, PartialEq)]
Expand Down Expand Up @@ -2386,9 +2386,9 @@ fn publish_subcommand() -> Command {
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("no-fast-check")
.long("no-fast-check")
.help("Skip Fast Check compatibility validation")
Arg::new("no-zap")
.long("no-zap")
.help("Skip Zap compatibility validation")
.action(ArgAction::SetTrue),
)
})
Expand Down Expand Up @@ -3824,7 +3824,7 @@ fn publish_parse(flags: &mut Flags, matches: &mut ArgMatches) {
flags.subcommand = DenoSubcommand::Publish(PublishFlags {
token: matches.remove_one("token"),
dry_run: matches.get_flag("dry-run"),
no_fast_check: matches.get_flag("no-fast-check"),
no_zap: matches.get_flag("no-zap"),
});
}

Expand Down
4 changes: 3 additions & 1 deletion cli/tests/testdata/publish/invalid_fast_check.out
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ error[zap-missing-explicit-return-type]: missing explicit return type in the pub
info: all functions in the public API must have an explicit return type
docs: https://jsr.io/go/zap-missing-explicit-return-type

This package contains Fast Check errors. You can skip Fast Check with --no-fast-check flag.
This package contains Zap errors. Although conforming to Zap will
significantly improve the type checking performance of your library,
you can choose to skip it by providing the --no-zap flag.

error: Found 1 problem
13 changes: 9 additions & 4 deletions cli/tools/registry/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl PublishDiagnosticsCollector {
sources: &dyn ParsedSourceStore,
) -> Result<(), AnyError> {
let mut errors = 0;
let mut has_fast_check_error = false;
let mut has_zap_errors = false;
let diagnostics = self.diagnostics.lock().unwrap().take();
let sources = SourceTextParsedSourceStore(sources);
for diagnostic in diagnostics {
Expand All @@ -45,12 +45,17 @@ impl PublishDiagnosticsCollector {
errors += 1;
}
if matches!(diagnostic, PublishDiagnostic::FastCheck(..)) {
has_fast_check_error = true;
has_zap_errors = true;
}
}
if errors > 0 {
if has_fast_check_error {
eprintln!("This package contains Fast Check errors. You can skip Fast Check with --no-fast-check flag.\n");
if has_zap_errors {
eprintln!(
"This package contains Zap errors. Although conforming to Zap will"
);
eprintln!("significantly improve the type checking performance of your library,");
eprintln!("you can choose to skip it by providing the --no-zap flag.");
eprintln!();
}

Err(anyhow!(
Expand Down
12 changes: 6 additions & 6 deletions cli/tools/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ async fn publish_package(

async fn prepare_packages_for_publishing(
cli_factory: &CliFactory,
no_fast_check: bool,
no_zap: bool,
diagnostics_collector: &PublishDiagnosticsCollector,
deno_json: ConfigFile,
import_map: Arc<ImportMap>,
Expand All @@ -664,7 +664,7 @@ async fn prepare_packages_for_publishing(
module_graph_builder,
type_checker,
cli_options,
no_fast_check,
no_zap,
diagnostics_collector,
&[MemberRoots {
name: get_deno_json_package_name(&deno_json)?,
Expand Down Expand Up @@ -695,7 +695,7 @@ async fn prepare_packages_for_publishing(
module_graph_builder,
type_checker,
cli_options,
no_fast_check,
no_zap,
diagnostics_collector,
&roots,
)
Expand Down Expand Up @@ -740,7 +740,7 @@ async fn build_and_check_graph_for_publish(
module_graph_builder: &ModuleGraphBuilder,
type_checker: &TypeChecker,
cli_options: &CliOptions,
no_fast_check: bool,
no_zap: bool,
diagnostics_collector: &PublishDiagnosticsCollector,
packages: &[MemberRoots],
) -> Result<Arc<deno_graph::ModuleGraph>, deno_core::anyhow::Error> {
Expand All @@ -764,7 +764,7 @@ async fn build_and_check_graph_for_publish(
collect_invalid_external_imports(&graph, diagnostics_collector);

let mut has_fast_check_diagnostics = false;
if !no_fast_check {
if !no_zap {
log::info!("Checking fast check type graph for errors...");
has_fast_check_diagnostics = collect_fast_check_type_graph_diagnostics(
&graph,
Expand Down Expand Up @@ -831,7 +831,7 @@ pub async fn publish(
let (publish_order_graph, prepared_package_by_name) =
prepare_packages_for_publishing(
&cli_factory,
publish_flags.no_fast_check,
publish_flags.no_zap,
&diagnostics_collector,
config_file.clone(),
import_map,
Expand Down
Loading