Skip to content

Commit e7002f1

Browse files
fix: update imports to use 4 main classes
1 parent bb01fc9 commit e7002f1

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

src/commands/force/package/beta/installed/list.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import * as os from 'os';
99
import { Messages } from '@salesforce/core';
1010
import { SfdxCommand } from '@salesforce/command';
11-
import { packageInstalledList } from '@salesforce/packaging';
1211
import { CliUx } from '@oclif/core';
12+
import { Package } from '@salesforce/packaging';
1313

1414
Messages.importMessagesDirectory(__dirname);
1515
const messages = Messages.loadMessages('@salesforce/plugin-packaging', 'package_installed_list');
@@ -31,7 +31,7 @@ export class PackageInstalledListCommand extends SfdxCommand {
3131
public static readonly requiresProject = true;
3232

3333
public async run(): Promise<PackageInstalledListResult[]> {
34-
const result = await packageInstalledList(this.org.getConnection());
34+
const result = await Package.installedList(this.org.getConnection());
3535

3636
const records = result.map((record) => ({
3737
Id: record.Id,

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import * as os from 'os';
99
import { flags, FlagsConfig, SfdxCommand } from '@salesforce/command';
1010
import { Messages } from '@salesforce/core';
11-
import { PackageAncestry, PackageAncestryNodeData } from '@salesforce/packaging';
11+
import { PackageAncestryNodeData, PackageVersion } from '@salesforce/packaging';
1212

1313
// Import i18n messages
1414
Messages.importMessagesDirectory(__dirname);
@@ -41,11 +41,11 @@ export class PackageVersionDisplayAncestryCommand extends SfdxCommand {
4141
};
4242

4343
public async run(): Promise<PackageAncestryNodeData | string> {
44-
const packageAncestry = await PackageAncestry.create({
45-
packageId: this.flags.package as string,
46-
project: this.project,
47-
connection: this.hubOrg.getConnection(),
48-
});
44+
const packageAncestry = await PackageVersion.getAncestry(
45+
this.flags.package as string,
46+
this.project,
47+
this.hubOrg.getConnection()
48+
);
4949
const jsonProducer = packageAncestry.getJsonProducer();
5050
if (this.flags.dotcode) {
5151
const dotProducer = packageAncestry.getDotProducer();

test/commands/force/package/install.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ describe('force:package:install', () => {
245245
}
246246
});
247247

248+
// TODO: It seems that while linking @salesforce/packaging into the plugin
249+
// we cannot stub the library calls of `SfProject.getInstance` e.g. "SfProject, 'getInstance'"
250+
// once the library has been published, the stubs resume to work and this test will pass
248251
it('should print SUCCESS status correctly for package alias', async () => {
249252
// Stubs SfProject.getInstance, SfProject.getSfProjectJson, and SfProjectJson.getContents
250253
// in a way that makes TS happy... all to test package aliases.

0 commit comments

Comments
 (0)