-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsourcemap_flutter.dart
More file actions
42 lines (39 loc) · 1.09 KB
/
sourcemap_flutter.dart
File metadata and controls
42 lines (39 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import 'dart:io';
import 'package:raygun_cli/config_props.dart';
import 'package:raygun_cli/sourcemap/sourcemap_api.dart';
import 'package:raygun_cli/sourcemap/sourcemap_base.dart';
class SourcemapFlutter extends SourcemapBase {
SourcemapFlutter({
required super.command,
required super.verbose,
});
@override
Future<void> upload() async {
if (command.option('uri') == null && command.option('base-uri') == null) {
print('Provide either "uri" or "base-uri"');
exit(2);
}
final uri =
command.option('uri') ?? '${command.option('base-uri')}main.dart.js';
final path = command.option('input-map') ?? 'build/web/main.dart.js.map';
final appId = ConfigProp.appId.load(command);
final token = ConfigProp.token.load(command);
if (verbose) {
print('app-id: $appId');
print('token: $token');
print('input-map: $path');
print('uri: $uri');
}
final out = await uploadSourcemap(
appId: appId,
token: token,
path: path,
uri: uri,
);
if (out) {
exit(0);
} else {
exit(2);
}
}
}