Newer Version Available

This content describes an older version of this product. View Latest

Use a Sample Repo to Get Started

The quickest way to get going with Salesforce DX is to clone the dreamhouse-lwc GitHub repo. Use its configuration files and Salesforce application to try some commonly used Salesforce CLI commands.
  1. Open a terminal or command prompt window, and clone the dreamhouse-lwc GitHub sample repo using HTTPS or SSH.
    1git clone https://github.com/trailheadapps/dreamhouse-lwc.git
    2--or--
    3git clone git@github.com:trailheadapps/dreamhouse-lwc.git
  2. Change to the dreamhouse-lwc project directory.
    1cd dreamhouse-lwc
  3. Authorize your Developer Hub (Dev Hub) org, set it as your default, and assign it an alias.
    1sfdx auth:web:login --setdefaultdevhubusername --setalias DevHub
    Enter your Dev Hub org credentials in the browser that opens. After you log in successfully, you can close the browser.
  4. Create a scratch org using the config/project-scratch-def.json file, set the username as your default, and assign it an alias.
    1sfdx force:org:create --setdefaultusername -f config/project-scratch-def.json --setalias my-scratch-org
  5. Push source and tests, located in the force-app directory, to the scratch org.
    1sfdx force:source:push
  6. Assign the dreamhouse permission set to the default user.
    1sfdx force:user:permset:assign -n dreamhouse
  7. Import sample data into the scratch org.
    1sfdx force:data:tree:import -p data/sample-data-plan.json
  8. Run Apex tests.
    1sfdx force:apex:test:run --resultformat human
  9. Open the scratch org and view the pushed metadata under Most Recently Used.
    1sfdx force:org:open
  10. In App Launcher, find and open Dreamhouse.