In this Chapter we will learn about how to Deploy metadata from Scratch Org to Sandbox/Production Environment using SFDX
Perquisites
Please go through Earlier Chapters in the Lightning Web Component Series before starting this one to get thorough understanding of the concepts.
Let’s get Started !
Scratch org does not have package.xml but will have it when we convert it into metadata format so that we can deploy it to sandbox/ production org.
Deploying metadata to a Salesforce instance
Much like existing tools such as the Force.com IDE and Migration Tool (ant), you’ll need a structured source directory (src) and a manifest file (package.xml) in order to deploy metadata.
Step 1: Convert source format to metadata format
Execute below command from the project
sfdx force:source:convert -d metadatadeploy
Converts metadata retrieved via Metadata API into the source format used in Salesforce DX projects.
-d Folder where metadata is generated
Step 2: Deploy from scratch to sandbox/ production org
Execute below command
Sfdx: force:mdapi:deploy -d depmetadata -u sandboxtodeploy
- Deploys file representations of components into an org
- You can deploy and retrieve up to 10,000 files or 400 MB (39 MB compressed) at one time.
-d Deployment folder where metadata is present
-u username of sandbox /prod org
When deploying, you can choose to wait until the deployment has completed (or until the specified number of minutes has expired)
sfdx force:mdapi:deploy -d metadatadeploy -w 5 -u sfdcSmriti
Step 3: Check deployment Status
Execute below command
sfdx force:mdapi:deploy:report
- Checks the current status of an asynchronous metadata deployment.
Together we can learn faster
Join LWC study group on Telegram
Subscribe to Youtube channel and blog to get latest updates
Reference
Lightning Web Component Superbadge
Convert and Deploy an exsisting app
Convert SFDX source to MDAPI source