The Salesforce trailhead is good, although its verbose style makes it hard to use for a quick reference. This list is just for my benefit to quickly remember the relevant commands, but may be of wider use as well:
Salesforce DX Trailheads: https://trailhead.salesforce.com/modules/sfdx_app_dev
Basics
Action | Command |
---|---|
Update the CLI | sfdx update |
Set the dev hub instance | sfdx force:auth:web:login –setdefaultdevhubusername –setalias my-hub-org |
Create a new project | sfdx force:project:create -n myAwesomeNewProject |
Create a scratch org | sfdx force:org:create -s -f config/project-scratch-def.json -a GeoAppScratch |
Open the scratch org | sfdx force:org:open |
Pull the configurations & customizations from your scratch org to your local project | sfdx force:source:pull |
Pull data from your scratch org to your local project | sfdx force:data:tree:export -q “SELECT Name, Location__Latitude__s, Location__Longitude__s FROM Account WHERE Location__Latitude__s != NULL AND Location__Longitude__s != NULL” -d ./data |
Push your local project back to your scratch org | sfdx force:source:push |
Create a new Lightning component in your local project | sfdx force:lightning:component:create -n AccountListItem -d force-app/main/default/aura |
Create a new Lightning event in your local project | sfdx force:lightning:event:create -n AccountsLoaded -d force-app/main/default/aura |
Create another scratch org | sfdx force:org:create -f config/project-scratch-def.json -a GeoTestOrg |
Push local project to new scratch org | sfdx force:source:push -u GeoTestOrg |
Assign permission set to new scratch org | sfdx force:user:permset:assign -n Geolocation -u GeoTestOrg |
Upload data to new scratch org | sfdx force:data:tree:import -f data/Account.json -u GeoTestOrg |
Manage Dev Hub and packaging
Action | Command |
---|---|
Set the dev hub user name | sfdx force:config:set defaultdevhubusername=andrew@domain.com |
Create new project | sfdx force:org:create -f config/project-scratch-def.json -a TempUnmanaged |
Generate new password for scratch org | sfdx force:user:password:generate -u TempUnmanaged |
Display dev hub sratch org details | sfdx force:org:display -u TempUnmanaged |
Pull the source | sfdx force:source:pull -u TempUnmanaged |
Pull in package | sfdx force:mdapi:retrieve -s -r ./mdapipackage -p DreamInvest -u TempUnmanaged -w 10 |
Open resulting package | unzip unpackaged.zip -d |
Convert to metadata | sfdx force:mdapi:convert -r mdapipackage/ |
Delete the scratch org | sfdx force:org:delete -u TempUnmanaged |
Create a new sratch org | sfdx force:org:create -s -f config/project-scratch-def.json |
Push local project to new scratch org | sfdx force:source:push |
Assign permission set to new org | sfdx force:user:permset:assign -n DreamInvest |
Convert to metadata | sfdx force:source:convert -d mdapioutput/ |
List all orgs in dev hub | sfdx force:org:list |
Deploy to new scratch org | sfdx force:mdapi:deploy -d mdapioutput/ -u MyTPO -w 100 |