Update Your Unlocked Package
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.
Here are the basic steps to test your change before you create the updated package version.
-
sfdx force:org:create -s -f config/project-scratch-def.json
-
sfdx force:source:push
-
sfdx force:user:permset:assign -n GIFter
-
sfdx force:org:open -p 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 '20" (new color), "versionNumber": "1.1.0.NEXT" } ], "namespace": "", "sfdcLoginUrl": "https://login.salesforce.com", "sourceApiVersion": "50.0", "packageAliases": { "GIFter": "0Hoxxx", "GIFter@1.0.0-1": "04txxx" } }
- Now, let’s create a package version containing your app with the updated source.
sfdx force:package:version:create -p GIFter -d force-app -k test1234 --wait 10 -v 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 "sfdx force:package:install" command.
- Install and test the package version in a fresh scratch org.
sfdx force:org:create -s -f config/project-scratch-def.json
sfdx force:package:install --wait 10 --publishwait 10 --package GIFter@1.1.0-1 -k test1234 --noprompt
sfdx force:user:permset:assign -n GIFter
sfdx force:org:open -p 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.
sfdx force:package:install -u MyTP --wait 10 --package GIFter@1.1.0-1 -k test1234 --noprompt
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.
sfdx force:org:open -p lightning/n/GIFter -u 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.