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

feat(plugins/npm): exclude pre-release branches from greaterRelease calculation #2036

Merged

Conversation

hydrosquall
Copy link
Contributor

@hydrosquall hydrosquall commented Jul 22, 2021

What Changed

  • Exclude the remote NPM version from the "greater" calculation if the @latest tag is for a pre-release version.
    • This can happen if a new package is first published without a tag on @latest, AND that package happens to be the last alphabetically in getMonoRepoPackage, its version will drive up the next version for the entire monorepo because its "latest" version is ahead of all its siblings.

Why

I considered a few different places to add this check, but from testing this location in an auto config with only the 1 NPM plugin

  • yarn run auto info
  • yarn run auto latest --dry-run
  • yarn run auto canary --dry-run
  • yarn run auto next --dry-run (not working yet - for some reason this is still outputting the wrong version, investigating... (This was solved by deleting tags from the git remote which hadn't been removed yet)

Todo:

  • Add tests
  • Add docs

Change Type

Indicate the type of change your pull request is:

  • documentation
  • patch
  • minor
  • major

🐤 Download canary assets:

auto-linux--canary.2036.24610.gz
auto-macos--canary.2036.24610.gz
auto-win.exe--canary.2036.24610.gz

📦 Published PR as canary version: under canary scope @auto-canary@10.31.0--canary.2036.24610.0

✨ Test out this PR locally via:

npm install @auto-canary/bot-list@10.31.0--canary.2036.24610.0
npm install @auto-canary/auto@10.31.0--canary.2036.24610.0
npm install @auto-canary/core@10.31.0--canary.2036.24610.0
npm install @auto-canary/package-json-utils@10.31.0--canary.2036.24610.0
npm install @auto-canary/all-contributors@10.31.0--canary.2036.24610.0
npm install @auto-canary/brew@10.31.0--canary.2036.24610.0
npm install @auto-canary/chrome@10.31.0--canary.2036.24610.0
npm install @auto-canary/cocoapods@10.31.0--canary.2036.24610.0
npm install @auto-canary/conventional-commits@10.31.0--canary.2036.24610.0
npm install @auto-canary/crates@10.31.0--canary.2036.24610.0
npm install @auto-canary/docker@10.31.0--canary.2036.24610.0
npm install @auto-canary/exec@10.31.0--canary.2036.24610.0
npm install @auto-canary/first-time-contributor@10.31.0--canary.2036.24610.0
npm install @auto-canary/gem@10.31.0--canary.2036.24610.0
npm install @auto-canary/gh-pages@10.31.0--canary.2036.24610.0
npm install @auto-canary/git-tag@10.31.0--canary.2036.24610.0
npm install @auto-canary/gradle@10.31.0--canary.2036.24610.0
npm install @auto-canary/jira@10.31.0--canary.2036.24610.0
npm install @auto-canary/magic-zero@10.31.0--canary.2036.24610.0
npm install @auto-canary/maven@10.31.0--canary.2036.24610.0
npm install @auto-canary/microsoft-teams@10.31.0--canary.2036.24610.0
npm install @auto-canary/npm@10.31.0--canary.2036.24610.0
npm install @auto-canary/omit-commits@10.31.0--canary.2036.24610.0
npm install @auto-canary/omit-release-notes@10.31.0--canary.2036.24610.0
npm install @auto-canary/pr-body-labels@10.31.0--canary.2036.24610.0
npm install @auto-canary/released@10.31.0--canary.2036.24610.0
npm install @auto-canary/s3@10.31.0--canary.2036.24610.0
npm install @auto-canary/sbt@10.31.0--canary.2036.24610.0
npm install @auto-canary/slack@10.31.0--canary.2036.24610.0
npm install @auto-canary/twitter@10.31.0--canary.2036.24610.0
npm install @auto-canary/upload-assets@10.31.0--canary.2036.24610.0
npm install @auto-canary/vscode@10.31.0--canary.2036.24610.0
# or 
yarn add @auto-canary/bot-list@10.31.0--canary.2036.24610.0
yarn add @auto-canary/auto@10.31.0--canary.2036.24610.0
yarn add @auto-canary/core@10.31.0--canary.2036.24610.0
yarn add @auto-canary/package-json-utils@10.31.0--canary.2036.24610.0
yarn add @auto-canary/all-contributors@10.31.0--canary.2036.24610.0
yarn add @auto-canary/brew@10.31.0--canary.2036.24610.0
yarn add @auto-canary/chrome@10.31.0--canary.2036.24610.0
yarn add @auto-canary/cocoapods@10.31.0--canary.2036.24610.0
yarn add @auto-canary/conventional-commits@10.31.0--canary.2036.24610.0
yarn add @auto-canary/crates@10.31.0--canary.2036.24610.0
yarn add @auto-canary/docker@10.31.0--canary.2036.24610.0
yarn add @auto-canary/exec@10.31.0--canary.2036.24610.0
yarn add @auto-canary/first-time-contributor@10.31.0--canary.2036.24610.0
yarn add @auto-canary/gem@10.31.0--canary.2036.24610.0
yarn add @auto-canary/gh-pages@10.31.0--canary.2036.24610.0
yarn add @auto-canary/git-tag@10.31.0--canary.2036.24610.0
yarn add @auto-canary/gradle@10.31.0--canary.2036.24610.0
yarn add @auto-canary/jira@10.31.0--canary.2036.24610.0
yarn add @auto-canary/magic-zero@10.31.0--canary.2036.24610.0
yarn add @auto-canary/maven@10.31.0--canary.2036.24610.0
yarn add @auto-canary/microsoft-teams@10.31.0--canary.2036.24610.0
yarn add @auto-canary/npm@10.31.0--canary.2036.24610.0
yarn add @auto-canary/omit-commits@10.31.0--canary.2036.24610.0
yarn add @auto-canary/omit-release-notes@10.31.0--canary.2036.24610.0
yarn add @auto-canary/pr-body-labels@10.31.0--canary.2036.24610.0
yarn add @auto-canary/released@10.31.0--canary.2036.24610.0
yarn add @auto-canary/s3@10.31.0--canary.2036.24610.0
yarn add @auto-canary/sbt@10.31.0--canary.2036.24610.0
yarn add @auto-canary/slack@10.31.0--canary.2036.24610.0
yarn add @auto-canary/twitter@10.31.0--canary.2036.24610.0
yarn add @auto-canary/upload-assets@10.31.0--canary.2036.24610.0
yarn add @auto-canary/vscode@10.31.0--canary.2036.24610.0

@adierkens adierkens added the minor Increment the minor version when merged label Jul 22, 2021
@codecov
Copy link

codecov bot commented Jul 22, 2021

Codecov Report

Merging #2036 (14b69aa) into main (2d0dc88) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2036   +/-   ##
=======================================
  Coverage   80.24%   80.25%           
=======================================
  Files          66       66           
  Lines        5397     5399    +2     
  Branches     1251     1252    +1     
=======================================
+ Hits         4331     4333    +2     
  Misses        706      706           
  Partials      360      360           
Impacted Files Coverage Δ
plugins/npm/src/index.ts 73.22% <100.00%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee59002...14b69aa. Read the comment docs.

@hydrosquall hydrosquall force-pushed the cameron.yick/modify-npm-bumping-logic branch from ffd5c8b to 14b69aa Compare July 22, 2021 19:20
@hydrosquall
Copy link
Contributor Author

@hipstersmoothie thanks for the canary release! I tested this in our project, and it works well (the greaterVersion calculation preferred the local highest version over the remote version).

@hipstersmoothie hipstersmoothie merged commit 178f55c into intuit:main Mar 4, 2022
@intuit-svc
Copy link

🚀 PR was released in v10.33.0 🚀

@intuit-svc intuit-svc added the released This issue/pull request has been released. label Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants