Skip to content

Commit

Permalink
fix(aft): Don't use build numbers (+) for 0-based patch versions (#…
Browse files Browse the repository at this point in the history
…3734)

There is a seeming bug in `pub` which causes issues publishing 0-based patch versions with `+` in their versions. For now, we can just stop publishing these and prefer true SemVer patch bumps instead.
  • Loading branch information
dnys1 authored and kyle committed Sep 21, 2023
1 parent df6770e commit 3161da3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/aft/lib/src/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ extension AmplifyVersion on Version {
if (preRelease.isEmpty) {
switch (type) {
case VersionBumpType.patch:
return major == 0 ? replace(build: [newBuild]) : nextPatch;
return nextPatch;
case VersionBumpType.nonBreaking:
return major == 0 ? nextPatch : nextMinor;
case VersionBumpType.breaking:
Expand Down
6 changes: 3 additions & 3 deletions packages/aft/test/e2e_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -292,17 +292,17 @@ void main() {
final finalRepo = d.repo([
d.package(
'aws_common',
version: '0.1.0+1',
version: '0.1.1',
contents: [
d.pubspec('''
name: aws_common
version: 0.1.0+1
version: 0.1.1
environment:
sdk: ^3.0.0
'''),
d.file('CHANGELOG.md', '''
## 0.1.0+1
## 0.1.1
### Fixes
- fix(aws_common): Fix type
Expand Down
4 changes: 2 additions & 2 deletions packages/aft/test/model_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ void main() {
final version = Version(0, 1, 0);

final patch = version.nextAmplifyVersion(VersionBumpType.patch);
expect(patch, Version(0, 1, 0, build: '1'));
expect(patch, Version(0, 1, 1));
expect(proagation.propagateToComponent(version, patch), false);

final nextPatch = patch.nextAmplifyVersion(VersionBumpType.patch);
expect(nextPatch, Version(0, 1, 0, build: '2'));
expect(nextPatch, Version(0, 1, 2));
expect(proagation.propagateToComponent(version, nextPatch), false);

final nonBreaking =
Expand Down

0 comments on commit 3161da3

Please sign in to comment.