Creating a package
All packages start out as directory in your repo!
A package is a collection of metadata grouped together in a directory, and defined by an entry in your sfdx-project.json ( Project Manifest).
Each package in the context of sfp need to have the following attributes as the absolute minimum
Attribute | Required | |
---|---|---|
path | yes | Path the the directory that contains the contents of the package |
package | yes | The name of the package |
versionNumber | yes | The version number of the package |
versionDescription | no | Description for a particular version of the package |
sfp will not consider any entries in your sfdx-project.json for its operations if it is missing 'package' or 'versionNumber' attribute, By default, sfp treats all entries in sfdx-project.json as Source Packages. If you need to create an unlocked or an org depednent unlocked package, you need to proceed to create the packages using the follwing steps detailed below
sfp-pro users can create a source package by using the following command,
sfp package create source -n "my-source-package" --domain "my-domain" -r "path"
Creating an Unlocked Package
Creating an Unlocked Package with SF CLI
To create an unlocked package using the Salesforce CLI, follow the steps below:
Identify the Package Directory: Ensure that your
sfdx-project.json
contains an entry for the package you wish to turn into an unlocked package. The entry must includepath
,package
, andversionNumber
.Create a Package: If the package does not already exist, create it with the command:
Replace
<package_name>
with the name of your unlocked package, with the package directory specified in yoursfdx-project.json
, and<alias_for_org>
with the alias for your Salesforce org.Ensure that an entry for your package is created in your packageAliases section. Please commit the updated sfdx-project.json to your version control, before proceeding with sfp commands
sfp-pro users can create an unlocked package by using the following command,
sfp package create unlocked -n "my-unlocked-package" --domain "my-domain" -r "path" -v devhub
Creating an Org Dependent Unlocked Package
Creating an Org Dependent Unlocked Package with SF CLI
To create an unlocked package using the Salesforce CLI, follow the steps below:
Identify the Package Directory: Ensure that your
sfdx-project.json
contains an entry for the package you wish to turn into an unlocked package. The entry must includepath
,package
, andversionNumber
.Create a Package: If the package does not already exist, create it with the command:
Replace
<package_name>
with the name of your unlocked package, with the package directory specified in yoursfdx-project.json
, and<alias_for_org>
with the alias for your Salesforce org.Ensure that an entry for your package is created in your packageAliases section. Please commit the updated sfdx-project.json to your version control, before proceeding with sfp commands
sfp-pro users can create an org dependent unlocked package by using the following command,
sfp package create unlocked -n "my-unlocked-package" --domain "my-domain" -r "path" --orgdepedendent -v devhub
Creating a data package
Identify the Package Directory: Ensure that your
sfdx-project.json
contains an entry for the package you wish to turn into an unlocked package. The entry must includepath
,package
, andversionNumber
.Ensure your package directory is populated with an export-json and the required CSV files. Read on here to learn more about data packages
Add an additional attribute of "type":"data"
sfp-pro users can create a diff package by using the following command,
sfp package create data -n "my-source-package" -r "path" --domain "my-domain"
Creating a diff package
Identify the Package Directory: Ensure that your
sfdx-project.json
contains an entry for the package you wish to turn into an unlocked package. The entry must includepath
,package
, andversionNumber
.Ensure your package directory is populated with an export-json and the required CSV files. Read on here to learn more about diff packages
Add an additional attribute of "type":"diff"
Ensure a new record is created in SfpowerscriptsArtifact2__c object in your devhub, with the details such as the name of the package, the initial version number, the baseline commit id
sfp-pro users can create a diff package by using the following command,
sfp package create diff -n "my-diff-package" -r "path" -c "commit-id" --domain "my-domain" -v devhub
Last updated