Salesforce Developer Experience project is a structure or a directory of a configuration files. In this tutorial, we will learn how to create Salesforce DX project in Mac Terminal by cloning sfdx-dreamhouse.
Create Salesforce DX Project
To create Salesforce DX project, use a command like force:project:create, this command creates a skeleton to your Salesforce DX project.
prasanth:~ prasanth$ sfdx force:project:create -n tutorilkart.com target dir = /Users/Prasanth create tutorilkart.com/sfdx-project.json create tutorilkart.com/README.md create tutorilkart.com/.forceignore create tutorilkart.com/config/project-scratch-def.json
As shown in above code, tutoriakart.com is the project name. Once the project is created successfully, we must create sample configuration file like sfdx-project.json, config/project-scratch-def.json and .forceignore.
- sfdx-project.json file enables the configuration parameter to set Source API version and name space.
- project-scratch-def.json is used to create Scratch Org from the command line.
- .forceingnore is used to untrack certain files and folders when pushing files from local system to Scratch Orgs.
Create SFDX project from existing source (GitHub)
This is the second method of creating Salesforce DX project form existing source like Git and GitHub. In this method we create Salesforce DX project in Mac Terminal by cloning sfdx-dreamhouse. Follow the steps:
- Open terminal in Mac or Command Prompt in your Windows to create unique directory.
prasanth:~ prasanth$ mkdir tutorialkart_sfdxproject prasanth:~ prasanth$ cd tutorialkart_sfdxproject
- tutorialkart_sfdxproject is the directory name.
Cloning Sfdx-dreamhouse project
Use the following command to clone the app repository
prasanth:tutorialkart_sfdxproject prasanth$ git clone https://github.com/forcedotcom/sfdx-dreamhouse.git Cloning into 'sfdx-dreamhouse'... remote: Counting objects: 2073, done. remote: Compressing objects: 100% (9/9), done. remote: Total 2073 (delta 1), reused 3 (delta 0), pack-reused 2062 Receiving objects: 100% (2073/2073), 82.27 MiB | 251.00 KiB/s, done. Resolving deltas: 100% (851/851), done. prasanth:tutorialkart_sfdxproject prasanth$
Now the repository pulls every source code into our local system(Mac) as shown below.
Creating a project in Salesforce Developer experience is simple as shown and in our next step we should create Scratch Orgs, Push source metadata to Scratch Org and open the Scratch Org.