Proper development process for Managed Package while using Scratch Orgs for development

managed-packagescratch-org

I've created the below diagram. I believe it is pretty much self-explanatory, however, I would like to point out a few stuff.

Managed Package Development Process

After some self-research and help from this community, my conclusion is:

  1. For developing Managed package (multi developers) we can use any DevHub Orgs.
  2. Later on, register the Package Org's namespace prefix on the DeveHub Org.
  3. Create Scratch Org and develop code based on the namespace prefix.
  4. Finally, give build to Package Org, from there firstly we need to create a beta Managed
    Package. Upon successful testing result, build the Released Managed Package.

These are my understandings, please do correct me where I'm wrong or provide me info about a better way.

My concerns:

  1. Create new Scratch Orgs after every 30 days, Is there a proper way to clone one scratch org to another rather than pushing all the files every time and manually setting up the org? Please provide me resources if possible.
  2. I believe I can use any ORG for QA testing/DevHub Orgs/Scratch Orgs. Are there any Salesforce recommendations for these ORG types? Suppose I have an enterprise edition production org, I have to create DevHub and other ORG from the Enterprise edition ORG or need to maintain org types for them, something like that?

Best Answer

Finally, give build to Package Org, from there firstly we need to create a beta Managed Package. Upon successful testing result, build the Released Managed Package.

You don't need to do a Beta, unless you want to have testing phases using the package. Recommended, just in case you accidentally introduce a field, object, class, dependency, etc by accident. You may wind up having several Beta packages to one Released package, or you may not have any. For example, you might do all your testing on Scratch Orgs/Sandboxes, then only build a Released package when all your tests pass.

Create new Scratch Orgs after every 30 days, Is there a proper way to clone one scratch org to another rather than pushing all the files every time and manually setting up the org? Please provide me resources if possible.

No, this is recommended. Most recommendations will say that you should create a Scratch Org for every "story" or "ticket", but I tend to reuse my Scratch Orgs until they expire. It should only take a few minutes to actually set up an org, including importing data, especially if you have scripts for this. It's not really a major hassle.

I believe I can use any ORG for QA testing/DevHub Orgs/Scratch Orgs. Are there any Salesforce recommendations for these ORG types? Suppose I have an enterprise edition production org, I have to create DevHub and other ORG from the Enterprise edition ORG or need to maintain org types for them, something like that?

You should generally not use a DevHub org for QA/testing/etc. A DevHub should typically be a BPO (Business Partner Org) or individual Developer Edition orgs, and these are not necessarily orgs you want to be testing in.

Scratch Orgs are great because they spin up quickly and are easy to set up, but some organizations prefer to have SSO or other setups that would make Sandboxes better for testing/QA purposes.

That said, you can certainly use any org that you would like to, and there are tradeoffs for each type. Overall, I wouldn't worry too much about the choice of org you use for QA/UAT/etc.

Related Topic