Skip to content

Commit 30de782

Browse files
committed
Package structure improvements
- Moved package source to `src` - Exposed "public API" with `lib/raygun_cli.dart` - Created empty example - Updated `bin/raygun_cli.dart` to use the exposed public API
1 parent 3eb6afb commit 30de782

17 files changed

+49
-20
lines changed

bin/raygun_cli.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import 'package:args/args.dart';
2-
import 'package:raygun_cli/sourcemap/sourcemap_command.dart';
3-
import 'package:raygun_cli/symbols/flutter_symbols.dart';
4-
import 'package:raygun_cli/deployments/deployments_command.dart';
2+
import 'package:raygun_cli/raygun_cli.dart';
53

64
const String version = '0.0.2';
75

example/main.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
void main() {
2+
// This package is not intended to be used as a library.
3+
// It is a command line tool.
4+
// See README.md for usage.
5+
}

lib/raygun_cli.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export 'src/sourcemap/sourcemap_command.dart';
2+
export 'src/symbols/flutter_symbols.dart';
3+
export 'src/deployments/deployments_command.dart';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'dart:io';
22

33
import 'package:args/args.dart';
4-
import 'package:raygun_cli/environment.dart';
4+
import 'package:raygun_cli/src/environment.dart';
55

66
/// A Config property is a value
77
/// that can be set via argument
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import 'dart:io';
22

3-
import 'package:raygun_cli/deployments/deployments_api.dart';
3+
import 'package:raygun_cli/src/deployments/deployments_api.dart';
44
import 'package:args/args.dart';
55
import '../config_props.dart';
66

7+
/// Deployments command
78
class Deployments {
89
final ArgResults command;
910
final bool verbose;
@@ -13,6 +14,7 @@ class Deployments {
1314
required this.verbose,
1415
});
1516

17+
/// Notifies Raygun that a new deployment has been made.
1618
Future<void> notify() async {
1719
if (!command.wasParsed('version')) {
1820
print('Error: Missing "--version"');
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:convert';
22
import 'package:http/http.dart' as http;
33

4+
/// Creates a deployment in Raygun.
45
Future<bool> createDeployment({
56
required String token,
67
required String apiKey,

lib/deployments/deployments_command.dart renamed to lib/src/deployments/deployments_command.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import 'dart:io';
22

33
import 'package:args/args.dart';
4-
import 'package:raygun_cli/deployments/deployments.dart';
4+
import 'package:raygun_cli/src/deployments/deployments.dart';
55

66
const kDeploymentsCommand = 'deployments';
77

8+
/// Builds the deployments command parser
89
ArgParser buildParserDeployments() {
910
return ArgParser()
1011
..addFlag(
@@ -57,6 +58,7 @@ ArgParser buildParserDeployments() {
5758
);
5859
}
5960

61+
/// Parses the deployments command arguments
6062
void parseDeploymentsCommand(ArgResults command, bool verbose) {
6163
if (command.wasParsed('help')) {
6264
print('Usage: raygun-cli deployments <arguments>');

lib/sourcemap/flutter/sourcemap_flutter.dart renamed to lib/src/sourcemap/flutter/sourcemap_flutter.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import 'dart:io';
22

3-
import 'package:raygun_cli/config_props.dart';
4-
import 'package:raygun_cli/sourcemap/sourcemap_api.dart';
5-
import 'package:raygun_cli/sourcemap/sourcemap_base.dart';
3+
import 'package:raygun_cli/src/config_props.dart';
4+
import 'package:raygun_cli/src/sourcemap/sourcemap_api.dart';
5+
import 'package:raygun_cli/src/sourcemap/sourcemap_base.dart';
66

7+
/// Uploads a Flutter web sourcemap file to Raygun.
78
class SourcemapFlutter extends SourcemapBase {
89
SourcemapFlutter({
910
required super.command,

lib/sourcemap/node/sourcemap_node.dart renamed to lib/src/sourcemap/node/sourcemap_node.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import 'dart:io';
22

3-
import 'package:raygun_cli/sourcemap/sourcemap_base.dart';
3+
import 'package:raygun_cli/src/sourcemap/sourcemap_base.dart';
44

5+
/// Uploads a Node app sourcemap file to Raygun.
6+
/// TODO: Not implemented yet.
57
class SourcemapNode extends SourcemapBase {
68
SourcemapNode({
79
required super.command,

0 commit comments

Comments
 (0)