@@ -34,13 +34,15 @@ class PublishScheduler {
3434 required List <PackageInfo > packages,
3535 required PublishPackageFn publishPackage,
3636 required AmplifyCommand command,
37+ this .dryRun = false ,
3738 }) : _packages = packages,
3839 _publishPackage = publishPackage,
3940 _command = command;
4041
4142 final List <PackageInfo > _packages;
4243 final PublishPackageFn _publishPackage;
4344 final AmplifyCommand _command;
45+ final bool dryRun;
4446
4547 /// Packages that are ready to be published (all in-process deps done).
4648 final List <PackageInfo > _packagePublishQueue = [];
@@ -212,6 +214,26 @@ class PublishScheduler {
212214 /// Publishes all packages, processing the queue without blocking on
213215 /// analysis.
214216 Future <void > run () async {
217+ if (dryRun) {
218+ return _runDryRun ();
219+ }
220+ return _runNormal ();
221+ }
222+
223+ /// Dry-run mode: simply iterate through the packages in the provided
224+ /// order and call [_publishPackage] for each one.
225+ Future <void > _runDryRun () async {
226+ for (final package in _packages) {
227+ stdout.writeln ('Publishing ${package .name } (${package .version }) [dry run]' );
228+ await _publishPackage (package);
229+ stdout.writeln ('' );
230+ }
231+ stdout.writeln ('All packages passed pre-publish checks (dry run).' );
232+ }
233+
234+ /// Normal (non-dry-run) publish flow that processes the queue without
235+ /// blocking on analysis.
236+ Future <void > _runNormal () async {
215237 final adjacencyLists = _buildAdjacencyLists ();
216238
217239 /// Tracks which packages have been published (publish call returned).
0 commit comments