Skip to content

Commit 256dbdb

Browse files
fix: look up 05i id if 04t is found for package:promote
1 parent e67f127 commit 256dbdb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/commands/force/package/beta/version/promote.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
BY_LABEL,
1313
getHasMetadataRemoved,
1414
getPackageIdFromAlias,
15+
getPackageVersionId,
1516
PackageSaveResult,
1617
PackageVersion,
1718
validateId,
@@ -42,11 +43,16 @@ export class PackageVersionPromoteCommand extends SfdxCommand {
4243

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

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

51+
if (packageId.startsWith('04t')) {
52+
// lookup the 05i ID for getHasMetadataRemoved below
53+
packageId = await getPackageVersionId(packageId, conn);
54+
}
55+
5056
if (!this.flags.json && !this.flags.noprompt) {
5157
// Warn when a Managed package has removed metadata
5258
if (await getHasMetadataRemoved(packageId, conn)) {

0 commit comments

Comments
 (0)