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

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

Merged
merged 3 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions cli/args/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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),
)
})
}

Expand Down Expand Up @@ -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"),
});
}

Expand Down
7 changes: 7 additions & 0 deletions cli/tests/integration/publish_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions cli/tests/testdata/publish/no_fast_check.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Ensuring type checks...
Check file:https:///[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
21 changes: 15 additions & 6 deletions cli/tools/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand All @@ -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)?,
Expand Down Expand Up @@ -690,6 +692,7 @@ async fn prepare_packages_for_publishing(
module_graph_builder,
type_checker,
cli_options,
no_fast_check,
diagnostics_collector,
&roots,
)
Expand Down Expand Up @@ -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> {
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Loading