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

Non-interactive login #3505

Closed
LandonSchropp opened this issue May 25, 2017 · 3 comments
Closed

Non-interactive login #3505

LandonSchropp opened this issue May 25, 2017 · 3 comments

Comments

@LandonSchropp
Copy link

Do you want to request a feature or report a bug?

Request a feature

What is the current behavior?

I'm writing a simple script to automatically publish my package to NPM when the version has been bumped.

#!/usr/bin/env node

const { version, name } = require('../package');
const { exec } = require('child_process');

let npmInfo = exec(`yarn info --json ${ name }`, (error, stdout) => {

  let npmVersion = JSON.parse(stdout)["data"]["version"];

  if (version === npmVersion) {
    process.stdout.write("No version change\n");
    process.exit(0);
  }

  process.stdout.write(`Publishing ${ name } to NPM\n`);

  exec(`yarn publish --new-version ${ version }`, (error, stdout) => {

    if (error) {
      process.stdout.write(`There was an error publishing ${ name } to NPM`);
      process.exit(1);
    }

    process.stdout.write(`Published ${ name } to NPM`);
  });
});

This fails because the yarn publish command prompts me for a login. Since this script will be run in CircleCI, I need a way to log in programmatically.

What is the expected behavior?

I found the yarn login command, but it seems like it doesn't have a non-interactive mode. Am I missing something? If not, it would be great if you guys could add this.

Please mention your node.js, yarn and operating system version.

Node: 7.8.0
Yarn: 0.24.6
OS: macOS 10.12.5

@Ramblurr
Copy link

Ramblurr commented May 26, 2017

Duplicate of #3505

Oops: #3450

@LandonSchropp
Copy link
Author

@Ramblurr I think you accidentally tagged this ticket instead of the other one. 😃

@LandonSchropp
Copy link
Author

Thanks! I'm closing this.

itaylor added a commit to itaylor/thunk-centric-redux that referenced this issue Jul 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants