Merge pull request #1288 from EstebanBorai/fix/remove-always-auth-from-npm-login

fix: removes `--always-auth` from `npm login`
master
Jesper Håkansson 2 years ago committed by GitHub
commit 1fd2cd2b1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/command/login.rs
  2. 13
      src/command/mod.rs
  3. 11
      src/npm.rs

@ -6,18 +6,17 @@ use log::info;
pub fn login(
registry: Option<String>,
scope: &Option<String>,
always_auth: bool,
auth_type: &Option<String>,
) -> Result<()> {
let registry = registry.unwrap_or_else(|| npm::DEFAULT_NPM_REGISTRY.to_string());
info!("Logging in to npm...");
info!(
"Scope: {:?} Registry: {}, Always Auth: {}, Auth Type: {:?}.",
&scope, &registry, always_auth, &auth_type
"Scope: {:?} Registry: {}, Auth Type: {:?}.",
&scope, &registry, &auth_type
);
info!("npm info located in the npm debug log");
npm::npm_login(&registry, &scope, always_auth, &auth_type)?;
npm::npm_login(&registry, &scope, &auth_type)?;
info!("Logged you in!");
PBAR.info(&"👋 logged you in!".to_string());

@ -91,12 +91,6 @@ pub enum Command {
/// associated with the specified scope.
scope: Option<String>,
#[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: {:?}",
&registry, &scope, &always_auth, &auth_type
"Registry: {:?}, Scope: {:?}, Auth Type: {:?}",
&registry, &scope, &auth_type
);
login(registry, &scope, always_auth, &auth_type)
login(registry, &scope, &auth_type)
}
Command::Test(test_opts) => {
info!("Running test command...");

@ -32,22 +32,13 @@ pub fn npm_publish(path: &str, access: Option<Access>, tag: Option<String>) -> R
}
/// Run the `npm login` command.
pub fn npm_login(
registry: &str,
scope: &Option<String>,
always_auth: bool,
auth_type: &Option<String>,
) -> Result<()> {
pub fn npm_login(registry: &str, scope: &Option<String>, auth_type: &Option<String>) -> 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));
}

Loading…
Cancel
Save