diff --git a/messages/chipps.package.dependencies.install.md b/messages/chipps.package.dependencies.install.md index bad422b..23b7adb 100644 --- a/messages/chipps.package.dependencies.install.md +++ b/messages/chipps.package.dependencies.install.md @@ -94,19 +94,19 @@ Number of minutes to wait for installation status. This command is supported only on API versions 36.0 and higher. -# error.devHubMissing - -This command requires a DevHub to be specified if providing a Package2Id instead of a SubscriberPackageVersionId. - # error.installationKeyFormat Installation Key should have the key:value format of SubscriberPackageVersionId:Key. You can use an alias in place of the SubscriberPackageVersionId. -# error.noSubscriberPackageVersionId +# error.invalidPackage2Id + +Unable to determine a valid Package2Id for %s. -Unable to determine the SubscriberPackageVersionId from the dependencies. +# error.invalidSubscriberPackageVersionId + +Unable to determine a valid SubscriberPackageVersionId for %s. # error.packageInstall @@ -124,6 +124,10 @@ Polling timeout exceeded Unable to establish connection to the org. +# error.targetDevHubMissing + +This command requires a DevHub to be specified if providing a Package2Id and VersionNumber instead of a SubscriberPackageVersionId. + # error.targetOrgConnectionFailed Unable to establish connection to the org. diff --git a/src/commands/chipps/package/dependencies/install.ts b/src/commands/chipps/package/dependencies/install.ts index c072129..5fa0ae8 100644 --- a/src/commands/chipps/package/dependencies/install.ts +++ b/src/commands/chipps/package/dependencies/install.ts @@ -23,6 +23,7 @@ import { } from '@salesforce/packaging'; import { Optional } from '@salesforce/ts-types'; import { + isPackageId, isPackageVersionId, isPackageVersionInstalled, reducePackageInstallRequestErrors, @@ -130,8 +131,6 @@ export default class PackageDependenciesInstall extends SfCommand { const { flags } = await this.parse(PackageDependenciesInstall); @@ -148,46 +147,31 @@ export default class PackageDependenciesInstall extends SfCommand 0) { + if (devHubDependencies.length > 0) { this.spinner.start('Resolving package versions from dev hub', '', { stdout: true }); if (!flags['target-dev-hub']) { - throw messages.createError('error.devHubMissing'); + throw messages.createError('error.targetDevHubMissing'); } // Initialize the authorization for the provided dev hub @@ -212,31 +196,30 @@ export default class PackageDependenciesInstall extends SfCommand; try { this.spinner.start(`Installing package ${packageToInstall.PackageName}`, '', { stdout: true }); - pkgInstallRequest = await this.subscriberPackageVersion.install(request, installOptions); + pkgInstallRequest = await subscriberPackageVersion.install(request, installOptions); this.spinner.stop(); } catch (error: unknown) { if (error instanceof SfError && error.data) { diff --git a/src/common/packageUtils.ts b/src/common/packageUtils.ts index abac827..4c1e8bd 100644 --- a/src/common/packageUtils.ts +++ b/src/common/packageUtils.ts @@ -13,13 +13,11 @@ type PackageInstallRequest = PackagingSObjects.PackageInstallRequest; export const PACKAGE_ID_PREFIX = '0Ho'; export const PACKAGE_VERSION_ID_PREFIX = '04t'; -export const isPackageId = (inputToEvaluate: string): boolean => { - return inputToEvaluate ? inputToEvaluate.startsWith(PACKAGE_ID_PREFIX) : false; -}; +export const isPackageId = (inputToEvaluate: string): boolean => + inputToEvaluate ? inputToEvaluate.startsWith(PACKAGE_ID_PREFIX) : false; -export const isPackageVersionId = (inputToEvaluate: string): boolean => { - return inputToEvaluate ? inputToEvaluate.startsWith(PACKAGE_VERSION_ID_PREFIX) : false; -}; +export const isPackageVersionId = (inputToEvaluate: string): boolean => + inputToEvaluate ? inputToEvaluate.startsWith(PACKAGE_VERSION_ID_PREFIX) : false; export const isPackageVersionInstalled = ( installedPackages: InstalledPackages[],