Skip to content

Commit

Permalink
fix(aft): Don't write changelog updates if version was not bumped.
Browse files Browse the repository at this point in the history
Fixes issue in `version-bump` where a changelog may be updated without a corresponding version bump. For example, `amplify_flutter` consolidates updates from all packages, and can collect changelog updates when its version has not been bumped causing a `## NEXT` entry.
  • Loading branch information
Dillon Nys authored and dnys1 committed Aug 22, 2023
1 parent cc5c582 commit b01b29b
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions packages/aft/lib/src/commands/version_bump_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,20 @@ class VersionBumpCommand extends AmplifyCommand
final bumpedPackages = <PackageInfo>[];
for (final package in repo.publishablePackages()) {
final edits = package.pubspecInfo.pubspecYamlEditor.edits;
if (edits.isNotEmpty) {
bumpedPackages.add(package);
if (preview) {
logger.info('pubspec.yaml');
for (final edit in edits) {
final originalText = package.pubspecInfo.pubspecYaml
.substring(edit.offset, edit.offset + edit.length);
logger.info('$originalText --> ${edit.replacement}');
}
} else {
await File(p.join(package.path, 'pubspec.yaml'))
.writeAsString(package.pubspecInfo.pubspecYamlEditor.toString());
if (edits.isEmpty) {
continue;
}
bumpedPackages.add(package);
if (preview) {
logger.info('pubspec.yaml');
for (final edit in edits) {
final originalText = package.pubspecInfo.pubspecYaml
.substring(edit.offset, edit.offset + edit.length);
logger.info('$originalText --> ${edit.replacement}');
}
} else {
await File(p.join(package.path, 'pubspec.yaml'))
.writeAsString(package.pubspecInfo.pubspecYamlEditor.toString());
}
final changelogUpdate = changelogUpdates[package];
if (changelogUpdate != null && changelogUpdate.hasUpdate) {
Expand Down

0 comments on commit b01b29b

Please sign in to comment.