(gentle music)
- [Satya] Hi everyone, I'm Satya working
as developer evangelist with Salesforce.
In this Quick Take, I'll walk you through how
to create a new Salesforce development project in VSCode
and also make you understand the project structure.
Here we are in Visual Studio Code.
You have different options
to create Salesforce DX project in VSCode,
depending on how you want to begin.
You can create the project using the command palette
or by using the Salesforce CLI in the integrated terminal.
Let's first see how we can create the project
using the SFDX command from the command pallete.
You can open the command pallete
by clicking this gear icon in the activity bar
at the bottom left.
You can alternatively invoke the command palette
from the menu bar or by using the shortcut keys.
Control + Shift + P for windows
and Command + Shift + P for Mac.
In the command palette, type SFDX.
You can create the SFDX project with
or without manifest file.
If you create the project with a manifest,
it creates an addition folder called Manifest.
This folder contains a package.xml file.
You can modify this file to select dually
to drive the data from the Arch.
Let's first creative project without manifest file.
Let us select SFDX create project.
This will start a tiny wizard,
here we have three choices,
If you select the Standard project template,
it creates a project structure with some default folders
and files to save your configuration and the metadata.
If you select the second option
that is empty project template,
it creates a minimal set of folders and files.
If you want to work on an analytics project,
you can select the third option.
So let's select standard project template
which is the default option.
Let's give a name for the project,
let's say Demo Project and press Enter.
Let's select some location on the system
and click create project.
Now it creates a project folding for you.
Now that the project is created,
let us examine the project structure.
SFDX project has a specific project structure
and source format.
You can see an ordinary set of files and folders.
Let us start with sfdxproject.json.
Package directory section contains a list of folders
that contains the SFDX source or metadata
that can be transferred to and from the OX.
You can have one or more directories listed here,
but only one of those directories
can be a default directory.
In this case, force-app is the default package directory.
SFDX assumes that the files stored
here are the source metadata.
If you expand this folder,
you can see that it has a list of folders.
Each of which can hold specific metadata.
For instance, the classes folder can contain apex classes.
Similarly, the layout folder holds the metadata related
to page layouts, et cetera.
This way the metadata is well organized
and easy to maintain.
With this structure,
SFDX knows where to store the pull data from the Arch.
You can delete the folders that you might not be using
in your project to keep your project
and source repository clean.
For instance, you can delete the other folder
if you are not creating the lighting components.
The .sfdx folder, stores the configurations
that are internally used by Salesforce DX
and similarly, .vscode stores the configuration
like the launch configuration,
source configuration, et cetera
that is used by the VSCode.
Config folder holds one file for now
in which you can define settings
to create these Scratch App.
We can ignore this for now
and we'll cover this in detail in another Quick Take.
Scripts folder has dedicated folders
for anonymous apex and SQL.
It has a sample anonymous apex code and a SQL query.
You can create your anonymous apex code and SQL files to try
and then use them in the project.
.ignore files can be used
to exclude any files from processing.
For example, the file types listed in .eslintigore,
will not be processed by lint
Similarly, the files in .forceignore
will not be pushed into the Arch.
The files in the .gitignore
will not be pushed into the repository.
.prettierignore and .prettierrc files
store the configuration related
to prettier formatting of your code.
Package.json holds the dependencies
and scripts related to Node.js
It also creates the sample README.md file
which you can modify
to provide project related startup guides,
and documentation.
As I said earlier, you can also use the CLI
to create the project.
Let us open the terminal
and type the command SFDX force:projectcreate -h.
It launches the help file,
and we can see the description of this command.
You have the command syntax,
various options that can be applied
while creating the project,
description and some examples.
The first example here creates a project named mywork.
The second example creates a project
with a default package directory named myapp
instead of force-app.
The third example creates a project with the manifest file.
And the fourth example creates a project
with an empty project template.
Let's copy one of the examples
and paste it into the command line.
Let us name the project CLI Demo.
There it is, let us open the Explorer
and click open folder
and select the newly created project folder.
You can now continue working on your project.
In this video, we saw how to create a Salesforce DX project.
We also cover how to create the project
from the command line.
Hope you enjoyed this Quick Take.
Also watch a Quick Take linked in the description below
that covers working with scratch apps, dialer prediction
and Sandbox using the VSCode.
Thanks for watching.
If you learn something, be sure to like this video.
If you want to get more content
like this pushed directly to you,
click subscribe and the bell to get notifications.