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

Add --allow-branch option to restrict publish to designated branches #1026

Merged
merged 3 commits into from Sep 26, 2017
Merged

Add --allow-branch option to restrict publish to designated branches #1026

merged 3 commits into from Sep 26, 2017

Conversation

FaHeymann
Copy link
Contributor

Description

As suggested in #1007 this introduces an allow-branch flag to the publish command.

Motivation and Context

As above, I would like to use that feature too.

How Has This Been Tested?

Test suite & manual in another project

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project. (I hope)
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (I hope)
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@evocateur
Copy link
Member

whoops, sorry, the integration tests seem to be borked :/

@FaHeymann
Copy link
Contributor Author

I guess jestjs/jest#3584 is what is causing it, right? So I will rollback the jest version

Copy link
Member

@evocateur evocateur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the jest bump

package.json Outdated
@@ -81,7 +81,7 @@
"eslint-plugin-flowtype": "^2.35.0",
"eslint-plugin-node": "^5.1.1",
"file-url": "^2.0.2",
"jest": "^19.0.2",
"jest": "^21.1.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, yeah, please don't change this? It's being held back for a reason (I haven't had time to figure out why jest 20+ breaks)

@evocateur
Copy link
Member

basically, yeah. I haven't had time to knit the integration tests back into the regular tests (as well as make them take less time)

README.md Outdated
}
```

and you are not on the branch `my-new-feature` currently lerna will prevent you from publishing. To force a publish anyways you can use
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should read

and you are not on the branch `master`, lerna will prevent you from publishing.
To force a publish despite this config, pass the `--allow-branch` flag:

and so on

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 fixed

@@ -206,6 +214,12 @@ export default class PublishCommand extends Command {
throw new Error("Detached git HEAD, please checkout a branch to publish changes.");
}

const currentBranch = GitUtilities.getCurrentBranch(this.execOpts);
if (this.options.allowBranch && !minimatch(currentBranch, this.options.allowBranch)) {
throw new Error('Branch ' + currentBranch + ' is not allowed to be published. ' +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be able to use dedent with multi-line template strings, here.

@FaHeymann
Copy link
Contributor Author

@evocateur could you take a look again? I hope I fixed everything :)

@evocateur
Copy link
Member

Looks great!

@lock
Copy link

lock bot commented Dec 27, 2018

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 Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants