summaryrefslogtreecommitdiff
path: root/cli/args/flags.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-02-21 08:35:25 -0500
committerGitHub <noreply@github.com>2024-02-21 08:35:25 -0500
commit9166d8a4e9b0f611b1e06c9e339b44f7c450d72e (patch)
tree1c4efed34b9c5bebc1f42fdaa8ad28dcca30896a /cli/args/flags.rs
parent061ee9d38cdf8ff0ade2373c1e075f841c534c47 (diff)
feat(publish): type check on publish (#22506)
Supersedes #22501 and also fixes that issue.
Diffstat (limited to 'cli/args/flags.rs')
-rw-r--r--cli/args/flags.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index 0ce521296..44bb0dde1 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -2394,6 +2394,8 @@ fn publish_subcommand() -> Command {
.help("Allow publishing with slow types")
.action(ArgAction::SetTrue),
)
+ .arg(check_arg(/* type checks by default */ true))
+ .arg(no_check_arg())
})
}
@@ -3823,6 +3825,9 @@ fn vendor_parse(flags: &mut Flags, matches: &mut ArgMatches) {
}
fn publish_parse(flags: &mut Flags, matches: &mut ArgMatches) {
+ flags.type_check_mode = TypeCheckMode::Local; // local by default
+ no_check_arg_parse(flags, matches);
+ check_arg_parse(flags, matches);
config_args_parse(flags, matches);
flags.subcommand = DenoSubcommand::Publish(PublishFlags {
@@ -8542,4 +8547,27 @@ mod tests {
let r = flags_from_vec(svec!["deno", "jupyter", "--install", "--kernel",]);
r.unwrap_err();
}
+
+ #[test]
+ fn publish_args() {
+ let r = flags_from_vec(svec![
+ "deno",
+ "publish",
+ "--dry-run",
+ "--allow-slow-types",
+ "--token=asdf",
+ ]);
+ assert_eq!(
+ r.unwrap(),
+ Flags {
+ subcommand: DenoSubcommand::Publish(PublishFlags {
+ token: Some("asdf".to_string()),
+ dry_run: true,
+ allow_slow_types: true,
+ }),
+ type_check_mode: TypeCheckMode::Local,
+ ..Flags::default()
+ }
+ );
+ }
}