2

I am currently building a app to publish in market, done with with my development based on 2gp model, but

I am confused on final package creation that

  1. Should i need to create single manage package without dependency ?

  2. Can all packages can be manage package or only default pack ?

     {
     "packageDirectories": [
         {
             "path": "schema-pack",
             "default": true,
             "package": "package88Schema",
             "versionName": "ver 0.1",
             "versionNumber": "0.1.0.NEXT"
         },
         {
             "path": "common-pack",
             "default": false,
             "package": "package88Common",
             "versionName": "ver 0.1",
             "versionNumber": "0.1.0.NEXT",
             "dependencies": [
                 {
                     "package": "schema-pack",
                     "versionNumber": "0.1.0.LATEST"
                 }
             ]
         },
         {
             "path": "outbound-pack",
             "package": "package88Outbound",
             "versionName": "ver 0.1",
             "versionNumber": "0.1.0.NEXT",
             "default": false,
             "dependencies": [
                 {
                     "package": "schema-pack",
                     "versionNumber": "0.1.0.LATEST"
                 },
                 {
                     "package": "common-pack",
                     "versionNumber": "0.1.0.LATEST"
                 }
             ]
         },
         {
             "path": "inbound-pack",
             "default": false,
             "package": "package88Inbound",
             "versionName": "ver 0.1",
             "versionNumber": "0.1.0.NEXT",
             "dependencies": [
                 {
                     "package": "schema-pack",
                     "versionNumber": "0.1.0.LATEST"
                 },
                 {
                     "package": "common-pack",
                     "versionNumber": "0.1.0.LATEST"
                 }
             ]
         },
         {
             "path": "visual-pack",
             "default": false,
             "package": "package88Visual",
             "versionName": "ver 0.1",
             "versionNumber": "0.1.0.NEXT",
             "dependencies": [
                 {
                     "package": "schema-pack",
                     "versionNumber": "0.1.0.LATEST"
                 },
                 {
                     "package": "common-pack",
                     "versionNumber": "0.1.0.LATEST"
                 }
             ]
         }
     ],
     "namespace": "package88**",
     "sfdcLoginUrl": "https://login.salesforce.com",
     "sourceApiVersion": "49.0",
     "packageAliases": {
         "package88Schema": "0Ho88********",
         "package88Common": "0Ho88********",
         "package88Outbound": "0Ho88********",
         "package88Inbound": "0Ho88********",
         "package88Visual": "0Ho88********",
         "package88Schema@0.1.0-2": "0Ho88********"
     }
    

    }

All package was created as manage.

3

Let's list down pros and cons

Pros of using multiple packages and dependencies

  1. Application design is modular
  2. In future if the application code base grows you still have lots of agility.

Cons of multiple packages

  1. Currently as of today there is no package bundler provided by Salesforce so that means multiple install steps.

Salesforce (#safe harbor) has plans to give this functionality at some point!

For now one workaround is you can have a script or Salesforce CLI plugin or a web app created to make this easier for clients!

NPSP app does this approach today.

The other approach that apply for new customers is you encourage customers to start with Trial orgs where you have these packages configured already. This is useful if your package is distributed as OEM than distributing via appexchange!

Pros of single package

  1. Single install url

Cons of single package

  1. You need some more CI scripts to merge all these directories to one and then create a single 2GP managed package

  2. You will loose lot of 2GP managed package functionality like ability to use ancestry or dependency between packages, use modular patterns of app development and not having to worry about being a monolithic bundle of more than 10000 components by going this route.

Finally I want to leave here that too much modularization will also be not good and will turn into anti pattern. I would arrive at a balance between modularization and maintainence. Also one more factor that I would consider is if I want to sell this as a OEM package or an ISVForce Appexchange listing and want customers to install in their existing Salesforce environments.

The modularity I would define for 2GP managed package for Appexchange based on functionality than components!

Restrict number of packages to within 5 and still use 2GP features like ancestry and branching.

| improve this answer | |
1

Should i need to create single manage package without dependency ?

No, you can have multiple packages, but be aware that this means customers will need to install multiple packages, in the correct order. Consolidating to a single package may or may not be ideal, depending on your packaging needs. I don't know if there's any best practices around this, but I'd say you probably want to avoid having too many dependencies for customers to install.

Can all packages can be manage package or only default pack ?

Yes, you can have multiple managed packages all sharing the same namespace. This is one of the primary benefits of 2GMP (Second Generation Managed Packages).

| improve this answer | |

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.