Skip to content

Commit a064fb4

Browse files
committed
fix: fix bundle cli issues dev preview
1 parent 1f5d307 commit a064fb4

8 files changed

Lines changed: 40 additions & 39 deletions

File tree

command-snapshot.json

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,9 @@
7474
{
7575
"alias": [],
7676
"command": "package:bundle:install",
77-
"flagAliases": ["apiversion", "targetdevhubusername", "targetusername", "u"],
78-
"flagChars": ["b", "o", "v", "w"],
79-
"flags": [
80-
"api-version",
81-
"bundle",
82-
"flags-dir",
83-
"json",
84-
"loglevel",
85-
"target-dev-hub",
86-
"target-org",
87-
"verbose",
88-
"wait"
89-
],
77+
"flagAliases": ["apiversion", "targetusername", "u"],
78+
"flagChars": ["b", "d", "o", "w"],
79+
"flags": ["api-version", "bundle", "dev-hub-org", "flags-dir", "json", "loglevel", "target-org", "verbose", "wait"],
9080
"plugin": "@salesforce/plugin-packaging"
9181
},
9282
{

messages/bundle_create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Create a package bundle in the Dev Hub org.
55
# description
66

77
A package bundle is an artifact that contains one or more 2GP managed packages.
8-
A bundle can be listed on AppExchange, installed, or upgraded as a single artifact.
8+
A bundle can be installed, or upgraded as a single artifact.
99

1010
# examples
1111

messages/bundle_install.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,29 @@ Install a specific version of a package bundle in the target org. During develop
88

99
# examples
1010

11-
Install a package bundle version in a scratch org:
11+
- Install a package bundle version in a scratch org:
1212

13-
sf package bundle install --bundle MyPkgBundle1@0.1 --target-org my-scratch-org --wait 10
13+
<%= config.bin %> <%= command.id %> --bundle MyPkgBundle1@0.1 --target-org my-scratch-org --dev-hub-org 00Dxx0000000000 --wait 10
14+
15+
- Install using a bundle version ID:
16+
17+
<%= config.bin %> <%= command.id %> --bundle 1Q8Wt0000000q1pKAA --target-org my-scratch-org --dev-hub-org 00Dxx0000000000 --wait 10
1418

1519
# flags.bundle.summary
1620

17-
Package bundle version to install (format: BundleName@Version).
21+
Package bundle version to install (format: BundleName@Version or bundle version ID).
1822

1923
# flags.target-org.summary
2024

2125
Target org for the bundle installation.
2226

23-
# flags.target-dev-hub.summary
27+
# flags.dev-hub-org.summary
28+
29+
Org ID of the dev hub org where the bundle was created.
30+
31+
# flags.dev-hub-org.description
2432

25-
Username, alias, or org ID of the target dev hub org.
33+
Specify the dev hub org ID directly (e.g., 00Dxx0000000000). This is the org where the bundle was originally created.
2634

2735
# flags.wait.summary
2836

@@ -55,4 +63,4 @@ Encountered errors installing the bundle! %s
5563
# bundleInstallInProgress
5664

5765
Bundle installation is currently %s. You can continue to query the status using
58-
sf package bundle install:report -i %s -o %s
66+
sf package bundle install report -i %s -o %s

messages/bundle_version_create_list.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# summary
22

3-
List package version creation requests.
3+
List package bundle version creation requests.
44

55
# description
66

src/commands/package/bundle/install.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
Flags,
1919
loglevel,
2020
orgApiVersionFlagWithDeprecations,
21-
requiredHubFlagWithDeprecations,
2221
requiredOrgFlagWithDeprecations,
2322
SfCommand,
2423
} from '@salesforce/sf-plugins-core';
@@ -46,7 +45,14 @@ export class PackageBundlesInstall extends SfCommand<BundleSObjects.PkgBundleVer
4645
}),
4746
'target-org': requiredOrgFlagWithDeprecations,
4847
'api-version': orgApiVersionFlagWithDeprecations,
49-
'target-dev-hub': requiredHubFlagWithDeprecations,
48+
'dev-hub-org': Flags.salesforceId({
49+
length: 'both',
50+
char: 'd',
51+
summary: messages.getMessage('flags.dev-hub-org.summary'),
52+
description: messages.getMessage('flags.dev-hub-org.description'),
53+
startsWith: '00D',
54+
required: true,
55+
}),
5056
wait: Flags.integer({
5157
char: 'w',
5258
summary: messages.getMessage('flags.wait.summary'),
@@ -62,15 +68,13 @@ export class PackageBundlesInstall extends SfCommand<BundleSObjects.PkgBundleVer
6268

6369
// Get the target org connection
6470
const targetOrg = flags['target-org'];
65-
const targetDevHub = flags['target-dev-hub'];
6671
const connection = targetOrg.getConnection(flags['api-version']);
67-
const devHubOrgId = targetDevHub.getOrgId();
6872

6973
const options: BundleInstallOptions = {
7074
connection,
7175
project: this.project!,
7276
PackageBundleVersion: flags.bundle,
73-
DevelopmentOrganization: devHubOrgId,
77+
DevelopmentOrganization: flags['dev-hub-org'],
7478
};
7579

7680
// Set up lifecycle events for progress tracking

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export class PackageBundlesCreate extends SfCommand<BundleSObjects.PackageBundle
130130
case BundleSObjects.PkgBundleVersionCreateReqStatus.error:
131131
throw messages.createError('multipleErrors', [result.Error?.join('\n') ?? 'Unknown error']);
132132
case BundleSObjects.PkgBundleVersionCreateReqStatus.success:
133-
this.log(messages.getMessage('bundleVersionCreateSuccess', [result.Id]));
133+
this.log(`Successfully created bundle version ${result.PackageBundleVersionId}`);
134134
break;
135135
default:
136136
this.log(messages.getMessage('InProgress', [camelCaseToTitleCase(result.RequestStatus as string), result.Id]));

test/commands/bundle/bundleInstall.test.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ const pkgBundleInstallQueuedResult: BundleSObjects.PkgBundleVersionInstallReqRes
6060
describe('package:bundle:install - tests', () => {
6161
const $$ = new TestContext();
6262
const testOrg = new MockTestOrgData();
63-
const testHubOrg = new MockTestOrgData();
6463
let installStub = $$.SANDBOX.stub(PackageBundleInstall, 'installBundle');
6564
const config = new Config({ root: import.meta.url });
6665

@@ -75,7 +74,7 @@ describe('package:bundle:install - tests', () => {
7574
};
7675

7776
before(async () => {
78-
await $$.stubAuths(testOrg, testHubOrg);
77+
await $$.stubAuths(testOrg);
7978
await config.load();
8079
});
8180

@@ -93,7 +92,7 @@ describe('package:bundle:install - tests', () => {
9392
installStub.resolves(pkgBundleInstallSuccessResult);
9493

9594
const cmd = new PackageBundlesInstall(
96-
['-b', 'TestBundle@1.0', '--target-org', 'test@org.org', '--target-dev-hub', 'test@hub.org'],
95+
['-b', 'TestBundle@1.0', '--target-org', 'test@org.org', '--dev-hub-org', '00D3i000000TNHYCA4'],
9796
config
9897
);
9998
stubSpinner(cmd);
@@ -118,7 +117,7 @@ describe('package:bundle:install - tests', () => {
118117
installStub.resolves(pkgBundleInstallSuccessResult);
119118

120119
const cmd = new PackageBundlesInstall(
121-
['-b', 'TestBundle@1.0', '--target-org', 'test@org.org', '--target-dev-hub', 'test@hub.org', '-w', '10'],
120+
['-b', 'TestBundle@1.0', '--target-org', 'test@org.org', '--dev-hub-org', '00D3i000000TNHYCA4', '-w', '10'],
122121
config
123122
);
124123
stubSpinner(cmd);
@@ -144,7 +143,7 @@ describe('package:bundle:install - tests', () => {
144143
installStub.resolves(pkgBundleInstallSuccessResult);
145144

146145
const cmd = new PackageBundlesInstall(
147-
['-b', 'TestBundle@1.0', '--target-org', 'test@org.org', '--target-dev-hub', 'test@hub.org', '--verbose'],
146+
['-b', 'TestBundle@1.0', '--target-org', 'test@org.org', '--dev-hub-org', '00D3i000000TNHYCA4', '--verbose'],
148147
config
149148
);
150149
stubSpinner(cmd);
@@ -170,7 +169,7 @@ describe('package:bundle:install - tests', () => {
170169
installStub.resolves(pkgBundleInstallQueuedResult);
171170

172171
const cmd = new PackageBundlesInstall(
173-
['-b', 'TestBundle@1.0', '--target-org', 'test@org.org', '--target-dev-hub', 'test@hub.org'],
172+
['-b', 'TestBundle@1.0', '--target-org', 'test@org.org', '--dev-hub-org', '00D3i000000TNHYCA4'],
174173
config
175174
);
176175
stubSpinner(cmd);
@@ -190,7 +189,7 @@ describe('package:bundle:install - tests', () => {
190189
// Normalize CRLF to LF to make assertion OS-agnostic
191190
const queuedMsg = String(logStub.args[0][0]).replace(/\r\n/g, '\n');
192191
expect(queuedMsg).to.equal(
193-
'Bundle installation is currently Queued. You can continue to query the status using\nsf package bundle install:report -i 08c3i000000fylgBBB -o test@org.org'
192+
'Bundle installation is currently Queued. You can continue to query the status using\nsf package bundle install report -i 08c3i000000fylgBBB -o test@org.org'
194193
);
195194
});
196195

@@ -200,7 +199,7 @@ describe('package:bundle:install - tests', () => {
200199

201200
try {
202201
const cmd = new PackageBundlesInstall(
203-
['-b', 'TestBundle@1.0', '--target-org', 'test@org.org', '--target-dev-hub', 'test@hub.org'],
202+
['-b', 'TestBundle@1.0', '--target-org', 'test@org.org', '--dev-hub-org', '00D3i000000TNHYCA4'],
204203
config
205204
);
206205
stubSpinner(cmd);
@@ -220,7 +219,7 @@ describe('package:bundle:install - tests', () => {
220219

221220
try {
222221
const cmd = new PackageBundlesInstall(
223-
['-b', 'TestBundle@1.0', '--target-org', 'test@org.org', '--target-dev-hub', 'test@hub.org'],
222+
['-b', 'TestBundle@1.0', '--target-org', 'test@org.org', '--dev-hub-org', '00D3i000000TNHYCA4'],
224223
config
225224
);
226225
stubSpinner(cmd);

test/commands/bundle/packageBundleVersionCreate.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ describe('package:bundle:version:create - tests', () => {
125125
});
126126
expect(warnStub.callCount).to.equal(0);
127127
expect(logStub.callCount).to.equal(1);
128-
expect(logStub.args[0]).to.deep.equal(['Successfully created bundle version for bundle 08c3i000000fylgAAA']);
128+
expect(logStub.args[0]).to.deep.equal(['Successfully created bundle version 05i3i000000fxw1AAA']);
129129
});
130130

131131
it('should create a new package bundle version with wait option', async () => {
@@ -154,7 +154,7 @@ describe('package:bundle:version:create - tests', () => {
154154
});
155155
expect(warnStub.callCount).to.equal(0);
156156
expect(logStub.callCount).to.equal(1);
157-
expect(logStub.args[0]).to.deep.equal(['Successfully created bundle version for bundle 08c3i000000fylgAAA']);
157+
expect(logStub.args[0]).to.deep.equal(['Successfully created bundle version 05i3i000000fxw1AAA']);
158158
});
159159

160160
it('should create a new package bundle version with verbose option', async () => {
@@ -184,7 +184,7 @@ describe('package:bundle:version:create - tests', () => {
184184
expect(warnStub.callCount).to.equal(0);
185185
expect(logStub.callCount).to.equal(2);
186186
expect(logStub.args[0]).to.deep.equal(['Package Bundle version creation completed with status: Success']);
187-
expect(logStub.args[1]).to.deep.equal(['Successfully created bundle version for bundle 08c3i000000fylgAAA']);
187+
expect(logStub.args[1]).to.deep.equal(['Successfully created bundle version 05i3i000000fxw1AAA']);
188188
});
189189

190190
it('should handle queued status', async () => {

0 commit comments

Comments
 (0)