This template is a starting point for a Salesforce DX project building a managed second-generation package (2GP).
- Copy this template repo.
- Clone your copy into a working Salesforce development environment.
- Customize
sfdx-project.json(details below). - Create a managed 2GP (details below).
- Create a package development scratch org (details below).
- Start building your app.
Use only letters, numbers, and hyphens - when choosing a name. For example:
"name": "my-new-app",Use a namespace that is linked to the Developer Hub you plan to build from. For example:
"namespace": "my_namespace",Execute this command from the root of your SFDX project folder.
sf package create -n "My New 2GP App" -r sfdx-source/packaged -t ManagedThe package create command will have created a duplicate packageDirectory object in sfdx-project.json. Here's how to fix this.
- KEEP the original
packageDirectoryobject near the top ofsfdx-project.jsonby changing the value of thepackageproperty from"Package Name"to the name that appears in thepackageAliasesobject. - REMOVE the duplicate
packageDirectoryobject that was added near the bottom ofsfdx-project.json.
Execute this command from the root of your SFDX project folder.
npm install --prefix ./scripts/js If you get any warnings about security vulernabilities, execute this command
npm audit fix --prefix ./scripts/js Execute this command from the root of your SFDX project folder.
./toolbeltOnce this command finishes, you should be ready to start building.
This project is licensed under the BSD-3-Clause License - see the LICENSE file for details.