From 819ae333d2521b1fab8da6bc1095c1dc57da60c4 Mon Sep 17 00:00:00 2001 From: Esteban Borai Date: Sun, 21 May 2023 14:07:17 -0400 Subject: [PATCH] fix: removes `--always-auth` from `npm login` `npm login` doesn't support `--always-auth` anymore, instead it is under the [`adduser` subcommand][1]. [1]: https://docs.npmjs.com/cli/v6/commands/npm-adduser#always-auth --- src/command/login.rs | 3 +-- src/command/mod.rs | 13 +++---------- src/npm.rs | 11 +---------- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/command/login.rs b/src/command/login.rs index 817ae16..f8053e6 100644 --- a/src/command/login.rs +++ b/src/command/login.rs @@ -6,7 +6,6 @@ use log::info; pub fn login( registry: Option, scope: &Option, - always_auth: bool, auth_type: &Option, ) -> Result<()> { let registry = registry.unwrap_or_else(|| npm::DEFAULT_NPM_REGISTRY.to_string()); @@ -17,7 +16,7 @@ pub fn login( &scope, ®istry, always_auth, &auth_type ); info!("npm info located in the npm debug log"); - npm::npm_login(®istry, &scope, always_auth, &auth_type)?; + npm::npm_login(®istry, &scope, &auth_type)?; info!("Logged you in!"); PBAR.info(&"👋 logged you in!".to_string()); diff --git a/src/command/mod.rs b/src/command/mod.rs index 190e873..631eca7 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -91,12 +91,6 @@ pub enum Command { /// associated with the specified scope. scope: Option, - #[structopt(long = "always-auth", short = "a")] - /// If specified, save configuration indicating that all requests to the - /// given registry should include authorization information. Useful for - /// private registries. Can be used with --registry and / or --scope - always_auth: bool, - #[structopt(long = "auth-type", short = "t")] /// Default: 'legacy'. /// Type: 'legacy', 'sso', 'saml', 'oauth'. @@ -148,15 +142,14 @@ pub fn run_wasm_pack(command: Command) -> Result<()> { Command::Login { registry, scope, - always_auth, auth_type, } => { info!("Running login command..."); info!( - "Registry: {:?}, Scope: {:?}, Always Auth: {}, Auth Type: {:?}", - ®istry, &scope, &always_auth, &auth_type + "Registry: {:?}, Scope: {:?}, Auth Type: {:?}", + ®istry, &scope, &auth_type ); - login(registry, &scope, always_auth, &auth_type) + login(registry, &scope, &auth_type) } Command::Test(test_opts) => { info!("Running test command..."); diff --git a/src/npm.rs b/src/npm.rs index 7c4f08b..9cdadaa 100644 --- a/src/npm.rs +++ b/src/npm.rs @@ -32,22 +32,13 @@ pub fn npm_publish(path: &str, access: Option, tag: Option) -> R } /// Run the `npm login` command. -pub fn npm_login( - registry: &str, - scope: &Option, - always_auth: bool, - auth_type: &Option, -) -> Result<()> { +pub fn npm_login(registry: &str, scope: &Option, auth_type: &Option) -> Result<()> { let mut args = vec!["login".to_string(), format!("--registry={}", registry)]; if let Some(scope) = scope { args.push(format!("--scope={}", scope)); } - if always_auth { - args.push("--always_auth".to_string()); - } - if let Some(auth_type) = auth_type { args.push(format!("--auth_type={}", auth_type)); }