Skip to content

Commit 8fae493

Browse files
authored
Merge pull request #11 from Rexios80/feature/dart-run
Improvements for `dart run`
2 parents 621be5a + d2f683b commit 8fae493

File tree

14 files changed

+328
-106
lines changed

14 files changed

+328
-106
lines changed

CHANGELOG.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 1.37.0
2+
3+
- `puby gen` and `puby run` now map to `dart run` instead of `[engine] pub run`
4+
- `dart run` is automatically skipped in projects without the required package
5+
- Projects configured with FVM will now use `fvm dart`
6+
17
## 1.36.0
28

39
- Improves exit codes
@@ -6,11 +12,13 @@
612
- Bumps Dart SDK constraint to `^3.0.0`
713

814
## 1.35.0
15+
916
- `puby link` no longer runs `pub get --offline` in flutter example projects
1017
- Fixes `--no-fvm` flag for `puby link`
1118
- Fixes nested fvm project resolution
1219

1320
## 1.34.0
21+
1422
- Adds `puby relink` as an alias for `puby clean && puby link`
1523
- `puby link` now respects the fvm flutter version during linking
1624
- `puby link` now respects excludes during linking
@@ -19,158 +27,205 @@
1927
- Cleanup tests and fix testing in GitHub Actions
2028

2129
## 1.33.0
30+
2231
- The `puby link` command no longer requires existing `pubspec.lock` files to function
2332
- Fixes `--no-fvm` flag for `puby link`
2433
- Updates for fvm 3.0.0
2534

2635
## 1.32.1
36+
2737
- Adds more log lines to show that work is being done
2838

2939
## 1.32.0
40+
3041
- Fixes `puby link` on Windows
3142

3243
## 1.31.0
44+
3345
- Display the packages as they are cached by `puby link`
3446

3547
## 1.30.0
48+
3649
- Fixes `--no-fvm` flag for convenience commands
3750
- Uses `TaskQueue` from `flutter_tools_task_queue`
3851

3952
## 1.29.0
53+
4054
- Use `fvm` if `.fvm` configuration folder exists in any parent directory
4155

4256
## 1.28.0
57+
4358
- Run `puby clean` in parallel
4459

4560
## 1.27.1
61+
4662
- Adds `puby link` to help output
4763

4864
## 1.27.0
65+
4966
- Adds `puby link` to link all locked dependencies
5067
- Only search for projects once
5168
- Fixes platform path separator issues
5269
- More informational timers
5370

5471
## 1.26.0
72+
5573
- Adds `puby exec` to run any command in all projects
5674
- Fixes a race condition with command output
5775

5876
## 1.25.0
77+
5978
- Project-level error if FVM required flutter version is not installed
6079

6180
## 1.24.0
81+
6282
- Exit immediately if pub returns an unknown subcommand error
6383

6484
## 1.23.0
85+
6586
- Adds `puby reset` as an alias for `puby clean && puby get`
6687

6788
## 1.22.0
89+
6890
- Adds the ability to disable FVM support with the `--no-fvm` option
6991

7092
## 1.21.0
93+
7194
- `puby mup` now only runs `pub upgrade --major-versions`
7295
- > Fix a bug in dart pub upgrade --major-versions where packages not requiring major updates would be held back unless needed.
7396
- https://github.com/dart-lang/sdk/blob/main/CHANGELOG.md#pub
7497
- Updates minimum Dart SDK to 2.19.0
7598

7699
## 1.20.0
100+
77101
- Retry with `flutter` engine if `dart` command fails with 'Flutter users should run `flutter pub get` instead of `dart pub get`.'
78102

79103
## 1.19.0
104+
80105
- Adds `puby mup` convenience command for `puby upgrade --major-versions && puby upgrade`
81106

82107
## 1.18.0
108+
83109
- Run `flutter clean` in dart projects
84110

85111
## 1.17.0
112+
86113
- Prints failed projects to the console
87114

88115
## 1.16.1
116+
89117
- Fixed typo
90118

91119
## 1.16.0
120+
92121
- Commands no longer run in build folders
93122
- Uses pubspec_parse package for pubspec parsing
94123

95124
## 1.15.0
125+
96126
- Show elapsed time after command completion
97127

98128
## 1.14.1
129+
99130
- Handle empty pubspec files
100131

101132
## 1.14.0
133+
102134
- Exit if there are no projects found in the current directory
103135

104136
## 1.13.1
137+
105138
- Fixed readme layout
106139

107140
## 1.13.0
141+
108142
- FVM support
109143
- Config file to allow per-project command exclusions
110144
- Added tests
111145

112146
## 1.12.2
147+
113148
- Updated pub_update_checker
114149

115150
## 1.12.1
151+
116152
- Print the update text in yellow
117153

118154
## 1.12.0
155+
119156
- Added update checking
120157

121158
## 1.11.0
159+
122160
- Fixed flutter example project skipping if example folder is in current directory
123161

124162
## 1.10.0
163+
125164
- Skip projects in hidden folders
126165
- Colored outputs
127166

128167
## 1.9.1
168+
129169
- Fixed skipping flutter example projects on Windows
130170

131171
## 1.9.0
172+
132173
- Fixed running on Windows
133174

134175
## 1.8.0
176+
135177
- Don't skip a Flutter example project if it is the only project found
136178

137179
## 1.7.0
180+
138181
- Added more useful help text
139182

140183
## 1.6.0
184+
141185
- Fixed issue with unicode characters in output
142186

143187
## 1.5.0
188+
144189
- Combined exit code for use in CI
145190

146191
## 1.4.0
192+
147193
- Added `puby test` and `puby clean`
148194
- Use relative paths
149195

150196
## 1.3.0
197+
151198
- Added `puby gen` shortcut for `[dart|flutter] pub run build_runner build --delete-conflicting-outputs`
152199

153200
## 1.2.3
201+
154202
- Fixed crash with no dependencies listed in pubspec
155203

156204
## 1.2.2
205+
157206
- Print process output in real time
158207

159208
## 1.2.1
209+
160210
- Updated flutter detection
161211

162212
## 1.2.0
213+
163214
- Don't search symlinks for pubspec files
164215

165216
## 1.1.2
217+
166218
- Exit with message if no arguments are passed
167219

168220
## 1.1.1
221+
169222
- Updated readme
170223

171224
## 1.1.0
225+
172226
- Determine if a project uses dart or flutter automatically
173227
- Skip flutter pub get for flutter example projects
174228

175229
## 1.0.0
230+
176231
- Initial version

README.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@ Run commands in all projects in the current directory. Handle monorepos with eas
1212
- Combined exit code for use in CI
1313
- Per-project command exclusions
1414

15-
| Command | Equivalent |
16-
| --------------------- | ------------------------------------------------------------------- |
17-
| `puby [args]` | `[engine] pub [args]` |
18-
| `puby link` | Warm the pub cache and run `[engine] pub get --offline` (see below) |
19-
| `puby gen` | `[engine] pub run build_runner build --delete-conflicting-outputs` |
20-
| `puby test` | `[engine] test` |
21-
| `puby clean` | `flutter clean` |
22-
| `puby mup` | `[engine] pub upgrade --major-versions` |
23-
| `puby reset` | `puby clean && puby get` |
24-
| `puby relink` | `puby clean && puby link` |
25-
| `puby exec [command]` | `command` |
26-
27-
For projects configured with FVM, `fvm flutter` is used. FVM support can be disabled with the `--no-fvm` option.
15+
| Command | Equivalent |
16+
| --------------------- | ---------------------------------------------------------- |
17+
| `puby [args]` | `[engine] pub [args]` |
18+
| `puby link` | Warm the pub cache and run `[engine] pub get --offline` |
19+
| `puby gen` | `dart run build_runner build --delete-conflicting-outputs` |
20+
| `puby run` | `dart run` |
21+
| `puby test` | `[engine] test` |
22+
| `puby clean` | `flutter clean` |
23+
| `puby mup` | `[engine] pub upgrade --major-versions` |
24+
| `puby reset` | `puby clean && puby get` |
25+
| `puby relink` | `puby clean && puby link` |
26+
| `puby exec [command]` | `command` |
27+
28+
For projects configured with FVM, `fvm flutter` and `fvm dart` are used. FVM support can be disabled with the `--no-fvm` option.
2829

2930
## Use as an executable
3031

@@ -65,6 +66,10 @@ Benchmark setup:
6566
- Run `puby clean && dart pub cache clean` before each run
6667
- `melos bootstrap` is run with a [custom branch of flutter/packages](https://github.com/Rexios80/packages_flutter/tree/puby_benchmarking) with the required setup
6768

69+
## Notes on `puby gen` and `puby run`
70+
71+
Commands that map to `dart run [package]` will not run in projects that do not depend on the required package. For example, `puby gen` will skip projects that do not depend on `build_runner`. Transitive dependencies are included in this check, however a `pub get` must be run in the project at least once for the check to work.
72+
6873
## Notes on `puby exec`
6974

7075
Paths relative to the directory you are running `puby` in will not work. For example:

bin/commands.dart

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import 'link.dart';
1212
import 'projects.dart';
1313

1414
abstract class Commands {
15-
static final clean = ProjectCommand(['clean'], parallel: true);
15+
static final clean =
16+
ProjectCommand(['clean'], parallel: true, engine: Engine.flutter);
1617
static final link = GlobalCommand(
1718
['link'],
1819
(command, projects) =>
@@ -23,13 +24,18 @@ abstract class Commands {
2324

2425
static final convenience = <String, List<Command>>{
2526
'gen': [
26-
ProjectCommand([
27-
'pub',
28-
'run',
29-
'build_runner',
30-
'build',
31-
'--delete-conflicting-outputs',
32-
]),
27+
ProjectCommand(
28+
[
29+
'run',
30+
'build_runner',
31+
'build',
32+
'--delete-conflicting-outputs',
33+
],
34+
engine: Engine.dart,
35+
),
36+
],
37+
'run': [
38+
ProjectCommand(['run'], engine: Engine.dart),
3339
],
3440
'test': [
3541
ProjectCommand(['test']),
@@ -57,7 +63,7 @@ abstract class Commands {
5763

5864
/// Check if we should continue after this line is received
5965
static bool shouldKill(Project project, Command command, String line) {
60-
if (project.engine == Engine.fvm) {
66+
if (project.fvm) {
6167
final flutterVersionNotInstalledMatch =
6268
RegExp(r'Flutter SDK: SDK Version : (.+?) is not installed\.')
6369
.firstMatch(line);
@@ -88,7 +94,7 @@ extension ProjectCommandExtension on ProjectCommand {
8894
if (resolved.exclude) return 0;
8995

9096
final finalArgs = [
91-
if (!raw) ...resolved.engine.prefixArgs,
97+
if (!raw) ...resolved.prefixArgs,
9298
...args,
9399
];
94100

0 commit comments

Comments
 (0)