sfdx force:auth:web:login -d -a DevHub
here DevHub is an alias of Salesforce instance where we enable "DevHub and Unlocked Packages and Second-Generation Managed Packages"
{ "packageDirectories": [ { "path": "force-app", "default": true } ], "namespace": "", "sfdcLoginUrl": "https://login.salesforce.com", "sourceApiVersion": "50.0" }
sfdx force:package:create --name testunlocked --description "testunlocked package" --packagetype Unlocked --path force-app --nonamespace --targetdevhubusername DevHub
sfdx force:package:version:create -p testunlocked -d force-app -k test1234 --wait 10 -v DevHub --codecoverage --codecoverage Calculate and store the code coverage percentage by running the Apex tests included in this package version. Before you can promote and release a managed or unlocked package version, the Apex code must meet a minimum 75% code coverage requirement. Without this it is not possible to promote.
sfdx force:package:version:promote -p testunlocked@0.1.0-1 -v DevHub
sfdx force:package:install --wait 10 --publishwait 10 --package testunlocked@0.1.0-1 -k test1234 -r -u PackageDemoOrg
here PackageDemoOrg is alias of Salesforce instace where we want to install our package
Now that you’ve created a Salesforce DX project, what’s next? Here are some documentation resources to get you started.
Do you want to deploy a set of changes, or create a self-contained application? Choose a development model.
The sfdx-project.json file contains useful configuration information for your project. See Salesforce DX Project Configuration in the Salesforce DX Developer Guide for details about this file.