Skip to content

Commit

Permalink
fix: look up 05i id if 04t is found for package:promote
Browse files Browse the repository at this point in the history
  • Loading branch information
WillieRuemmele committed Aug 31, 2022
1 parent e67f127 commit 256dbdb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/commands/force/package/beta/version/promote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
BY_LABEL,
getHasMetadataRemoved,
getPackageIdFromAlias,
getPackageVersionId,
PackageSaveResult,
PackageVersion,
validateId,
Expand Down Expand Up @@ -42,11 +43,16 @@ export class PackageVersionPromoteCommand extends SfdxCommand {

public async run(): Promise<PackageSaveResult> {
const conn = this.hubOrg.getConnection();
const packageId = getPackageIdFromAlias(this.flags.package, this.project) ?? (this.flags.package as string);
let packageId = getPackageIdFromAlias(this.flags.package, this.project) ?? (this.flags.package as string);

// ID can be 04t or 05i at this point
validateId([BY_LABEL.SUBSCRIBER_PACKAGE_VERSION_ID, BY_LABEL.PACKAGE_VERSION_ID], packageId);

if (packageId.startsWith('04t')) {
// lookup the 05i ID for getHasMetadataRemoved below
packageId = await getPackageVersionId(packageId, conn);
}

if (!this.flags.json && !this.flags.noprompt) {
// Warn when a Managed package has removed metadata
if (await getHasMetadataRemoved(packageId, conn)) {
Expand Down

0 comments on commit 256dbdb

Please sign in to comment.