Skip to content

pub publish --dry-run --json #4562

Open
@dcharkes

Description

@dcharkes

pub publish --dry-run is used in automation. To make tooling such automation easier, it would be nice if the output would be json instead of human readable.

Specific use-case: it would enable seeing individual errors, warnings, and hints instead of unparsing

pub/lib/src/validator.dart

Lines 188 to 217 in bfbc6bc

if (errors.isNotEmpty) {
final s = errors.length > 1 ? 's' : '';
log.error('Package validation found the following error$s:');
for (var error in errors) {
log.error("* ${error.split('\n').join('\n ')}");
}
log.error('');
}
if (warnings.isNotEmpty) {
final s = warnings.length > 1 ? 's' : '';
log.warning(
'Package validation found the following potential issue$s:',
);
for (var warning in warnings) {
log.warning("* ${warning.split('\n').join('\n ')}");
}
log.warning('');
}
if (hints.isNotEmpty) {
final s = hints.length > 1 ? 's' : '';
log.warning(
'Package validation found the following hint$s:',
);
for (var hint in hints) {
log.warning("* ${hint.split('\n').join('\n ')}");
}
log.warning('');
}

cc @mosuem who maintains https://github.com/dart-lang/ecosystem/blob/main/.github/workflows/publish.yaml

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions