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

fix: removes --always-auth from npm login #1288

Merged
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
7 changes: 3 additions & 4 deletions src/command/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
13 changes: 3 additions & 10 deletions src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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'.
Expand Down Expand Up @@ -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...");
Expand Down
11 changes: 1 addition & 10 deletions src/npm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down