chore(publish): add --no-fast-check flag (#22203)

This commit is contained in:
Bartek Iwańczuk 2024-01-31 16:10:31 +01:00 committed by GitHub
parent 81042fb875
commit 560390c93c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 34 additions and 6 deletions

View file

@ -301,6 +301,7 @@ pub struct VendorFlags {
pub struct PublishFlags {
pub token: Option<String>,
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"),
});
}

View file

@ -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",

View file

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

View file

@ -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<ImportMap>,
@ -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<Arc<deno_graph::ModuleGraph>, 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,