Skip to content

Commit 05ad212

Browse files
committed
Update example
1 parent 6be9a4d commit 05ad212

File tree

5 files changed

+30
-114
lines changed

5 files changed

+30
-114
lines changed

pkgs/io/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
## 1.0.1-dev
1+
## 1.0.1
2+
3+
* Update code examples to call the unified `dart` developer tool.
24

35
## 1.0.0
46

pkgs/io/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,25 @@ A higher-level service for spawning and communicating with processes.
2525
##### Use `spawn` to create a process with std[in|out|err] forwarded by default
2626

2727
```dart
28-
/// Runs `dartfmt` commands and `pub publish`.
2928
Future<void> main() async {
3029
final manager = ProcessManager();
3130
32-
// Runs dartfmt --version and outputs the result via stdout.
33-
print('Running dartfmt --version');
34-
var spawn = await manager.spawn('dartfmt', ['--version']);
31+
// Print `dart` tool version to stdout.
32+
print('** Running `dart --version`');
33+
var spawn = await manager.spawn('dart', ['--version']);
3534
await spawn.exitCode;
3635
37-
// Runs dartfmt -n . and outputs the result via stdout.
38-
print('Running dartfmt -n .');
39-
spawn = await manager.spawn('dartfmt', ['-n', '.']);
36+
// Check formatting and print the result to stdout.
37+
print('** Running `dart format --output=none .`');
38+
spawn = await manager.spawn('dart', ['format', '--output=none', '.']);
4039
await spawn.exitCode;
4140
42-
// Runs pub publish. Upon hitting a blocking stdin state, you may directly
41+
// Check if a package is ready for publishing.
42+
// Upon hitting a blocking stdin state, you may directly
4343
// output to the processes's stdin via your own, similar to how a bash or
4444
// shell script would spawn a process.
45-
print('Running pub publish');
46-
spawn = await manager.spawn('pub', ['publish']);
45+
print('** Running pub publish');
46+
spawn = await manager.spawn('dart', ['pub', 'publish', '--dry-run']);
4747
await spawn.exitCode;
4848
4949
// Closes stdin for the entire program.

pkgs/io/analysis_options.yaml

Lines changed: 4 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -9,94 +9,7 @@ analyzer:
99

1010
linter:
1111
rules:
12-
- always_put_required_named_parameters_first
13-
- avoid_annotating_with_dynamic
14-
- avoid_bool_literals_in_conditional_expressions
15-
- avoid_catches_without_on_clauses
16-
- avoid_catching_errors
17-
- avoid_classes_with_only_static_members
18-
- avoid_double_and_int_checks
19-
- avoid_dynamic_calls
20-
- avoid_field_initializers_in_const_classes
21-
- avoid_function_literals_in_foreach_calls
22-
- avoid_implementing_value_types
23-
- avoid_js_rounded_ints
24-
- avoid_private_typedef_functions
25-
- avoid_redundant_argument_values
26-
- avoid_renaming_method_parameters
27-
- avoid_returning_null_for_future
28-
- avoid_returning_null_for_void
29-
- avoid_returning_this
30-
- avoid_setters_without_getters
31-
- avoid_single_cascade_in_expression_statements
32-
- avoid_slow_async_io
33-
- avoid_types_on_closure_parameters
34-
- avoid_unused_constructor_parameters
35-
- avoid_void_async
36-
- await_only_futures
37-
- camel_case_types
38-
- cancel_subscriptions
39-
- cascade_invocations
40-
- close_sinks
41-
- comment_references
42-
- constant_identifier_names
43-
- control_flow_in_finally
44-
- directives_ordering
45-
- empty_statements
46-
- file_names
47-
- hash_and_equals
48-
- implementation_imports
49-
- invariant_booleans
50-
- iterable_contains_unrelated_type
51-
- join_return_with_assignment
52-
- lines_longer_than_80_chars
53-
- list_remove_unrelated_type
54-
- literal_only_boolean_expressions
55-
- missing_whitespace_between_adjacent_strings
56-
- no_adjacent_strings_in_list
57-
- no_runtimeType_toString
58-
- non_constant_identifier_names
59-
- one_member_abstracts
60-
- only_throw_errors
61-
- overridden_fields
62-
- package_api_docs
63-
- package_names
64-
- package_prefixed_library_names
65-
- prefer_asserts_in_initializer_lists
66-
- prefer_const_constructors
67-
- prefer_const_constructors_in_immutables
68-
- prefer_const_declarations
69-
- prefer_const_literals_to_create_immutables
70-
- prefer_expression_function_bodies
71-
- prefer_final_locals
72-
- prefer_foreach
73-
- prefer_function_declarations_over_variables
74-
- prefer_initializing_formals
75-
- prefer_inlined_adds
76-
- prefer_int_literals
77-
- prefer_interpolation_to_compose_strings
78-
- prefer_is_not_operator
79-
- prefer_mixin
80-
- prefer_null_aware_operators
81-
- prefer_relative_imports
82-
- prefer_typing_uninitialized_variables
83-
- prefer_void_to_null
84-
- provide_deprecation_message
85-
- sort_pub_dependencies
86-
- test_types_in_equals
87-
- throw_in_finally
88-
- type_annotate_public_apis
89-
- unnecessary_await_in_return
90-
- unnecessary_brace_in_string_interps
91-
- unnecessary_getters_setters
92-
- unnecessary_lambdas
93-
- unnecessary_null_aware_assignments
94-
- unnecessary_overrides
95-
- unnecessary_parenthesis
96-
- unnecessary_statements
97-
- unnecessary_string_interpolations
98-
- use_is_even_rather_than_modulo
99-
- use_setters_to_change_properties
100-
- use_string_buffers
101-
- use_to_and_as_if_applicable
102-
- void_checks
12+
- always_declare_return_types
13+
- omit_local_variable_types
14+
- prefer_single_quotes
15+
- unawaited_futures

pkgs/io/example/spawn_process_example.dart

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,26 @@ import 'dart:async';
66

77
import 'package:io/io.dart';
88

9-
/// Runs `dartfmt` commands and `pub publish`.
9+
/// Runs a few subcommands in the `dart` command.
1010
Future<void> main() async {
1111
final manager = ProcessManager();
1212

13-
// Runs dartfmt --version and outputs the result via stdout.
14-
print('Running dartfmt --version');
15-
var spawn = await manager.spawn('dartfmt', ['--version']);
13+
// Print `dart` tool version to stdout.
14+
print('** Running `dart --version`');
15+
var spawn = await manager.spawn('dart', ['--version']);
1616
await spawn.exitCode;
1717

18-
// Runs dartfmt -n . and outputs the result via stdout.
19-
print('Running dartfmt -n .');
20-
spawn = await manager.spawn('dartfmt', ['-n', '.']);
18+
// Check formatting and print the result to stdout.
19+
print('** Running `dart format --output=none .`');
20+
spawn = await manager.spawn('dart', ['format', '--output=none', '.']);
2121
await spawn.exitCode;
2222

23-
// Runs pub publish. Upon hitting a blocking stdin state, you may directly
23+
// Check if a package is ready for publishing.
24+
// Upon hitting a blocking stdin state, you may directly
2425
// output to the processes's stdin via your own, similar to how a bash or
2526
// shell script would spawn a process.
26-
print('Running pub publish');
27-
spawn = await manager.spawn('pub', ['publish']);
27+
print('** Running pub publish');
28+
spawn = await manager.spawn('dart', ['pub', 'publish', '--dry-run']);
2829
await spawn.exitCode;
2930

3031
// Closes stdin for the entire program.

pkgs/io/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: io
22
description: >-
33
Utilities for the Dart VM Runtime including support for ANSI colors,
44
file copying, and standard exit code values.
5-
version: 1.0.1-dev
5+
version: 1.0.1
66
repository: https://github.com/dart-lang/io
77

88
environment:
@@ -14,6 +14,6 @@ dependencies:
1414
string_scanner: ^1.1.0
1515

1616
dev_dependencies:
17-
pedantic: ^1.10.0
17+
lints: ^1.0.0
1818
test: ^1.16.0
1919
test_descriptor: ^2.0.0

0 commit comments

Comments
 (0)