From c54192b4426ccea8f65a29336f7959d29fc7167f Mon Sep 17 00:00:00 2001 From: Luan Nico Date: Sat, 30 Jul 2022 18:47:06 -0400 Subject: [PATCH 1/6] Allow bundle to take multiple inputs to take advantage of bash's wildcard --- .../mason_cli/lib/src/commands/bundle.dart | 136 ++++++++++-------- .../mason_cli/test/commands/bundle_test.dart | 82 +++++++++-- 2 files changed, 144 insertions(+), 74 deletions(-) diff --git a/packages/mason_cli/lib/src/commands/bundle.dart b/packages/mason_cli/lib/src/commands/bundle.dart index 0b094419b..756a93e72 100644 --- a/packages/mason_cli/lib/src/commands/bundle.dart +++ b/packages/mason_cli/lib/src/commands/bundle.dart @@ -64,81 +64,97 @@ class BundleCommand extends MasonCommand { @override Future run() async { final source = results['source'] as String; + final outputDir = results['output-dir'] as String; + final bundleType = (results['type'] as String).toBundleType(); + + final bricks = _parseBricks(source); + final tempBricksJson = []; + final bundleProgress = logger.progress('Bundling ${bricks.length} bricks'); + + final bundlePaths = []; + try { + for (final brick in bricks) { + final Directory brickDirectory; + if (brick.location.path != null) { + brickDirectory = Directory(brick.location.path!); + } else { + final tempBrickJson = BricksJson.temp(); + final cachedBrick = await tempBrickJson.add(brick); + tempBricksJson.add(tempBrickJson); + brickDirectory = Directory(cachedBrick.path); + } + + if (!brickDirectory.existsSync()) { + throw BrickNotFoundException(brickDirectory.path); + } + + final bundle = createBundle(brickDirectory); + bundleProgress.update('Bundling ${bundle.name}'); + + final String bundlePath; + switch (bundleType) { + case BundleType.dart: + bundlePath = await _generateDartBundle(bundle, outputDir); + break; + case BundleType.universal: + bundlePath = await _generateUniversalBundle(bundle, outputDir); + break; + } + bundleProgress.update('Bundled ${bundle.name}'); + bundlePaths.add(bundlePath); + } - final Brick brick; + logger.info('${lightGreen.wrap('✓')} Generated ${bricks.length} files:'); + for (final bundlePath in bundlePaths) { + logger.info(darkGray.wrap(' $bundlePath')); + } + bundleProgress.complete(); + } catch (_) { + bundleProgress.fail(); + rethrow; + } finally { + for (final tmp in tempBricksJson) { + tmp.clear(); + } + } + + return ExitCode.success.code; + } + + List _parseBricks(String source) { if (source == 'git') { if (results.rest.isEmpty) { usageException('A repository url must be provided'); } - brick = Brick( - location: BrickLocation( - git: GitPath( - results.rest.first, - path: results['git-path'] as String?, - ref: results['git-ref'] as String?, + return results.rest.map((url) { + return Brick( + location: BrickLocation( + git: GitPath( + url, + path: results['git-path'] as String?, + ref: results['git-ref'] as String?, + ), ), - ), - ); + ); + }).toList(); } else if (source == 'hosted') { if (results.rest.isEmpty) { usageException('A brick name must be provided'); } - brick = Brick( - name: results.rest.first, - location: const BrickLocation(version: 'any'), - ); + return results.rest.map((name) { + return Brick( + name: name, + location: const BrickLocation(version: 'any'), + ); + }).toList(); } else { if (results.rest.isEmpty) { usageException('A path to the brick template must be provided'); } - brick = Brick(location: BrickLocation(path: results.rest.first)); + return results.rest.map((location) { + return Brick(location: BrickLocation(path: location)); + }).toList(); } - - BricksJson? tempBricksJson; - - final Directory brickDirectory; - if (brick.location.path != null) { - brickDirectory = Directory(brick.location.path!); - } else { - tempBricksJson = BricksJson.temp(); - final cachedBrick = await tempBricksJson.add(brick); - brickDirectory = Directory(cachedBrick.path); - } - - if (!brickDirectory.existsSync()) { - throw BrickNotFoundException(brickDirectory.path); - } - - final bundle = createBundle(brickDirectory); - final outputDir = results['output-dir'] as String; - final bundleType = (results['type'] as String).toBundleType(); - final bundleProgress = logger.progress('Bundling ${bundle.name}'); - - try { - late final String bundlePath; - switch (bundleType) { - case BundleType.dart: - bundlePath = await _generateDartBundle(bundle, outputDir); - break; - case BundleType.universal: - bundlePath = await _generateUniversalBundle(bundle, outputDir); - break; - } - bundleProgress.complete('Bundled ${bundle.name}'); - logger - ..info( - '${lightGreen.wrap('✓')} ' - 'Generated 1 file:', - ) - ..info(darkGray.wrap(' $bundlePath')); - } catch (_) { - bundleProgress.fail(); - rethrow; - } finally { - tempBricksJson?.clear(); - } - - return ExitCode.success.code; } } diff --git a/packages/mason_cli/test/commands/bundle_test.dart b/packages/mason_cli/test/commands/bundle_test.dart index 5e4db7afc..72dec6ffa 100644 --- a/packages/mason_cli/test/commands/bundle_test.dart +++ b/packages/mason_cli/test/commands/bundle_test.dart @@ -22,14 +22,16 @@ void main() { group('mason bundle', () { late Logger logger; + late Progress progress; late PubUpdater pubUpdater; late MasonCommandRunner commandRunner; setUp(() { logger = MockLogger(); + progress = MockProgress(); pubUpdater = MockPubUpdater(); - when(() => logger.progress(any())).thenReturn(MockProgress()); + when(() => logger.progress(any())).thenReturn(progress); when( () => pubUpdater.getLatestVersion(any()), ).thenAnswer((_) async => packageVersion); @@ -82,11 +84,12 @@ void main() { '''"vars":{"name":{"type":"string","description":"Your name","default":"Dash","prompt":"What is your name?"}}}''', ), ); - verify(() => logger.progress('Bundling greeting')).called(1); + verify(() => logger.progress('Bundling 1 bricks')).called(1); + verify(() => progress.update('Bundling greeting')).called(1); verify( () => logger.info( '${lightGreen.wrap('✓')} ' - 'Generated 1 file:', + 'Generated 1 files:', ), ).called(1); verify( @@ -144,11 +147,12 @@ void main() { '''"name":"hooks","description":"A Hooks Example Template","version":"0.1.0+1","environment":{"mason":"any"},"vars":{"name":{"type":"string","description":"Your name","default":"Dash","prompt":"What is your name?"}}''', ), ); - verify(() => logger.progress('Bundling hooks')).called(1); + verify(() => logger.progress('Bundling 1 bricks')).called(1); + verify(() => progress.update('Bundling hooks')).called(1); verify( () => logger.info( '${lightGreen.wrap('✓')} ' - 'Generated 1 file:', + 'Generated 1 files:', ), ).called(1); verify( @@ -197,11 +201,12 @@ void main() { '''"vars":{"name":{"type":"string","description":"Your name","default":"Dash","prompt":"What is your name?"}}});''', ), ); - verify(() => logger.progress('Bundling greeting')).called(1); + verify(() => logger.progress('Bundling 1 bricks')).called(1); + verify(() => progress.update('Bundling greeting')).called(1); verify( () => logger.info( '${lightGreen.wrap('✓')} ' - 'Generated 1 file:', + 'Generated 1 files:', ), ).called(1); verify( @@ -271,11 +276,12 @@ void main() { '''"name":"hooks","description":"A Hooks Example Template","version":"0.1.0+1","environment":{"mason":"any"},"vars":{"name":{"type":"string","description":"Your name","default":"Dash","prompt":"What is your name?"}}''', ), ); - verify(() => logger.progress('Bundling hooks')).called(1); + verify(() => logger.progress('Bundling 1 bricks')).called(1); + verify(() => progress.update('Bundling hooks')).called(1); verify( () => logger.info( '${lightGreen.wrap('✓')} ' - 'Generated 1 file:', + 'Generated 1 files:', ), ).called(1); verify( @@ -283,6 +289,52 @@ void main() { ).called(1); }); + test('creates a new dart bundle with multiple files', () async { + final testDir = Directory( + path.join(Directory.current.path, 'dart'), + )..createSync(recursive: true); + final brick1Path = + path.join('..', '..', '..', '..', '..', '..', 'bricks', 'greeting'); + final brick2Path = + path.join('..', '..', '..', '..', '..', '..', 'bricks', 'hello'); + Directory.current = testDir.path; + final result = await commandRunner.run( + ['bundle', brick1Path, brick2Path, '-t', 'dart'], + ); + expect(result, equals(ExitCode.success.code)); + final file1 = File( + path.join( + testFixturesPath(cwd, suffix: '.bundle'), + 'dart', + 'greeting_bundle.dart', + ), + ); + final file2 = File( + path.join( + testFixturesPath(cwd, suffix: '.bundle'), + 'dart', + 'hello_bundle.dart', + ), + ); + verify(() => logger.progress('Bundling 2 bricks')).called(1); + verify(() => progress.update('Bundling greeting')).called(1); + verify(() => progress.update('Bundled greeting')).called(1); + verify(() => progress.update('Bundling hello')).called(1); + verify(() => progress.update('Bundled hello')).called(1); + verify( + () => logger.info( + '${lightGreen.wrap('✓')} ' + 'Generated 2 files:', + ), + ).called(1); + verify( + () => logger.info(darkGray.wrap(' ${canonicalize(file1.path)}')), + ).called(1); + verify( + () => logger.info(darkGray.wrap(' ${canonicalize(file2.path)}')), + ).called(1); + }); + test('exits with code 64 when no brick path is provided', () async { final result = await commandRunner.run(['bundle']); expect(result, equals(ExitCode.usage.code)); @@ -299,7 +351,7 @@ void main() { verify( () => logger.err('Could not find brick at $brickPath'), ).called(1); - verifyNever(() => logger.progress(any())); + verifyNever(() => progress.update(any())); }); test('exists with code 64 when exception occurs on bundling', () async { @@ -367,11 +419,12 @@ void main() { '''"vars":{"name":{"type":"string","description":"Your name","default":"Dash","prompt":"What is your name?"}}}''', ), ); + verify(() => logger.progress('Bundling 1 bricks')).called(1); verify(() => logger.progress('Bundling greeting')).called(1); verify( () => logger.info( '${lightGreen.wrap('✓')} ' - 'Generated 1 file:', + 'Generated 1 files:', ), ).called(1); verify( @@ -444,11 +497,12 @@ void main() { expect(actual, contains('"changelog":{"path":"CHANGELOG.md","data":"')); expect(actual, contains('"license":{"path":"LICENSE","data":"')); - verify(() => logger.progress('Bundling greeting')).called(1); + verify(() => logger.progress('Bundling 1 bricks')).called(1); + verify(() => progress.update('Bundling greeting')).called(1); verify( () => logger.info( '${lightGreen.wrap('✓')} ' - 'Generated 1 file:', + 'Generated 1 files:', ), ).called(1); verify( @@ -482,7 +536,7 @@ void main() { verify( () => logger.err('Brick "nonexistent-brick" does not exist.'), ).called(1); - verifyNever(() => logger.progress(any())); + verifyNever(() => progress.update(any())); }); }); }); From fc2a09de181b1b7a57c2de46d89dc76d22e754a7 Mon Sep 17 00:00:00 2001 From: Luan Nico Date: Sun, 5 Feb 2023 21:42:01 -0500 Subject: [PATCH 2/6] Fix tests --- packages/mason_cli/test/commands/bundle_test.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/mason_cli/test/commands/bundle_test.dart b/packages/mason_cli/test/commands/bundle_test.dart index 33ab62b3e..e2e195829 100644 --- a/packages/mason_cli/test/commands/bundle_test.dart +++ b/packages/mason_cli/test/commands/bundle_test.dart @@ -356,7 +356,7 @@ void main() { test('exists with code 64 when exception occurs on bundling', () async { final progress = MockProgress(); - when(() => progress.complete(any())).thenAnswer((invocation) { + when(() => progress.update(any())).thenAnswer((invocation) { final update = invocation.positionalArguments[0] as String?; if (update == 'Bundled greeting') { @@ -420,7 +420,7 @@ void main() { ), ); verify(() => logger.progress('Bundling 1 bricks')).called(1); - verify(() => logger.progress('Bundling greeting')).called(1); + verify(() => progress.update('Bundling greeting')).called(1); verify( () => logger.info( '${lightGreen.wrap('✓')} ' @@ -458,10 +458,10 @@ void main() { expect(result, equals(ExitCode.usage.code)); + verify(() => logger.progress('Bundling 1 bricks')).called(1); verify( () => logger.err('Could not find brick at $url'), ).called(1); - verifyNever(() => logger.progress(any())); }); }); From fdae2dcb4fcfeac64f7077431d04883447dec244 Mon Sep 17 00:00:00 2001 From: Luan Nico Date: Mon, 6 Feb 2023 11:52:28 -0500 Subject: [PATCH 3/6] Address comments --- packages/mason_cli/lib/src/commands/bundle.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/mason_cli/lib/src/commands/bundle.dart b/packages/mason_cli/lib/src/commands/bundle.dart index 253661091..1fd9b34aa 100644 --- a/packages/mason_cli/lib/src/commands/bundle.dart +++ b/packages/mason_cli/lib/src/commands/bundle.dart @@ -103,9 +103,13 @@ class BundleCommand extends MasonCommand { bundlePaths.add(bundlePath); } - logger.info('${lightGreen.wrap('✓')} Generated ${bricks.length} files:'); + bundleProgress + .update('${lightGreen.wrap('✓')} Generated ${bricks.length} files:'); for (final bundlePath in bundlePaths) { - logger.info(darkGray.wrap(' $bundlePath')); + final logLine = darkGray.wrap(' $bundlePath'); + if (logLine != null) { + bundleProgress.update(logLine); + } } bundleProgress.complete(); } catch (_) { From 2a8b7ca4771c6a5c55ab3a49c78bc07d96364e11 Mon Sep 17 00:00:00 2001 From: Luan Nico Date: Mon, 6 Feb 2023 12:52:40 -0500 Subject: [PATCH 4/6] Fix tests --- .../mason_cli/test/commands/bundle_test.dart | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/packages/mason_cli/test/commands/bundle_test.dart b/packages/mason_cli/test/commands/bundle_test.dart index e2e195829..a5371cc45 100644 --- a/packages/mason_cli/test/commands/bundle_test.dart +++ b/packages/mason_cli/test/commands/bundle_test.dart @@ -87,13 +87,13 @@ void main() { verify(() => logger.progress('Bundling 1 bricks')).called(1); verify(() => progress.update('Bundling greeting')).called(1); verify( - () => logger.info( + () => progress.update( '${lightGreen.wrap('✓')} ' 'Generated 1 files:', ), ).called(1); verify( - () => logger.info(darkGray.wrap(' ${canonicalize(file.path)}')), + () => progress.update(darkGray.wrap(' ${canonicalize(file.path)}')!), ).called(1); }); @@ -150,13 +150,13 @@ void main() { verify(() => logger.progress('Bundling 1 bricks')).called(1); verify(() => progress.update('Bundling hooks')).called(1); verify( - () => logger.info( + () => progress.update( '${lightGreen.wrap('✓')} ' 'Generated 1 files:', ), ).called(1); verify( - () => logger.info(darkGray.wrap(' ${canonicalize(file.path)}')), + () => progress.update(darkGray.wrap(' ${canonicalize(file.path)}')!), ).called(1); }); @@ -204,13 +204,13 @@ void main() { verify(() => logger.progress('Bundling 1 bricks')).called(1); verify(() => progress.update('Bundling greeting')).called(1); verify( - () => logger.info( + () => progress.update( '${lightGreen.wrap('✓')} ' 'Generated 1 files:', ), ).called(1); verify( - () => logger.info(darkGray.wrap(' ${canonicalize(file.path)}')), + () => progress.update(darkGray.wrap(' ${canonicalize(file.path)}')!), ).called(1); }); @@ -279,13 +279,13 @@ void main() { verify(() => logger.progress('Bundling 1 bricks')).called(1); verify(() => progress.update('Bundling hooks')).called(1); verify( - () => logger.info( + () => progress.update( '${lightGreen.wrap('✓')} ' 'Generated 1 files:', ), ).called(1); verify( - () => logger.info(darkGray.wrap(' ${canonicalize(file.path)}')), + () => progress.update(darkGray.wrap(' ${canonicalize(file.path)}')!), ).called(1); }); @@ -322,16 +322,18 @@ void main() { verify(() => progress.update('Bundling hello')).called(1); verify(() => progress.update('Bundled hello')).called(1); verify( - () => logger.info( + () => progress.update( '${lightGreen.wrap('✓')} ' 'Generated 2 files:', ), ).called(1); verify( - () => logger.info(darkGray.wrap(' ${canonicalize(file1.path)}')), + () => + progress.update(darkGray.wrap(' ${canonicalize(file1.path)}')!), ).called(1); verify( - () => logger.info(darkGray.wrap(' ${canonicalize(file2.path)}')), + () => + progress.update(darkGray.wrap(' ${canonicalize(file2.path)}')!), ).called(1); }); @@ -422,13 +424,13 @@ void main() { verify(() => logger.progress('Bundling 1 bricks')).called(1); verify(() => progress.update('Bundling greeting')).called(1); verify( - () => logger.info( + () => progress.update( '${lightGreen.wrap('✓')} ' 'Generated 1 files:', ), ).called(1); verify( - () => logger.info(darkGray.wrap(' ${canonicalize(file.path)}')), + () => progress.update(darkGray.wrap(' ${canonicalize(file.path)}')!), ).called(1); }); @@ -500,13 +502,13 @@ void main() { verify(() => logger.progress('Bundling 1 bricks')).called(1); verify(() => progress.update('Bundling greeting')).called(1); verify( - () => logger.info( + () => progress.update( '${lightGreen.wrap('✓')} ' 'Generated 1 files:', ), ).called(1); verify( - () => logger.info(darkGray.wrap(' ${canonicalize(file.path)}')), + () => progress.update(darkGray.wrap(' ${canonicalize(file.path)}')!), ).called(1); }); From aa828d69f0ff34781ac387f48692ca399cf9907f Mon Sep 17 00:00:00 2001 From: Luan Nico Date: Mon, 20 Feb 2023 12:34:27 -0500 Subject: [PATCH 5/6] Fix plularization on logs --- .../mason_cli/lib/src/commands/bundle.dart | 13 +++++++--- .../mason_cli/test/commands/bundle_test.dart | 26 +++++++++---------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/packages/mason_cli/lib/src/commands/bundle.dart b/packages/mason_cli/lib/src/commands/bundle.dart index 1fd9b34aa..5a931d146 100644 --- a/packages/mason_cli/lib/src/commands/bundle.dart +++ b/packages/mason_cli/lib/src/commands/bundle.dart @@ -68,7 +68,10 @@ class BundleCommand extends MasonCommand { final bricks = _parseBricks(source); final tempBricksJson = []; - final bundleProgress = logger.progress('Bundling ${bricks.length} bricks'); + final pluralBrick = _pluralize('brick', bricks.length > 1); + final bundleProgress = logger.progress( + 'Bundling ${bricks.length} $pluralBrick', + ); final bundlePaths = []; try { @@ -103,8 +106,8 @@ class BundleCommand extends MasonCommand { bundlePaths.add(bundlePath); } - bundleProgress - .update('${lightGreen.wrap('✓')} Generated ${bricks.length} files:'); + final message = 'Generated ${bricks.length} $pluralBrick'; + bundleProgress.update('${lightGreen.wrap('✓')} $message:'); for (final bundlePath in bundlePaths) { final logLine = darkGray.wrap(' $bundlePath'); if (logLine != null) { @@ -124,6 +127,10 @@ class BundleCommand extends MasonCommand { return ExitCode.success.code; } + String _pluralize(String word, bool isPlural) { + return '$word${isPlural ? 's' : ''}'; + } + List _parseBricks(String source) { if (source == 'git') { if (results.rest.isEmpty) { diff --git a/packages/mason_cli/test/commands/bundle_test.dart b/packages/mason_cli/test/commands/bundle_test.dart index a5371cc45..312ee0f6e 100644 --- a/packages/mason_cli/test/commands/bundle_test.dart +++ b/packages/mason_cli/test/commands/bundle_test.dart @@ -84,12 +84,12 @@ void main() { '''"vars":{"name":{"type":"string","description":"Your name","default":"Dash","prompt":"What is your name?"}}}''', ), ); - verify(() => logger.progress('Bundling 1 bricks')).called(1); + verify(() => logger.progress('Bundling 1 brick')).called(1); verify(() => progress.update('Bundling greeting')).called(1); verify( () => progress.update( '${lightGreen.wrap('✓')} ' - 'Generated 1 files:', + 'Generated 1 file:', ), ).called(1); verify( @@ -147,12 +147,12 @@ void main() { '''"name":"hooks","description":"A Hooks Example Template","version":"0.1.0+1","environment":{"mason":"any"},"vars":{"name":{"type":"string","description":"Your name","default":"Dash","prompt":"What is your name?"}}''', ), ); - verify(() => logger.progress('Bundling 1 bricks')).called(1); + verify(() => logger.progress('Bundling 1 brick')).called(1); verify(() => progress.update('Bundling hooks')).called(1); verify( () => progress.update( '${lightGreen.wrap('✓')} ' - 'Generated 1 files:', + 'Generated 1 file:', ), ).called(1); verify( @@ -201,12 +201,12 @@ void main() { '''"vars":{"name":{"type":"string","description":"Your name","default":"Dash","prompt":"What is your name?"}}});''', ), ); - verify(() => logger.progress('Bundling 1 bricks')).called(1); + verify(() => logger.progress('Bundling 1 brick')).called(1); verify(() => progress.update('Bundling greeting')).called(1); verify( () => progress.update( '${lightGreen.wrap('✓')} ' - 'Generated 1 files:', + 'Generated 1 file:', ), ).called(1); verify( @@ -276,12 +276,12 @@ void main() { '''"name":"hooks","description":"A Hooks Example Template","version":"0.1.0+1","environment":{"mason":"any"},"vars":{"name":{"type":"string","description":"Your name","default":"Dash","prompt":"What is your name?"}}''', ), ); - verify(() => logger.progress('Bundling 1 bricks')).called(1); + verify(() => logger.progress('Bundling 1 brick')).called(1); verify(() => progress.update('Bundling hooks')).called(1); verify( () => progress.update( '${lightGreen.wrap('✓')} ' - 'Generated 1 files:', + 'Generated 1 file:', ), ).called(1); verify( @@ -421,12 +421,12 @@ void main() { '''"vars":{"name":{"type":"string","description":"Your name","default":"Dash","prompt":"What is your name?"}}}''', ), ); - verify(() => logger.progress('Bundling 1 bricks')).called(1); + verify(() => logger.progress('Bundling 1 brick')).called(1); verify(() => progress.update('Bundling greeting')).called(1); verify( () => progress.update( '${lightGreen.wrap('✓')} ' - 'Generated 1 files:', + 'Generated 1 file:', ), ).called(1); verify( @@ -460,7 +460,7 @@ void main() { expect(result, equals(ExitCode.usage.code)); - verify(() => logger.progress('Bundling 1 bricks')).called(1); + verify(() => logger.progress('Bundling 1 brick')).called(1); verify( () => logger.err('Could not find brick at $url'), ).called(1); @@ -499,12 +499,12 @@ void main() { expect(actual, contains('"changelog":{"path":"CHANGELOG.md","data":"')); expect(actual, contains('"license":{"path":"LICENSE","data":"')); - verify(() => logger.progress('Bundling 1 bricks')).called(1); + verify(() => logger.progress('Bundling 1 brick')).called(1); verify(() => progress.update('Bundling greeting')).called(1); verify( () => progress.update( '${lightGreen.wrap('✓')} ' - 'Generated 1 files:', + 'Generated 1 file:', ), ).called(1); verify( From 6aa0278ee8caf97ad4e5865787fc8083183ad00d Mon Sep 17 00:00:00 2001 From: Luan Nico Date: Mon, 20 Feb 2023 12:45:52 -0500 Subject: [PATCH 6/6] Address comments --- packages/mason_cli/lib/src/commands/bundle.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/mason_cli/lib/src/commands/bundle.dart b/packages/mason_cli/lib/src/commands/bundle.dart index 5a931d146..2bb132938 100644 --- a/packages/mason_cli/lib/src/commands/bundle.dart +++ b/packages/mason_cli/lib/src/commands/bundle.dart @@ -68,9 +68,8 @@ class BundleCommand extends MasonCommand { final bricks = _parseBricks(source); final tempBricksJson = []; - final pluralBrick = _pluralize('brick', bricks.length > 1); final bundleProgress = logger.progress( - 'Bundling ${bricks.length} $pluralBrick', + 'Bundling ${bricks.length} ${_pluralize('brick', bricks.length > 1)}', ); final bundlePaths = []; @@ -106,7 +105,8 @@ class BundleCommand extends MasonCommand { bundlePaths.add(bundlePath); } - final message = 'Generated ${bricks.length} $pluralBrick'; + final message = + 'Generated ${bricks.length} ${_pluralize('file', bricks.length > 1)}'; bundleProgress.update('${lightGreen.wrap('✓')} $message:'); for (final bundlePath in bundlePaths) { final logLine = darkGray.wrap(' $bundlePath');