Skip to content

Commit

Permalink
fix: don't use Enum.name (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
blaugold committed Feb 24, 2022
1 parent f649da9 commit 27dcc7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/melos/lib/src/command_runner/version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import 'package:glob/glob.dart';
import 'package:pub_semver/pub_semver.dart';

import '../commands/runner.dart';
import '../common/utils.dart';
import '../common/versioning.dart';
import '../package.dart';
import '../workspace_configs.dart';
Expand Down Expand Up @@ -240,8 +241,9 @@ class VersionCommand extends MelosCommand {
return ManualVersionChange.incrementBuildNumber();
}

final semverReleaseType = SemverReleaseType.values
.firstWhereOrNull((releaseType) => releaseType.name == argument);
final semverReleaseType = SemverReleaseType.values.firstWhereOrNull(
(releaseType) => describeEnum(releaseType) == argument,
);
if (semverReleaseType != null) {
return ManualVersionChange.incrementBySemverReleaseType(
semverReleaseType,
Expand Down
2 changes: 2 additions & 0 deletions packages/melos/lib/src/common/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ extension Let<T> on T? {
}
}

String describeEnum(Object value) => value.toString().split('.').last;

// MELOS_PACKAGES environment variable is a comma delimited list of
// package names - used instead of filters if it is present.
// This can be user defined or can come from package selection in `melos run`.
Expand Down

0 comments on commit 27dcc7a

Please sign in to comment.