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

fix!: avoid false negatives when the current version is a pre-release and there is a prior stable release on pub #42

Merged
merged 7 commits into from
Apr 11, 2023

Conversation

renancaraujo
Copy link
Contributor

@renancaraujo renancaraujo commented Mar 28, 2023

Description

fix!: avoid false negatives when the current version is a pre-release and there is a prior stable release on pub

This is a breaking change, in the following case, that returned false, will return true after this change.

// latest version on pub: 0.2.0
await pubUpdater.isUpToDate(
  packageName: 'my_package',
  currentVersion: '0.3.0-dev.1',
),

closes: #41

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

.thenAnswer((_) => Future.value(FakeProcessResult()));
});

test('returns false when currentVersion < latestVersion', () async {
Copy link
Contributor

@felangel felangel Mar 28, 2023

Choose a reason for hiding this comment

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

So just to clarify if the current version was 0.1.0-dev.48 and the latest version was 1.0.0, isUpToDate would return true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would say, in short, I think we shouldn't track how "up to date" a pre-release is when compared to a stable release because it is a rabbit hole (#41 (comment))

lib/src/pub_updater.dart Outdated Show resolved Hide resolved
test/fixtures/pre_release_package_info_response.dart Outdated Show resolved Hide resolved
test/pub_update_test.dart Show resolved Hide resolved
@alestiago
Copy link

alestiago commented Mar 28, 2023

I also had the same doubt that @felangel had here.

Can we add some documentation in the README.md that explains why this behaviour is intended? Similar to what you explained here but giving it more visibility by including it in the README.md

Maybe a FAQ similar to how mocktail or very_good_coverage have?

wolfenrain
wolfenrain previously approved these changes Mar 29, 2023
lib/src/pub_updater.dart Outdated Show resolved Hide resolved
test/pub_update_test.dart Outdated Show resolved Hide resolved
Co-authored-by: Jochum van der Ploeg <jochum@vdploeg.net>
@wolfenrain wolfenrain merged commit 0a14ccd into main Apr 11, 2023
4 checks passed
@wolfenrain wolfenrain deleted the renan/ahandle-pre-releases branch April 11, 2023 13:18
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

Successfully merging this pull request may close these issues.

Support prereleases
4 participants