Skip to content

Commit a36c691

Browse files
committed
fix: address comments
1 parent 8a97c78 commit a36c691

4 files changed

Lines changed: 14 additions & 45 deletions

File tree

src/commands/package/bundle/delete.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ export class PackageBundleDeleteCommand extends SfCommand<BundleSaveResult> {
3535
'api-version': orgApiVersionFlagWithDeprecations,
3636
'no-prompt': Flags.boolean({
3737
char: 'n',
38-
deprecateAliases: true,
39-
aliases: ['noprompt'],
4038
summary: messages.getMessage('flags.no-prompt.summary'),
4139
}),
4240
bundle: Flags.string({

src/commands/package/bundle/install.ts

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
Flags,
1919
loglevel,
2020
orgApiVersionFlagWithDeprecations,
21+
requiredHubFlagWithDeprecations,
2122
requiredOrgFlagWithDeprecations,
2223
SfCommand,
2324
} from '@salesforce/sf-plugins-core';
@@ -45,11 +46,7 @@ export class PackageBundlesInstall extends SfCommand<BundleSObjects.PkgBundleVer
4546
}),
4647
'target-org': requiredOrgFlagWithDeprecations,
4748
'api-version': orgApiVersionFlagWithDeprecations,
48-
'target-dev-hub': Flags.string({
49-
char: 'v',
50-
summary: messages.getMessage('flags.target-dev-hub.summary'),
51-
required: true,
52-
}),
49+
'target-dev-hub': requiredHubFlagWithDeprecations,
5350
wait: Flags.integer({
5451
char: 'w',
5552
summary: messages.getMessage('flags.wait.summary'),
@@ -65,28 +62,15 @@ export class PackageBundlesInstall extends SfCommand<BundleSObjects.PkgBundleVer
6562

6663
// Get the target org connection
6764
const targetOrg = flags['target-org'];
68-
const targetDevHubFlag = flags['target-dev-hub'];
65+
const targetDevHub = flags['target-dev-hub'];
6966
const connection = targetOrg.getConnection(flags['api-version']);
70-
71-
// Check if targetDevHub is already a valid org ID (starts with 00D and is 18 characters)
72-
const orgIdRegex = /^00D[a-zA-Z0-9]{15}$/;
73-
let targetDevHub: string;
74-
75-
if (orgIdRegex.test(targetDevHubFlag)) {
76-
// It's already an org ID, use it directly
77-
targetDevHub = targetDevHubFlag;
78-
} else {
79-
// It's a username/alias, resolve it to an org and get the org ID
80-
const { Org } = await import('@salesforce/core');
81-
const devHubOrg = await Org.create({ aliasOrUsername: targetDevHubFlag, isDevHub: true });
82-
targetDevHub = devHubOrg.getOrgId();
83-
}
67+
const devHubOrgId = targetDevHub.getOrgId();
8468

8569
const options: BundleInstallOptions = {
8670
connection,
8771
project: this.project!,
8872
PackageBundleVersion: flags.bundle,
89-
DevelopmentOrganization: targetDevHub,
73+
DevelopmentOrganization: devHubOrgId,
9074
};
9175

9276
// Set up lifecycle events for progress tracking
@@ -114,10 +98,9 @@ export class PackageBundlesInstall extends SfCommand<BundleSObjects.PkgBundleVer
11498

11599
const result = await PackageBundleInstall.installBundle(connection, this.project!, {
116100
...options,
117-
polling: {
118-
timeout: Duration.minutes(flags.wait),
119-
frequency: Duration.seconds(5),
120-
},
101+
...(flags.wait && flags.wait > 0
102+
? { polling: { timeout: Duration.minutes(flags.wait), frequency: Duration.seconds(5) } }
103+
: undefined),
121104
});
122105

123106
const finalStatusMsg = messages.getMessage('bundleInstallFinalStatus', [result.InstallStatus]);

src/commands/package/bundle/version/create.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,9 @@ export class PackageBundlesCreate extends SfCommand<BundleSObjects.PackageBundle
117117

118118
const result = await PackageBundleVersion.create({
119119
...options,
120-
polling: {
121-
timeout: Duration.minutes(flags.wait),
122-
frequency: Duration.seconds(5),
123-
},
120+
...(flags.wait && flags.wait > 0
121+
? { polling: { timeout: Duration.minutes(flags.wait), frequency: Duration.seconds(5) } }
122+
: undefined),
124123
});
125124
const finalStatusMsg = messages.getMessage('bundleVersionCreateFinalStatus', [result.RequestStatus]);
126125
if (flags.verbose) {

src/commands/package/bundle/version/report.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,10 @@ export class PackageBundleVersionReportCommand extends SfCommand<BundleVersionRe
5454
throw new Error(`No bundle version found with ID: ${flags['bundle-version']}`);
5555
}
5656

57-
const massagedResults = this.massageResultsForDisplay(results);
58-
this.display(massagedResults, flags.verbose);
57+
this.display(results, flags.verbose);
5958
const componentPackages = await PackageBundleVersion.getComponentPackages(connection, flags['bundle-version']);
60-
const massagedResultsWithComponentPackages = {
61-
...massagedResults,
62-
componentPackages,
63-
};
64-
6559
this.displayComponentPackages(componentPackages);
66-
return massagedResultsWithComponentPackages;
60+
return { ...results, componentPackages };
6761
}
6862

6963
private display(record: BundleSObjects.BundleVersion, verbose: boolean): void {
@@ -182,12 +176,7 @@ export class PackageBundleVersionReportCommand extends SfCommand<BundleVersionRe
182176
}
183177
}
184178

185-
// eslint-disable-next-line class-methods-use-this
186-
private massageResultsForDisplay(results: BundleSObjects.BundleVersion): BundleSObjects.BundleVersion {
187-
// For bundle versions, the data is already in the correct format
188-
// Just return the results as they are
189-
return results;
190-
}
179+
191180

192181
private displayComponentPackages(componentPackages: PackagingSObjects.SubscriberPackageVersion[]): void {
193182
if (this.jsonEnabled()) {

0 commit comments

Comments
 (0)