feat(shorebird_cli): various improvements (#71)

This commit is contained in:
Felix Angelov
2023-03-14 17:10:21 -05:00
committed by GitHub
parent b8aedb5cb3
commit 74d56d0130
3 changed files with 11 additions and 3 deletions
@@ -64,7 +64,7 @@ class BuildCommand extends ShorebirdCommand with ShorebirdEngineMixin {
'build',
// This is temporary because the Shorebird engine currently
// only supports Android.
'apk',
'appbundle',
'--release',
'--local-engine-src-path',
shorebirdEnginePath,
@@ -72,6 +72,7 @@ class BuildCommand extends ShorebirdCommand with ShorebirdEngineMixin {
// This is temporary because the Shorebird engine currently
// only supports Android arm64.
'android_release_arm64',
...results.rest,
];
final result = await runProcess(
@@ -107,9 +107,10 @@ product_id: $productId
logger.detail(
'Deploying ${artifact.path} to $productId (${pubspecYaml.version})',
);
final version = pubspecYaml.version!;
await codePushClient.createPatch(
artifactPath: artifact.path,
baseVersion: pubspecYaml.version.toString(),
baseVersion: '${version.major}.${version.minor}.${version.patch}',
productId: productId,
channel: 'stable',
);
@@ -1,6 +1,7 @@
import 'dart:io';
import 'dart:typed_data';
import 'package:args/args.dart';
import 'package:mason_logger/mason_logger.dart';
import 'package:mocktail/mocktail.dart';
import 'package:shorebird_cli/src/auth/auth.dart';
@@ -9,6 +10,8 @@ import 'package:shorebird_cli/src/commands/build_command.dart';
import 'package:shorebird_code_push_client/shorebird_code_push_client.dart';
import 'package:test/test.dart';
class _MockArgResults extends Mock implements ArgResults {}
class _MockAuth extends Mock implements Auth {}
class _MockLogger extends Mock implements Logger {}
@@ -26,6 +29,7 @@ void main() {
projectId: 'test-project-id',
);
late ArgResults argResults;
late Auth auth;
late CodePushClient codePushClient;
late Logger logger;
@@ -33,6 +37,7 @@ void main() {
late BuildCommand buildCommand;
setUp(() {
argResults = _MockArgResults();
auth = _MockAuth();
codePushClient = _MockCodePushClient();
logger = _MockLogger();
@@ -44,8 +49,9 @@ void main() {
runProcess: (executable, arguments, {bool runInShell = false}) async {
return processResult;
},
);
)..testArgResults = argResults;
when(() => argResults.rest).thenReturn([]);
when(
() => codePushClient.downloadEngine(any()),
).thenAnswer((_) async => Uint8List.fromList([]));