Closed AllanOricil closed 1 year ago
Thank you for filing this feature request. We appreciate your feedback and will review the feature at our next grooming or sprint planning session. We prioritize feature requests with more upvotes and comments.
This issue has been linked to a new work item: W-12576536
This other feature would be useful when running a build plan
Maybe sfdx could even work like maven. I believe that implementing a builder like maven for Salesforce packages would really bring value for developers.
Shameless plug!! @AllanOricil you could try sfpowerscripts, checkout the documentation here https://docs.dxatscale.io/sfpowerscripts/sfpowerscripts
especially how we do builds https://docs.dxatscale.io/sfpowerscripts/build-and-quick-build
@azlam-abdulsalam I saw ur project, and it looks good. But this feature request is an improvement to turn sfdx into an actual package manager. Maven and NPM\YARN offer dependency resolution and instalation, so why can't sfdx do the same? This way CI/CD projects out there can stop reinventing the wheel all the time.
Is your feature request related to a problem? Please describe.
Yes, sfdx does not have a way to install package dependencies automatically. Builds are harder when working with deep nested dependency trees of salesforce packages and unpackaged metadata. I believe this could be one of the reasons sf developers don't break their metadata into more packages, and create deep nested depenency trees. For instance, you will hardly see this the following dependency tree in sfdx projects:
This dependency tree is useful to reduce build times, and release changes to Orgs much faster. For instance, package C would be updated much faster just because it has no apex classes(tests). While if it's metadata was inside Package B or A, which have apex classes, it would be necessary to spend 10x more time just for releasing the same changes.
What are you trying to do I want to automatically install all dependencies that are necessary for my package to build, like we do with other package managers such as npm and maven.
Describe the solution you'd like Today I discovered a maven feature that is exactly what I wish sfdx could offer. It is called maven "reactor"https://maven.apache.org/guides/mini/guide-multiple-modules.html. It is able to create a "build plan" based on one or multiple nodes of the dependency tree. I started to think what if sfdx could do that too?
For example:
Considering the following dependency tree:
When running
sfdx clean:install -p A
, sfdx would create the following build plan:C->-B->D->G->F->E->A
Or, as another example, when running
sfdx clean:install -p F
, sfdx would create the following build plan:G->F
Sfdx doesn't need to install packages in its first release of the "reactor". Outputting a "build plan" would be a really good start 👍
sfdx reactor:setup -p <package>
would create a new Scratch Org and deploy all packages and its dependenciessfdx reactor:install -p <package
would install and update packages and its dependenciesDescribe alternatives you've considered Install dependencies using this sfdx plugin https://github.com/texei/texei-sfdx-plugin/blob/master/src/commands/texei/package/dependencies/install.ts.
This plugin doesn't work with unpacked metadata, how to properly create a dependency tree, or even how to choose dependency versions given a range of dependencies.
Additional context https://maven.apache.org/guides/mini/guide-multiple-modules.html
Some sources of inspiration
Aggregation (sfdx-project.json): https://maven.apache.org/guides/introduction/introduction-to-the-pom.html#project-aggregation Dependency mechanism: https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html Dependency Ranges: https://docs.oracle.com/middleware/1212/core/MAVEN/maven_version.htm#MAVEN402