May 21, 2020
Think of a package as a stand-alone application, or a collection of metadata items that you can release on its own without having to release all packages. Packaging metadata makes your deployment process succinct and easier to manage. Packages are organized in a variety of ways, such as by app, by shared library, or by feature. However you organize your metadata packages, it’s important to have the sfdx-project.json file set up correctly so you can create and release new versions of your package.
- from VS Code , i opened “Documents” Folder
- I then opened Terminal and using below command cloned a project from github
- git clone https://github.com/developerforce/PermSetUnlockedPackage.git
- Authorized a Devhub : sfdx force:auth:web:login -d -a DevHub
- Created a scratch Org: sfdx force:org:create -f config/project-scratch-def.json -s
- Scratch orgs are defined by the project-scratch-def.json file, which resides in a project’s config directory.
- You don’t need a password because Salesforce DX stores a cached authentication token on your machine for the new scratch org.
- Created unlocked managed package
- sfdx force:package:create –name salesApps –description “My Package” –packagetype Unlocked –path force-app –nonamespace –targetdevhubusername DevHu
- Pushed metadata into sfdx force:source:push
- Created permission set manually in scratch org
- I pulled the permission set from Org to local source code sfdx force:source:pull
- I then upgraded the package manually in VSCODE. Go to sfdx-project.json and update VersionName & VersionNumber
- Created a New Version of the package
- sfdx force:package:version:create -p salesApps -d force-app -k test1234 –wait 10 -v DevHub
- To promote Package version -> sfdx force:package:version:promote -p [email protected] -v DevHub
- install the unmanaged package in DevHub (or Production)
- sfdx force:package:install –wait 10 –publishwait 10 –package [email protected] -k test1234 -r -u DevHub
- Source: https://trailhead.salesforce.com/content/learn/projects/perm-set-unlocked?trail_id=sfdx_get_started