Skip to content

Commit 4204f7e

Browse files
fix: Lint and docs updates, introduce melos, and new patch releases (#61)
1 parent e6298d6 commit 4204f7e

File tree

76 files changed

+719
-1488
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+719
-1488
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.dart_tool/
2+
3+
.idea/
4+
*.iml
5+
6+
pubspec.lock

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,13 @@ reporting.
2121
## Contributing Guidelines
2222

2323
To contribute to cli_tools, see the [contribution guidelines](CONTRIBUTING.md).
24+
25+
### Development workflow
26+
27+
This repo uses [melos](https://melos.invertase.dev/) to aid in development,
28+
test, and publishing.
29+
30+
After cloning the repo, run `melos bootstrap` (or `melos bs`) to initialize it
31+
(this will also run `dart pub get`).
32+
33+
Run `melos test` to run all the tests.

melos.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: cli_tools_repo
2+
3+
packages:
4+
- packages/**
5+
6+
ide:
7+
intellij:
8+
enabled: false
9+
10+
command:
11+
version:
12+
workspaceChangelog: false
13+
14+
scripts:
15+
test:
16+
description: "Run all tests"
17+
run: dart test
18+
exec:
19+
concurrency: 1

packages/cli_tools/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# https://dart.dev/guides/libraries/private-files
22
# Created by `dart pub`
33
.dart_tool/
4+
5+
pubspec.lock

packages/cli_tools/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Changelog
1+
## 0.7.1
2+
3+
- **CHORE**(cli_tools): Bumped `config` dependency.
24

35
## 0.7.0
46
- refactor!: Moved out the `config` library from the `cli_tools` package and into its own package, to be published as `config` on pub.dev.
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
include: package:serverpod_lints/cli.yaml
22

33
analyzer:
4+
language:
5+
strict-raw-types: false
46
errors:
5-
unnecessary_final: false
7+
inference_failure_on_instance_creation: ignore
8+
inference_failure_on_function_invocation: ignore
9+
10+
linter:
11+
rules:
12+
prefer_relative_imports: true

packages/cli_tools/example/main.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import 'package:cli_tools/cli_tools.dart';
22
import 'package:config/config.dart';
33

4-
Future<int> main(List<String> args) async {
5-
var commandRunner = BetterCommandRunner(
4+
Future<int> main(final List<String> args) async {
5+
final commandRunner = BetterCommandRunner(
66
'example',
77
'Example CLI command',
88
globalOptions: [
@@ -29,7 +29,7 @@ Future<int> main(List<String> args) async {
2929
} else {
3030
logLevel = LogLevel.info;
3131
}
32-
var logger = StdOutLogger(logLevel);
32+
final logger = StdOutLogger(logLevel);
3333

3434
logger.info('An info message');
3535
logger.error('An error message');
@@ -97,12 +97,12 @@ class TimeSeriesCommand extends BetterCommand<TimeSeriesOption, void> {
9797
String get description => 'Generate a series of time stamps';
9898

9999
@override
100-
void runWithConfig(Configuration<TimeSeriesOption> commandConfig) {
100+
void runWithConfig(final Configuration<TimeSeriesOption> commandConfig) {
101101
var start = DateTime.now();
102-
var until = commandConfig.value(TimeSeriesOption.until);
102+
final until = commandConfig.value(TimeSeriesOption.until);
103103

104104
// exactly one of these options is set
105-
var length = commandConfig.optionalValue(TimeSeriesOption.length);
105+
final length = commandConfig.optionalValue(TimeSeriesOption.length);
106106
var interval = commandConfig.optionalValue(TimeSeriesOption.interval);
107107
interval ??= (until.difference(start) ~/ length!);
108108
if (interval < const Duration(milliseconds: 1)) {

packages/cli_tools/example/simple_command_example.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import 'package:config/config.dart';
1313
/// ```sh
1414
/// INTERVAL=1s dart run example/simple_command_example.dart show
1515
/// ```
16-
Future<int> main(List<String> args) async {
17-
var commandRunner = BetterCommandRunner(
16+
Future<int> main(final List<String> args) async {
17+
final commandRunner = BetterCommandRunner(
1818
'example',
1919
'Example CLI command',
2020
);
@@ -56,8 +56,8 @@ class ShowCommand extends BetterCommand<ShowOption, void> {
5656
String get description => 'Show the configured interval';
5757

5858
@override
59-
void runWithConfig(Configuration<ShowOption> commandConfig) {
60-
var interval = commandConfig.value(ShowOption.interval);
59+
void runWithConfig(final Configuration<ShowOption> commandConfig) {
60+
final interval = commandConfig.value(ShowOption.interval);
6161
print('interval: $interval');
6262
}
6363
}

packages/cli_tools/lib/logger.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1+
export 'src/logger/helpers/ansi_style.dart';
12
export 'src/logger/logger.dart';
23
export 'src/logger/loggers/std_out_logger.dart';
34
export 'src/logger/loggers/void_logger.dart';
4-
export 'src/logger/helpers/ansi_style.dart';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export 'src/package_version/package_version.dart';
2-
export 'src/package_version/pub_api_client_exceptions.dart';
32
export 'src/package_version/pub_api_client.dart';
3+
export 'src/package_version/pub_api_client_exceptions.dart';

0 commit comments

Comments
 (0)