Skip to content

Commit

Permalink
Rename flag to --unlock-transitive
Browse files Browse the repository at this point in the history
  • Loading branch information
sigurdm committed Oct 4, 2024
1 parent db8f497 commit a2026fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/src/command/upgrade.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class UpgradeCommand extends PubCommand {
);

argParser.addFlag(
'transitive',
'unlock-transitive',
help: 'Also upgrades the transitive dependencies '
'of the listed [dependencies]',
);
Expand Down Expand Up @@ -115,7 +115,7 @@ class UpgradeCommand extends PubCommand {
/// This allows the user to specify list of names that they want the
/// upgrade command to affect.
Future<List<String>> _computePackagesToUpgrade() async {
if (argResults.flag('transitive')) {
if (argResults.flag('unlock-transitive')) {
final graph = await entrypoint.packageGraph;
return argResults.rest
.expand(
Expand Down
15 changes: 8 additions & 7 deletions test/upgrade/upgrade_transitive_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import '../descriptor.dart' as d;
import '../test_pub.dart';

void main() {
test('without --transitive, the transitive dependencies stay locked',
test('without --unlock-transitive, the transitive dependencies stay locked',
() async {
final server = await servePackages();
server.serve('foo', '1.0.0', deps: {'bar': '^1.0.0'});
Expand All @@ -34,7 +34,7 @@ void main() {
);
});

test('`--transitive` dependencies gets unlocked', () async {
test('`--unlock-transitive` dependencies gets unlocked', () async {
final server = await servePackages();
server.serve('foo', '1.0.0', deps: {'bar': '^1.0.0'});
server.serve('bar', '1.0.0');
Expand All @@ -54,7 +54,7 @@ void main() {
server.serve('baz', '1.5.0');

await pubUpgrade(
args: ['--transitive', 'foo'],
args: ['--unlock-transitive', 'foo'],
output: allOf(
contains('> foo 1.5.0'),
contains('> bar 1.5.0'),
Expand All @@ -66,8 +66,9 @@ void main() {
});

test(
'`--major-versions` without `--transitive` does not allow transitive '
'dependencies to be upgraded along with the named packages', () async {
'`--major-versions` without `--unlock-transitive` does not allow '
'transitive dependencies to be upgraded along with the named packages',
() async {
final server = await servePackages();
server.serve('foo', '1.0.0', deps: {'bar': '^1.0.0'});
server.serve('bar', '1.0.0');
Expand All @@ -93,7 +94,7 @@ void main() {
});

test(
'`--transitive --major-versions` allows transitive dependencies '
'`--unlock-transitive --major-versions` allows transitive dependencies '
'be upgraded along with the named packages', () async {
final server = await servePackages();
server.serve('foo', '1.0.0', deps: {'bar': '^1.0.0'});
Expand All @@ -114,7 +115,7 @@ void main() {
server.serve('baz', '1.5.0');

await pubUpgrade(
args: ['--major-versions', '--transitive', 'foo'],
args: ['--major-versions', '--unlock-transitive', 'foo'],
output: allOf(
contains('> foo 2.0.0'),
contains('> bar 1.5.0'),
Expand Down

0 comments on commit a2026fa

Please sign in to comment.