Skip to content

Commit

Permalink
fix(publish): Revert foolhardy refactoring (5e975e0)
Browse files Browse the repository at this point in the history
  • Loading branch information
evocateur committed Feb 13, 2019
1 parent 8cf5866 commit a6733a2
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions commands/publish/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ class PublishCommand extends Command {

let chain = Promise.resolve();

// attempting to publish a release with local changes is not allowed
chain = chain.then(() => this.verifyWorkingTreeClean());
chain = chain.then(() => this.findVersionedUpdates());

return chain.then(result => {
Expand Down Expand Up @@ -196,10 +194,6 @@ class PublishCommand extends Command {
});
}

verifyWorkingTreeClean() {
return describeRef(this.execOpts).then(checkWorkingTree.throwIfUncommitted);
}

findVersionedUpdates() {
let chain = Promise.resolve();

Expand All @@ -216,12 +210,19 @@ class PublishCommand extends Command {
return chain;
}

verifyWorkingTreeClean() {
return describeRef(this.execOpts).then(checkWorkingTree.throwIfUncommitted);
}

detectFromGit() {
const { tagVersionPrefix = "v" } = this.options;
const matchingPattern = this.project.isIndependent() ? "*@*" : `${tagVersionPrefix}*.*.*`;

let chain = Promise.resolve();

// attempting to publish a tagged release with local changes is not allowed
chain = chain.then(() => this.verifyWorkingTreeClean());

chain = chain.then(() => getCurrentTags(this.execOpts, matchingPattern));
chain = chain.then(taggedPackageNames => {
if (!taggedPackageNames.length) {
Expand Down Expand Up @@ -251,6 +252,9 @@ class PublishCommand extends Command {
detectFromPackage() {
let chain = Promise.resolve();

// attempting to publish a release with local changes is not allowed
chain = chain.then(() => this.verifyWorkingTreeClean());

chain = chain.then(() => getUnpublishedPackages(this.packageGraph, this.conf.snapshot));
chain = chain.then(unpublished => {
if (!unpublished.length) {
Expand Down Expand Up @@ -286,6 +290,9 @@ class PublishCommand extends Command {

let chain = Promise.resolve();

// attempting to publish a canary release with local changes is not allowed
chain = chain.then(() => this.verifyWorkingTreeClean());

// find changed packages since last release, if any
chain = chain.then(() =>
collectUpdates(this.packageGraph.rawPackageList, this.packageGraph, this.execOpts, {
Expand Down

0 comments on commit a6733a2

Please sign in to comment.