Skip to content

Starter package code for the 2GP Handbook from ISV Bedrock.

Notifications You must be signed in to change notification settings

sfdx-isv/2gp-starter-package

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The PURCHASE! App (Starter Version)

A simplified version of the PURCHASE! sample app. Used as a starter package by the introductory-level "Build" module in the 2GP Handbook from ISV Bedrock.

Step One (Recommended): Create a New Repository from this Template Repository

This project is published as a GitHub template repository. Any GitHub user can quickly create their own copy by following these steps.

  1. Open the 2GP Starter Package repo on GitHub.
  2. Click the Use this template button at the top-right of the page.
  3. Select the Create a new repository option.

After creating a new repository from this template repo...

  1. Click the Code button.
  2. Copy the HTTPS URL of your repo to the clipboard.
  3. Use your repo's URL to run the following command in your terminal.
    git clone PASTE_YOUR_REPO_URL_HERE

Step One (Alternative): Clone This Repository

If you don't want to create your own copy of this repo, simply run the following command in your terminal to get started.

git clone https://github.com/sfdx-isv/2gp-starter-package.git 

Step Two: Follow the 2GP Handbook for ISVs

Once you've cloned this project to your dev environment, follow the exercises in the 2GP Handbook for ISVs to learn how to build second-generation managed packages.

Additional Resources for 2GP

List of sf Commands Related to the Starter Package Project

Project Configuration

Set a default Developer Hub for your project.

sf config set target-dev-hub="DevHubOrg"

View the current local and global config values.

sf config list

Package Creation

Create new managed package (must update namespace in sfdx-project.json and force-app/main/default/flows/Approve_Purchase_Orders.flow-meta.xml first).

sf package create -n "PURCHASE! Starter Package" -r "force-app" -t "Managed"

Create a package version.

sf package version create  -c -x -w 10 -d "config/package-scratch-def.json" -p "PURCHASE! Starter Package"

View package version details.

sf package version report -p "PURCHASE! Starter Package@0.1.0-1" --verbose

Promote the package version you just created.

sf package version promote -p "PURCHASE! Starter Package@0.1.0-1"

Subscriber Testing

Create a Subscriber Test scratch org.

sf org create scratch -a "SubscriberTestScratchOrg" -f "config/subscriber-scratch-def.json"

Install a package version in the Subscriber Test scratch org.

sf package install -p "PURCHASE! Starter Package@0.1.0-1" -w 10 -s "AllUsers" -o "SubscriberTestScratchOrg"

Assign the PURCHASE_User permission set to the default user in the Subscriber Test scratch org.

sf org assign permset -n "PURCHASE_User" -o "SubscriberTestScratchOrg"

Open the Subscriber Test scratch org directly into Setup.
If you normally use Chrome, add the -b "firefox". If you normally use Firefox, add -b "chrome" instead. This way it's easy to know you're operating in your scratch org because it's a different browser than you normally use.

sf org open -o "SubscriberTestScratchOrg" -p "/lightning/setup/SetupOneHome/home" -b "firefox"

Package Development

Create a Package Development scratch org as your project's default org.

sf org create scratch -d -a "PackageDevOrg" -f "config/package-scratch-def.json"

Deploy package source to the default (Package Development) scratch org.

sf project deploy start

Assign the PURCHASE_User permission set to the default (Package Development) scratch org user. Note this is optional. It is not needed if you're only making declarative changes.

sf org assign permset -n "PURCHASE_User"

Open the default (Package Development) scratch org. If you normally use Chrome, add the -b "firefox". If you normally use Firefox, add -b "chrome" instead. This way it's easy to know you're operating in your scratch org because it's a different browser than you normally use.

sf org open -b "firefox"

Retrieve changes from the default (Package Development) scratch org.

sf project retrieve start

Deleting Scratch Orgs

Delete Subscriber Test scratch org

sf org delete scratch -p -o "SubscriberTestScratchOrg"

Delete Package Development scratch org

sf org delete scratch -p -o "PackageDevOrg"

About

Starter package code for the 2GP Handbook from ISV Bedrock.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages