Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/src/pub_updater.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:io';

import 'package:http/http.dart' as http;
import 'package:process/process.dart';
import 'package:pub_semver/pub_semver.dart';
import 'package:pub_updater/src/models/models.dart';

/// Exception thrown when the HTTP request fails.
Expand Down Expand Up @@ -36,6 +37,15 @@ class PubUpdater {
}) async {
final latestVersion = await getLatestVersion(packageName);

final currentVersionDesc = Version.parse(currentVersion);
final latestVersionDesc = Version.parse(latestVersion);

if (!latestVersionDesc.isPreRelease && currentVersionDesc.isPreRelease) {
// If the current version is a pre-release but the latest isn't,
// skip the version checking.
return true;
}

return currentVersion == latestVersion;
}

Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
http: ^0.13.3
json_annotation: ^4.1.0
process: ^4.2.3
pub_semver: ^2.1.3

dev_dependencies:
build_runner: ^2.1.2
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/fixtures.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export 'pre_release_package_info_response.dart';
export 'valid_package_info_response.dart';
Loading