Skip to content

Commit 8a5b17a

Browse files
authored
Merge pull request #1204 from salesforcecli/t/packaging-distribution/bundle-enhancement
@W-22308874@ Bundle enhancement
2 parents 4a0dafa + cb075ef commit 8a5b17a

7 files changed

Lines changed: 234 additions & 767 deletions

File tree

messages/bundle_install.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Install a specific version of a package bundle in the target org.
66

77
During developer preview, package bundles can be installed only in scratch orgs. To install a package bundle in a scratch org, add the PackageBundles feature to the scratch org definition file.
88

9-
# examples
9+
# examples
1010

1111
- Install a package bundle version in a scratch org and wait 10 minutes for the installation to complete:
1212

@@ -22,11 +22,11 @@ Username or alias of the org in which to install the package bundle version. Not
2222

2323
# flags.dev-hub-org.summary
2424

25-
Org ID of the Dev Hub org where the bundle was created.
25+
Username, alias, or ID of the Dev Hub org where the bundle was created.
2626

2727
# flags.dev-hub-org.description
2828

29-
Enter the Dev Hub org ID, such as 00Dxx0000000000.
29+
Enter the username, alias, or ID of the Dev Hub org, such as "admin@example.com", "myDevHub", or "00Dxx0000000000".
3030

3131
# flags.wait.summary
3232

messages/bundle_installed_list.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ List all installed package bundles in the target org.
44

55
# description
66

7-
Displays information about all package bundles currently installed in the target org, including the bundle details and the associated packages with their expected and actual versions.
7+
Displays information about all package bundles installed in the target org, including the bundle details and the associated packages with their expected and actual versions.
88

99
# examples
1010

1111
- List all installed package bundles in your default org:
1212

1313
<%= config.bin %> <%= command.id %>
1414

15-
- List all installed package bundles in a specific org:
15+
- List all installed package bundles in the example org myorg@example.com:
1616

1717
<%= config.bin %> <%= command.id %> --target-org myorg@example.com
1818

messages/bundle_uninstall.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ Uninstall a package bundle version from a target org.
44

55
# description
66

7-
Provide the package bundle version ID or alias and the target org to start an uninstall request. Optionally wait for the uninstall to complete.
7+
To start an uninstall request, provide the package bundle version ID or alias and the target org. Optionally enter the number of minutes to wait for the uninstall to complete. If the time to uninstall exceeds the number of minutes, the request times out.
88

99
# examples
1010

11-
- Uninstall a bundle version by ID from a specified org:
11+
- Uninstall a bundle version by ID from the example org myorg@example.com:
1212

13-
<%= config.bin %> <%= command.id %> --bundle 1Q8... --target-org me@example.com
13+
<%= config.bin %> <%= command.id %> --bundle 1Q8... --target-org myorg@example.com
1414

15-
- Uninstall a bundle version by alias from your default org and wait up to 10 minutes for completion:
15+
- Uninstall a bundle version by alias from your default org and wait up to 10 minutes to complete:
1616

17-
<%= config.bin %> <%= command.id %> --bundle MyBundle@1.2 -w 10
17+
<%= config.bin %> <%= command.id %> --bundle MyBundle@1.2 --wait 10
1818

1919
# flags.bundle.summary
2020

@@ -26,11 +26,11 @@ Number of minutes to wait for the uninstall request to complete.
2626

2727
# flags.verbose.summary
2828

29-
Show additional progress while waiting for uninstall to finish.
29+
Show additional progress information while waiting for the uninstall to finish.
3030

3131
# bundleUninstallWaitingStatus
3232

33-
Waiting %s more minutes for bundle uninstall. Current status: %s
33+
Waiting %s more minutes for the bundle to uninstall. Current status: %s
3434

3535
# bundleUninstallError
3636

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@oclif/core": "^4",
1111
"@salesforce/core": "^8.29.0",
1212
"@salesforce/kit": "^3.2.6",
13-
"@salesforce/packaging": "^4.22.12",
13+
"@salesforce/packaging": "^4.23.0",
1414
"@salesforce/sf-plugins-core": "^12.2.14",
1515
"chalk": "^5.6.2"
1616
},

src/commands/package/bundle/install.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
SfCommand,
2323
} from '@salesforce/sf-plugins-core';
2424
import { BundleSObjects, BundleInstallOptions, PackageBundleInstall } from '@salesforce/packaging';
25-
import { Messages, Lifecycle } from '@salesforce/core';
25+
import { Messages, Lifecycle, Org } from '@salesforce/core';
2626
import { camelCaseToTitleCase, Duration } from '@salesforce/kit';
2727

2828
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
@@ -45,12 +45,10 @@ export class PackageBundlesInstall extends SfCommand<BundleSObjects.PkgBundleVer
4545
}),
4646
'target-org': requiredOrgFlagWithDeprecations,
4747
'api-version': orgApiVersionFlagWithDeprecations,
48-
'dev-hub-org': Flags.salesforceId({
49-
length: 'both',
48+
'dev-hub-org': Flags.string({
5049
char: 'd',
5150
summary: messages.getMessage('flags.dev-hub-org.summary'),
5251
description: messages.getMessage('flags.dev-hub-org.description'),
53-
startsWith: '00D',
5452
required: true,
5553
}),
5654
wait: Flags.integer({
@@ -70,11 +68,22 @@ export class PackageBundlesInstall extends SfCommand<BundleSObjects.PkgBundleVer
7068
const targetOrg = flags['target-org'];
7169
const connection = targetOrg.getConnection(flags['api-version']);
7270

71+
const devHubInput = flags['dev-hub-org'];
72+
let devHubOrgId: string;
73+
// If the input already looks like a 15/18-char org ID starting with 00D, use it directly.
74+
// Otherwise resolve the alias or username through the auth store.
75+
if (/^00D[a-zA-Z0-9]{12}([a-zA-Z0-9]{3})?$/.test(devHubInput)) {
76+
devHubOrgId = devHubInput;
77+
} else {
78+
const devHubOrg = await Org.create({ aliasOrUsername: devHubInput });
79+
devHubOrgId = devHubOrg.getOrgId();
80+
}
81+
7382
const options: BundleInstallOptions = {
7483
connection,
7584
project: this.project!,
7685
PackageBundleVersion: flags.bundle,
77-
DevelopmentOrganization: flags['dev-hub-org'],
86+
DevelopmentOrganization: devHubOrgId,
7887
};
7988

8089
// Set up lifecycle events for progress tracking

0 commit comments

Comments
 (0)