Skip to content

Commit

Permalink
feat(output): add promotion status to deployment breakdown markdown
Browse files Browse the repository at this point in the history
Please note this is part of features currently being developed to enhance outputs and should not be
relied upon until its documented in release notes
  • Loading branch information
azlam-abdulsalam committed Aug 20, 2023
1 parent bfb0410 commit 7b8bd5d
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions packages/sfpowerscripts-cli/src/impl/deploy/DeployImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ export default class DeployImpl {
'Incoming Version',
isBaselinOrgModeActivated ? 'Version in baseline org' : 'Version in org',
'To be installed?',
'Promotion Status'
],
body: []
},
Expand Down Expand Up @@ -542,22 +543,37 @@ export default class DeployImpl {
}


function getRowForMarkdownTable(pkg) {
function getRowForMarkdownTable(pkg:SfpPackage) {
const pkgInfo = packagesToPackageInfo[pkg.packageName];

let packageName = pkg.packageName;
let versionNumber = pkg.versionNumber;
let versionInstalledInOrg = pkgInfo.versionInstalledInOrg ? pkgInfo.versionInstalledInOrg : 'N/A';
let isPackageToBeInstalled = pkgInfo.isPackageInstalled ? 'No' : 'Yes';
let promotionStatus = 'N/A';

if(isPackageToBeInstalled=="Yes")
{
isPackageToBeInstalled = `![Yes](https://img.shields.io/badge/Yes-green.svg)`;
packageName = `**${packageName}**`;
if(pkg.packageType==PackageType.Unlocked)
{
let versionInstalledInOrgConvertedToSemver = convertBuildNumDotDelimToHyphen(versionInstalledInOrg);
let versionNumberConvertedToSemver = convertBuildNumDotDelimToHyphen(versionNumber);
if(semver.diff(versionInstalledInOrgConvertedToSemver, versionNumberConvertedToSemver)=='prerelease')
{
promotionStatus = '![Already Promoted](https://img.shields.io/badge/Already%20Promoted-red.svg)';
}
else
{
promotionStatus = '![Pending](https://img.shields.io/badge/Pending-yellow.svg)';
}
}
versionNumber = `**${versionNumber}**`;
versionInstalledInOrg = `**${versionInstalledInOrg}**`;
}

return [packageName, versionNumber, versionInstalledInOrg, isPackageToBeInstalled];
return [packageName, versionNumber, versionInstalledInOrg, isPackageToBeInstalled,promotionStatus];
}
}

Expand Down Expand Up @@ -599,7 +615,7 @@ export default class DeployImpl {
fs.appendFileSync(pathToDeploymentBreakDownFile, `\n\n${getMarkdownTable(tableData)}`);
}

function getRowForMarkdownTable(pkg) {
function getRowForMarkdownTable(pkg:SfpPackage) {
let packageName = pkg.packageName;
let versionNumber = pkg.versionNumber;
return [packageName, versionNumber];
Expand Down

0 comments on commit 7b8bd5d

Please sign in to comment.