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

Idea for enhancement: require confirmation for publish on non-master branch. #1007

Closed
possibilities opened this issue Sep 4, 2017 · 13 comments

Comments

@possibilities
Copy link

On my projects I generally use a simple release script that saves me from making all kinds of stupid mistakes. One nice one is that it prompts me to confirm I want to publish outside of the master branch. Since I never want to do this it's a nice feature. Perhaps it makes sense in the context of lerna? I already accidentally published from a non-master branch so it would benefit me for sure. Thanks for considering, happy to generate a PR if desired!

@evocateur
Copy link
Member

I am generally a favor of chaining such decisions in lifecycle scripts, but as we have the tools already to check the branch name and whatnot, this sounds reasonable.

Configuring this in lerna.json makes the most sense, but a flag for lerna publish would be necessary in any case to be consistent with the other configuration options. --allow-branch seems like a good name, it would require a string argument if the flag is passed, and that argument would be a glob (plain strings are globs too, e.g. --allow-branch master. It would implicitly default to ** (every branch), much like the --scope flag.

Here's how it would look in a lerna.json:

{
  "lerna": "2.1.2",
  "command": {
    "publish": {
      "allowBranch": "master"
    }
  },
  "version": "1.2.3"
}

@possibilities
Copy link
Author

possibilities commented Sep 4, 2017 via email

@possibilities
Copy link
Author

possibilities commented Sep 4, 2017 via email

@evocateur
Copy link
Member

evocateur commented Sep 4, 2017 via email

@possibilities
Copy link
Author

Ah OK, that does make some sense. I personally don't have a use case for a glob but yeah, I see where you're coming from.

@possibilities
Copy link
Author

Ah, OK, I think what's awkward about it is that branch is singular so it doesn't evoke something that's globbable to me. Perhaps go plural and then maybe you don't even need a verb to qualify it "branches"?

@evocateur
Copy link
Member

evocateur commented Sep 4, 2017 via email

@possibilities
Copy link
Author

How bout --allow-branches ?

@evocateur
Copy link
Member

evocateur commented Sep 5, 2017 via email

@possibilities
Copy link
Author

Cool, thanks, I'll give it a shot...

@possibilities
Copy link
Author

One thing I'm unsure of now is if it should fail or prompt when the current branch isn't allowed. Which would be least surprising?

@cezaraugusto
Copy link
Contributor

I guess this can be closed given #1026 is merged already

@lock
Copy link

lock bot commented Mar 27, 2019

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Mar 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants