Skip to content

Commit

Permalink
fix: add end to end build duration and fix version list
Browse files Browse the repository at this point in the history
  • Loading branch information
mradulsf committed Jun 25, 2024
1 parent 6a72e0e commit 8cfade8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
4 changes: 4 additions & 0 deletions messages/package_version_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,7 @@ Created By
# language

Language

# endToEndBuildDuration

End To End Build Duration
3 changes: 3 additions & 0 deletions schemas/package-version-report.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@
},
"AncestorId": {
"type": ["string", "null"]
},
"EndToEndBuildDuration": {
"type": "number"
}
},
"required": ["HasMetadataRemoved", "Package2", "Version"]
Expand Down
20 changes: 14 additions & 6 deletions src/commands/package/version/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { Flags, loglevel, orgApiVersionFlagWithDeprecations, SfCommand, Ux } from '@salesforce/sf-plugins-core';
import { Messages, SfProject } from '@salesforce/core';
import { Connection, Messages, SfProject } from '@salesforce/core';
import {
getContainerOptions,
getPackageVersionStrings,
Expand Down Expand Up @@ -45,7 +45,7 @@ export type PackageVersionListDetails = Omit<
Alias: string;
IsOrgDependent: 'N/A' | 'Yes' | 'No';
CreatedBy: string;
ValidatedAsync: boolean;
ValidatedAsync?: boolean;
};

export type PackageVersionListCommandResult = PackageVersionListDetails[];
Expand Down Expand Up @@ -195,7 +195,7 @@ export class PackageVersionListCommand extends SfCommand<PackageVersionListComma
CodeCoverage: codeCoverage,
HasPassedCodeCoverageCheck: hasPassedCodeCoverageCheck as string | boolean,
ValidationSkipped: record.ValidationSkipped,
ValidatedAsync: record.ValidatedAsync == null ?? false,
ValidatedAsync: record.ValidatedAsync,
AncestorId: record.AncestorId,
AncestorVersion: ancestorVersion as string,
Alias: AliasStr,
Expand All @@ -208,7 +208,7 @@ export class PackageVersionListCommand extends SfCommand<PackageVersionListComma
});
});
this.styledHeader(`Package Versions [${results.length}]`);
this.table(results, getColumnData(flags.concise, flags.verbose, flags['show-conversions-only']), {
this.table(results, getColumnData(flags.concise, flags.verbose, flags['show-conversions-only'], connection), {
'no-truncate': true,
});
} else {
Expand All @@ -222,7 +222,8 @@ export class PackageVersionListCommand extends SfCommand<PackageVersionListComma
const getColumnData = (
concise: boolean,
verbose: boolean,
conversions: boolean
conversions: boolean,
connection: Connection
): Ux.Table.Columns<Record<string, unknown>> => {
if (concise) {
return {
Expand All @@ -246,12 +247,19 @@ const getColumnData = (
IsPasswordProtected: { header: messages.getMessage('installKey') },
IsReleased: { header: 'Released' },
ValidationSkipped: { header: messages.getMessage('validationSkipped') },
ValidatedAsync: { header: messages.getMessage('validatedAsync') },
AncestorId: { header: 'Ancestor' },
AncestorVersion: { header: 'Ancestor Version' },
Branch: { header: messages.getMessage('packageBranch') },
};

if (Number(connection.version) > 60) {
defaultCols = Object.assign(defaultCols, {
ValidatedAsync: {
header: messages.getMessage('validatedAsync'),
},
});
}

if (conversions && !verbose) {
defaultCols = Object.assign(defaultCols, {
ConvertedFromVersionId: {
Expand Down
6 changes: 5 additions & 1 deletion src/commands/package/version/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class PackageVersionReportCommand extends SfCommand<PackageVersionReportR
},
{
key: pvlMessages.getMessage('validatedAsync'),
value: record.ValidatedAsync == null ?? null,
value: record.ValidatedAsync,
},
{ key: messages.getMessage('ancestorId'), value: record.AncestorId },
{ key: messages.getMessage('ancestorVersion'), value: record.AncestorVersion },
Expand Down Expand Up @@ -165,6 +165,10 @@ export class PackageVersionReportCommand extends SfCommand<PackageVersionReportR
key: plMessages.getMessage('createdBy'),
value: record.CreatedById,
},
{
key: pvlMessages.getMessage('endToEndBuildDuration'),
value: record.EndToEndBuildDuration === null ? '' : record.EndToEndBuildDuration?.toFixed(1),
},
];
const maximumNumClasses = 15; // Number of least code covered classes displayed on the cli output for better UX.
let codeCovStr = ''; // String to display when code coverage data is empty or null
Expand Down

0 comments on commit 8cfade8

Please sign in to comment.