Update Your Unlocked Package
Your company is going to grow and change over time, and your apps are likely to do the same. Unlocked packages provide a robust and easy way to test, package, and deploy changes to your apps.
It doesn’t really matter what you change. That’s not the point of this quick start.
sf org create scratch --definition-file config/project-scratch-def.json
sf project deploy start
sf org assign permset --name GIFter
sf org open --path lightning/n/GIFter
Does it look good? Excellent!
- To prepare for creating the package version, open the
sfdx-project.json
file again, this time to update theversionNumber
to reflect the new version of the package. To reflect that it’s a minor version change, increment theversionNumber
to 1.1.0.{ "packageDirectories": [ { "path": "force-app", "default": true, "package": "GIFter", "versionName": "Summer '22", "versionNumber": "1.1.0.NEXT" } ], "namespace": "", "sfdcLoginUrl": "https://login.salesforce.com", "sourceApiVersion": "55.0", "packageAliases": { "GIFter": "0Hoxxx", "GIFter@1.0.0-1": "04txxx" } }
- Now, let’s create a package version containing your app with the updated source.
sf package version create --package GIFter --path force-app --installation-key test1234 --wait 10 --target-dev-hub DevHub
Successfully created the package version [08cxxx]. Subscriber Package Version Id: 04txxx. Package Installation URL: https://login.salesforce.com/packaging/installPackage.apexp?p0=04txxx As an alternative, you can use the "sf package install" command.
- Install and test the package version in a fresh scratch org.
sf org create scratch --definition-file config/project-scratch-def.json
sf package install --wait 10 --publish-wait 10 --package GIFter@1.1.0-1 --installation-key test1234 --no-prompt
sf org assign permset --name GIFter
sf org open --path lightning/n/GIFter
You’re getting the idea, right?
OK, testing is successful. Let’s install it to our TP.
Install New Package Version in Your TP
Your work is mostly done at this point. Since you’ve done such a great job of testing along the way, we can feel confident about this last step.
- Install the package version in your TP.
sf package install --target-org MyTP --wait 10 --package GIFter@1.1.0-1 --installation-key test1234 --no-prompt
You don’t have to assign the perm set again because it’s already in the org from your install of the previous package version.
- And finally, one last time, open your TP and run the app.
sf org open --path lightning/n/GIFter --target-org MyTP
- From Setup, enter
Installed Packages
in the Quick Find box, and select Installed Packages.
- Select GIFter.
More Info
We hope this quick start got you excited about the next evolution in packaging technology and helped you see the promise of unlocked packages. For more details about the power of unlocked packages, earn another badge by completing the Unlocked Packages for Customers module.