0

I am starting to play with the @salesforce/command extensions for SFDX cli and thinking of writing a script that could handle install all unlocked dependencies recursively. As per this question it seems this is not possible currently.

My thought was that we could utilise the resolve function from SFDXProjectConfig to access the dependencies list of the package directory then automatically call sfdx install command. This is working though we only get resolution for this level of the package dependencies list and if there are dependencies deeper - say this PackageC depends on PackageB but PackageB depends on PackageA - then we cannot programmatically access this tree.

I thought perhaps a call to sfdx force:package:version:report --verbose might give some dependency information that could be used to build this tree but no such luck.

Would anyone have another way (API) of programatically calling a package version created on a devhub and getting the list of dependencies for a given package?

1

I am writing the exact same plugin ( just right now ) and I have these kind of dependencies ( up to 2 nested ), but because those packages depend on a specific package the top-level package always depends on the lowest level which makes it always a dependency within that packages.

Even though there is a chance that that I could have a conflict between these packages, by simply putting in the dependencies in the correct order makes it always install in the correct order. But I am also thinking about for generating the sfdx-project file a third repo that maps out these dependencies.

I didn't get into the Dependancy API pilot but there is a small chance it would map these out, https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_metadatacomponentdependency.htm.

I would also post this in the success community for Unlocked packages, it's rather active https://success.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F93A000000Lg5U

  • That is good to know. I'm not sure I completely follow how the top-level package always depends on the lowest level but glad this is something people are working on. Perhaps there is an open source plugin out of this? I'm not on the pilot either but assumed that this would refer only to metadata deps within an org...? rather than package deps? will head over to the success community now – arbackhouse Dec 3 '18 at 11:56
0

Thanks to @depill for the tip off to the unlocked packages success community. The answer was in the excellent FAQ posted there. And there is docs here and a sample script. I will need to investigate this further but this is exactly what I was looking for as far as I can tell. Just need to implement this into a Sfdx plugin for ease of use.

Update: For those interested, here is an example of an install dependency script written using SFDX that I found searching through Github. Kudos to Texeï. https://github.com/texei/texei-sfdx-plugin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.