From 3391fbc4f71c129656e52598b710464352ae28db Mon Sep 17 00:00:00 2001 From: Alan Jaouen <14994179+alanjaouen@users.noreply.github.com> Date: Mon, 22 Jul 2024 20:31:38 +0000 Subject: [PATCH] feat(dependency:install): add release def filter --- messages/dependency_install.json | 7 ++++--- src/commands/dependency/install.ts | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/messages/dependency_install.json b/messages/dependency_install.json index 65437b7f3..ad8c1e13c 100644 --- a/messages/dependency_install.json +++ b/messages/dependency_install.json @@ -1,4 +1,5 @@ { - "commandDescription":"Install all the external dependencies of a given project", - "installationkeysFlagDescription":"Installation key for key-protected packages (format is packagename:key --> core:key nCino:key vlocity:key to allow some packages without installation key)" -} \ No newline at end of file + "commandDescription":"Install all the external dependencies of a given project", + "configFileFlagDescription":"Path to the config file which determines which external dependency are being installed based on packages in release config", + "installationkeysFlagDescription":"Installation key for key-protected packages (format is packagename:key --> core:key nCino:key vlocity:key to allow some packages without installation key)" +} diff --git a/src/commands/dependency/install.ts b/src/commands/dependency/install.ts index 293283389..296c7952c 100644 --- a/src/commands/dependency/install.ts +++ b/src/commands/dependency/install.ts @@ -8,6 +8,7 @@ import InstallUnlockedPackageCollection from '../../core/package/packageInstalle import SFPOrg from '../../core/org/SFPOrg'; import { Flags } from '@oclif/core'; import { loglevel, targetdevhubusername, requiredUserNameFlag } from '../../flags/sfdxflags'; +import ReleaseConfigLoader from '../../impl/release/ReleaseConfigLoader'; // Initialize Messages with the current plugin directory Messages.importMessagesDirectory(__dirname); @@ -30,6 +31,9 @@ export default class Install extends SfpCommand { required: false, description: messages.getMessage('installationkeysFlagDescription'), }), + releaseconfig: Flags.string({ + description: messages.getMessage('configFileFlagDescription'), + }), loglevel }; @@ -43,10 +47,17 @@ export default class Install extends SfpCommand { ProjectConfig.getSFDXProjectConfig(null), this.flags.installationkeys ); - let externalPackage2s = await externalPackageResolver.resolveExternalPackage2DependenciesToVersions(); + + let packages = null; + if (this.flags.releaseconfig) { + let releaseConfigLoader: ReleaseConfigLoader = new ReleaseConfigLoader(new ConsoleLogger(), this.flags.releaseconfig); + packages = releaseConfigLoader.getPackagesAsPerReleaseConfig(); + } + + let externalPackage2s = await externalPackageResolver.resolveExternalPackage2DependenciesToVersions(packages); SFPLogger.log( - `Installing external package dependencies of this project in ${username}`, + `Installing external package dependencies of this project in ${username}`, LoggerLevel.INFO, new ConsoleLogger() );