Should I go with 1GP or 2GP?
Because 2GP is better than 1GP for virtually anything you want to do. You can associate package versions to branches in your repo. You can undo a bad version by branching off an earlier version. The package is built on your own source code in the repo instead of residing a Packaging Org, where an accidental modification or deletion can break the package (in 1GP). The only reason why you'd want a 1GP is if the package requires 1GP-only features (see the Metadata Coverage Report).
If I decide to go with 1GP, should I create the Master App in the Packaging Org or a separate Dev Org?
You'll use the existing Master App that you already have as the source to get started. This should be in your Packaging Org. You'll just pull down the WaveTemplateBundle, create a Scratch Org, push to the org, and you're ready to go.
If I go with 1GP and a separate Dev Org for TCRM, who do I keep the same Namespace as proposed in https://help.salesforce.com/s/articleView?language=en_US&id=sf.bi_packaging_considerations.htm&type=5
Namespaces cannot be shared across Developer Edition orgs. You link a namespace to your Dev Hub Org, then you can create Scratch Orgs with that namespace.
If I go with 2GP, must I create the Master App and Template in a Namespaced Scratch Org?
The "Master App" will be created in each org. This video goes over the details (it doesn't use a namespace, but the steps should be identical).
Before you begin, you need some setup first. I'm going to assume that you've done nothing yet, so skip any steps you need to.
- Install VS Code,
sfdx-cli, and the Salesforce DX plugin
- Enable Dev Hub in a non-namespace Developer Edition or a production org
- Create a Developer Edition and set a namespace; this will be different than the Dev Hub org
- Link your namespace to the Dev Hub
- Authenticate with
sfdx force:auth:web:login or another means for both devhub and Developer Edition org
- Create repo or clone from an existing repo
- Create a local project with
sfdx-project.json and your Scratch Org Definition File (in the
config/ folder) to use the
- Commit everything
Once you've set everything up, now you can get to work with the template. Retrieve the
WaveTemplateBundle from the packaging org or whatever source org you have right now. You can do this by specifying package name
-n "Package Name", metadata type
-m WaveTemplateBundle, package manifest
-x package.xml, etc. You only need to do this once, as the Packaging Org/original source is no longer the "source of truth." That role now belongs to your repo.
Next, you will create your 2GP with
For development, you will generally go through the following steps:
- Create a new Git branch
- Create Scratch Org (
- Push the template to the Scratch Org (
- Create a new App (
- Update the template to use the new folder Id (
- Update the app to use the template (
- Do any work necessary in the JSON and push, or do any work in the app, update the template, and pull
- Commit changes
- Create new 2GP version
- Promote, if necessary
- Delete the Scratch Org when you're done with it
- Do any merges/pull requests
How do keep the Master App Id / Folder Id persistent when I just use Scratch Orgs?
You create a new app every time. It's not the app that's updating, it's the template. Like I mentioned earlier, the video goes over the entire process from start to finish, which is also outlined in the list above. Each org will have its own app. I haven't personally tested every step, but this looks fairly complete.