diff --git a/cli/args/flags.rs b/cli/args/flags.rs index ae63b710c1..3708f0d982 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -301,6 +301,7 @@ pub struct VendorFlags { pub struct PublishFlags { pub token: Option, pub dry_run: bool, + pub no_fast_check: bool, } #[derive(Clone, Debug, Eq, PartialEq)] @@ -2384,6 +2385,12 @@ fn publish_subcommand() -> Command { .help("Prepare the package for publishing performing all checks and validations without uploading") .action(ArgAction::SetTrue), ) + .arg( + Arg::new("no-fast-check") + .long("no-fast-check") + .help("Skip Fast Check compatibility validation") + .action(ArgAction::SetTrue), + ) }) } @@ -3817,6 +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"), }); } diff --git a/cli/tests/integration/publish_tests.rs b/cli/tests/integration/publish_tests.rs index 59486602da..675ceced2e 100644 --- a/cli/tests/integration/publish_tests.rs +++ b/cli/tests/integration/publish_tests.rs @@ -36,6 +36,13 @@ itest!(invalid_fast_check { exit_code: 1, }); +itest!(no_fast_check { + args: "publish --no-fast-check --token 'sadfasdf'", + output: "publish/no_fast_check.out", + cwd: Some("publish/invalid_fast_check"), + exit_code: 1, +}); + itest!(invalid_path { args: "publish --token 'sadfasdf'", output: "publish/invalid_path.out", diff --git a/cli/tests/testdata/publish/no_fast_check.out b/cli/tests/testdata/publish/no_fast_check.out new file mode 100644 index 0000000000..ac26c67c2e --- /dev/null +++ b/cli/tests/testdata/publish/no_fast_check.out @@ -0,0 +1,4 @@ +Ensuring type checks... +Check file:///[WILDCARD]/mod.ts +error: Following packages don't exist, follow the links and create them: + - https://jsr.io/new?scope=foo&package=bar&from=cli diff --git a/cli/tools/registry/mod.rs b/cli/tools/registry/mod.rs index cb43e0df84..5741663484 100644 --- a/cli/tools/registry/mod.rs +++ b/cli/tools/registry/mod.rs @@ -638,6 +638,7 @@ async fn publish_package( async fn prepare_packages_for_publishing( cli_factory: &CliFactory, + no_fast_check: bool, diagnostics_collector: &PublishDiagnosticsCollector, deno_json: ConfigFile, import_map: Arc, @@ -660,6 +661,7 @@ async fn prepare_packages_for_publishing( module_graph_builder, type_checker, cli_options, + no_fast_check, diagnostics_collector, &[MemberRoots { name: get_deno_json_package_name(&deno_json)?, @@ -690,6 +692,7 @@ async fn prepare_packages_for_publishing( module_graph_builder, type_checker, cli_options, + no_fast_check, diagnostics_collector, &roots, ) @@ -734,6 +737,7 @@ async fn build_and_check_graph_for_publish( module_graph_builder: &ModuleGraphBuilder, type_checker: &TypeChecker, cli_options: &CliOptions, + no_fast_check: bool, diagnostics_collector: &PublishDiagnosticsCollector, packages: &[MemberRoots], ) -> Result, deno_core::anyhow::Error> { @@ -756,12 +760,16 @@ async fn build_and_check_graph_for_publish( collect_invalid_external_imports(&graph, diagnostics_collector); - log::info!("Checking fast check type graph for errors..."); - let has_fast_check_diagnostics = collect_fast_check_type_graph_diagnostics( - &graph, - packages, - diagnostics_collector, - ); + let mut has_fast_check_diagnostics = false; + if !no_fast_check { + log::info!("Checking fast check type graph for errors..."); + has_fast_check_diagnostics = collect_fast_check_type_graph_diagnostics( + &graph, + packages, + diagnostics_collector, + ); + } + if !has_fast_check_diagnostics { log::info!("Ensuring type checks..."); let diagnostics = type_checker @@ -820,6 +828,7 @@ pub async fn publish( let (publish_order_graph, prepared_package_by_name) = prepare_packages_for_publishing( &cli_factory, + publish_flags.no_fast_check, &diagnostics_collector, config_file.clone(), import_map,