Use login instead of adduser

master
Jan Willem Henckel 7 years ago
parent d665ef3a3a
commit 8f77a59190
  1. 16
      src/command.rs
  2. 6
      src/npm.rs

@ -32,9 +32,9 @@ pub enum Command {
/// 🎆 pack up your npm package and publish! [NOT IMPLEMENTED]
Publish { path: Option<String> },
#[structopt(name = "adduser", alias = "login", alias = "add-user")]
/// 👤 Add a registry user account! [NOT IMPLEMENTED]
Adduser {
#[structopt(name = "login", alias = "adduser", alias = "add-user")]
/// 👤 Add a registry user account! (aliases: adduser, add-user) [NOT IMPLEMENTED]
Login {
#[structopt(long = "registry", short = "r")]
/// Default: 'https://registry.npmjs.org/'.
/// The base URL of the npm package registry. If scope is also specified, this registry will only be used for packages with that scope. scope defaults to the scope of the project directory you're currently in, if any.
@ -64,12 +64,12 @@ pub fn run_wasm_pack(command: Command) -> result::Result<(), Error> {
Command::Init { path, scope } => init(path, scope),
Command::Pack { path } => pack(path),
Command::Publish { path } => publish(path),
Command::Adduser {
Command::Login {
registry,
scope,
always_auth,
auth_type,
} => adduser(registry, scope, always_auth, auth_type),
} => login(registry, scope, always_auth, auth_type),
};
match status {
@ -146,15 +146,15 @@ fn publish(path: Option<String>) -> result::Result<(), Error> {
Ok(())
}
fn adduser(
fn login(
registry: Option<String>,
scope: Option<String>,
always_auth: bool,
auth_type: Option<String>,
) -> result::Result<(), Error> {
npm::npm_adduser(registry, scope, always_auth, auth_type)?;
npm::npm_login(registry, scope, always_auth, auth_type)?;
PBAR.one_off_message("👋 added registry user account!");
PBAR.one_off_message("👋 logged you in!");
Ok(())
}

@ -29,7 +29,7 @@ pub fn npm_publish(path: &str) -> Result<(), Error> {
}
}
pub fn npm_adduser(
pub fn npm_login(
registry: Option<String>,
scope: Option<String>,
always_auth: bool,
@ -52,10 +52,10 @@ pub fn npm_adduser(
args.push_str(&format!(" --auth_type={}", auth_type))
}
let status = Command::new("npm").arg("adduser").arg(args).status()?;
let status = Command::new("npm").arg("login").arg(args).status()?;
if !status.success() {
bail!("Adding registry user account failed");
bail!("Registry user account login failed");
} else {
Ok(())
}

Loading…
Cancel
Save