2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
+ // ignore_for_file: lines_longer_than_80_chars
6
+
5
7
import 'dart:io' ;
6
8
7
9
import 'package:args/args.dart' ;
@@ -148,7 +150,7 @@ class Trebuchet {
148
150
'--allow-unrelated-histories' ,
149
151
'${input }_package/$branchName ' ,
150
152
'-m' ,
151
- 'Merge package:$input into shared tool repository'
153
+ 'Merge package:$input into shared $ target repository'
152
154
],
153
155
);
154
156
@@ -162,19 +164,24 @@ class Trebuchet {
162
164
);
163
165
}
164
166
167
+ final remainingSteps = [
168
+ 'Move and fix workflow files' ,
169
+ if (! shouldPush)
170
+ 'Run `git push --set-upstream origin merge-$input -package` in the monorepo directory' ,
171
+ 'Disable squash-only in GitHub settings, and merge with a fast forward merge to the main branch, enable squash-only in GitHub settings.' ,
172
+ "Push tags to github using `git tag --list '$input *' | xargs git push origin`" ,
173
+ 'Follow up with a PR adding links to the top-level readme table.' ,
174
+ 'Transfer issues by running `dart run pkgs/repo_manage/bin/report.dart transfer-issues --source-repo dart-lang/$input --target-repo dart-lang/$target --add-label package:$input --apply-changes`' ,
175
+ "Add a commit to https://github.com/dart-lang/$input / with it's readme pointing to the monorepo." ,
176
+ 'Update the auto-publishing settings on pub.dev/packages/$input .' ,
177
+ 'Archive https://github.com/dart-lang/$input /.' ,
178
+ ];
179
+
165
180
print ('DONE!' );
166
181
print ('''
167
182
Steps left to do:
168
183
169
- - Move and fix workflow files
170
- ${shouldPush ? '' : '- Run `git push --set-upstream origin merge-$input -package` in the monorepo directory' }
171
- - Disable squash-only in GitHub settings, and merge with a fast forward merge to the main branch, enable squash-only in GitHub settings.
172
- - Push tags to github using `git tag --list '$input *' | xargs git push origin`
173
- - Follow up with a PR adding links to the top-level readme table.
174
- - Transfer issues by running `dart run pkgs/repo_manage/bin/report.dart transfer-issues --source-repo dart-lang/$input --target-repo dart-lang/$target --add-label package:$input --apply-changes`
175
- - Add a commit to https://github.com/dart-lang/$input / with it's readme pointing to the monorepo.
176
- - Update the auto-publishing settings on pub.dev/packages/$input .
177
- - Archive https://github.com/dart-lang/$input /.
184
+ ${remainingSteps .map ((step ) => ' - $step ' ).join ('\n ' )}
178
185
''' );
179
186
}
180
187
@@ -191,27 +198,30 @@ ${shouldPush ? '' : '- Run `git push --set-upstream origin merge-$input-package`
191
198
bool overrideDryRun = false ,
192
199
}) async {
193
200
final workingDirectory = inTarget ? targetPath : inputPath;
194
- print ('----------' );
195
- print ('Running `$executable $arguments ` in $workingDirectory ' );
201
+ print ('' );
202
+ print ('${bold ('$executable ${arguments .join (' ' )}' )} '
203
+ '${subtle ('[$workingDirectory ]' )}' );
196
204
if (! dryRun || overrideDryRun) {
197
205
final processResult = await Process .run (
198
206
executable,
199
207
arguments,
200
208
workingDirectory: workingDirectory,
201
209
);
202
- print ('stdout:' );
203
- print (processResult.stdout);
204
- if ((processResult.stderr as String ).isNotEmpty) {
205
- print ('stderr:' );
206
- print (processResult.stderr);
210
+ final out = processResult.stdout as String ;
211
+ if (out.isNotEmpty) {
212
+ print (indent (out).trimRight ());
213
+ }
214
+ final err = processResult.stderr as String ;
215
+ if (err.isNotEmpty) {
216
+ print (indent (err).trimRight ());
207
217
}
208
218
if (processResult.exitCode != 0 ) {
209
219
throw ProcessException (executable, arguments);
210
220
}
211
221
} else {
212
- print ('Not running, as --dry-run is set. ' );
222
+ print (' (not running; --dry-run is set) ' );
213
223
}
214
- print ('========== ' );
224
+ print ('' );
215
225
}
216
226
217
227
Future <void > filterRepo (List <String > args) async {
@@ -228,3 +238,10 @@ Future<void> inTempDir(Future<void> Function(Directory temp) f) async {
228
238
await f (tempDirectory);
229
239
await tempDirectory.delete (recursive: true );
230
240
}
241
+
242
+ String bold (String str) => '\u 001b[1m$str \u 001b[22m' ;
243
+
244
+ String subtle (String str) => '\u 001b[2m$str \u 001b[22m' ;
245
+
246
+ String indent (String str) =>
247
+ str.split ('\n ' ).map ((line) => ' $line ' ).join ('\n ' );
0 commit comments