You are on page 1of 4

Salesforce DX Demo

Steps:
1. Sign up for 30 day dev hub trial org.
https://developer.salesforce.com/promotions/orgs/dx-signup

2. Link dev hub org with Salesforce CLI


sfdx force:auth:web:login -d -a DefaultHub
Login with your username in dev hub trial org

3. Create a scratch org


List all orgs – sfdx force:org:list
Make Project folder
mkdir sfdx
cd sfdx
sfdx force:project:create -n learnsfdx
ls ------ list all files
ls learnsfdx/ ----------go to folder
code . ---------open current directory in text editor

Change org name in project scratch def.json in VS code.


Go back to CLI
cd learnsfdx/
Command to create scratch org is
sfdx force:org:create -s -f config/project-scratch-def.json -a learnScratch
Again list all orgs
sfdx force:org:list
Open default org
sfdx force:org:open

4. Pushing and Pulling code from Scratch org


Open Scratch org from CLI using above command. Go to dev console and
create HelloComponent. Go to CLI
sfdx force:source:pull
code .
You can see hellocomponent in Vs code under force app. Edit the html
part in vs code. Back to cli
Sfdx force:source:push
Sfdx force:org:open and open devconsole then you can see the change
there
5. GIT
Type Git in cmd prompt to see, if git is properly installed or not.
Set your user email within git, to know who is putting commands

git config --global user.email "sugandha2612arya@gmail.com"


Create and clone git repository
Go to SFDX directory
cd sfdx/
Create a repo on GitHub and then copy the path to clone the repo. Go to
CLI and type the below cmd.
git clone YOUR REPO PATH COPIED
code YOUR REPO NAME
Create a README.md file in code editor and add some text in text editor.
Go back to CLI, go to your repo local directory
cd YOUR DIRECTORY NAME
git status
git add README.md
git commit -m “PUT MESSAGE FOR COMMIT”
git status
git push
git status
Create and switch to new branch
git branch
git branch readmeUpdate
git branch
git checkout readmeUpdate
code. --------------------Add some modifications to readme file in
readmeUpdate branch in text editor
git status
git add README.md
git status
git commit -m “Modified file”
git status
git push or git push --set-upstream origin readmeUpdate -------- now a
new branch will be visible in github with modified readme file
Merge changes in branches
git branch
git checkout master
code .
git merge readmeUpdate
git status
git push
Now check master branch readme file, it will also get updated.

Add GIT to your sfdx project, which we have created earlier


Go to your project folder in CLI, create a repository with project name in
GITHUB, and then type following commands in CLI.
git remote add origin https://github.com/suarya/learnSFDX.git ---> repo
name
git push -u origin master
Now, you can refresh your github repo and can see helloComponent
there
Deploying Component from scratch org to developer org
1. Clone a project from git repo into your local dir
git clone https://github.com/suarya/sfdx-component-bundle.git

cd sfdx-component-bundle

2. Login into your devhub org


sfdx force:auth:web:login -d -a DefaultHub

3. Create a scratch org.


sfdx force:org:create -s -f config/project-scratch-def.json -s -a
sfdxdemo

4. Push metadata in scratch org.


sfdx force:source:push

5. Open Scratch org


sfdx force:org:open

6. Login into dev org


sfdx force:auth:web:login

7. Make directory to store converted package


mkdir convertedPackage

sfdx force:source:convert --outputdir convertedPackage/


--packagename hellocomponent -------putting comp in
convertedpackage folder

sfdx force:mdapi:deploy --deploydir convertedpackage/


--targetusername sugandha_arya@xyz.com ------deploying package in
dev org

sfdx force:mdapi:deploy:report –------ track the deployment

You might also like