What is @salesforce/source-deploy-retrieve?
@salesforce/source-deploy-retrieve is an npm package that provides tools for interacting with Salesforce metadata. It allows users to retrieve, deploy, and manage Salesforce source code and metadata from a Salesforce org. This package is particularly useful for developers and administrators who need to automate and streamline their Salesforce development and deployment processes.
What are @salesforce/source-deploy-retrieve's main functionalities?
Retrieve Metadata
This feature allows you to retrieve metadata from a Salesforce org. The code sample demonstrates how to use the SourceClient to retrieve metadata for a specific package and save it to an output directory.
const { SourceClient } = require('@salesforce/source-deploy-retrieve');
const client = new SourceClient();
client.retrieve({
packageNames: ['MyPackage'],
output: './outputDir'
}).then(result => {
console.log('Retrieve Result:', result);
}).catch(error => {
console.error('Error:', error);
});
Deploy Metadata
This feature allows you to deploy metadata to a Salesforce org. The code sample demonstrates how to use the SourceClient to deploy metadata from a specified source directory.
const { SourceClient } = require('@salesforce/source-deploy-retrieve');
const client = new SourceClient();
client.deploy({
sourcePath: './sourceDir'
}).then(result => {
console.log('Deploy Result:', result);
}).catch(error => {
console.error('Error:', error);
});
Convert Metadata
This feature allows you to convert metadata between different formats. The code sample demonstrates how to use the SourceClient to convert metadata from a source directory to an output directory.
const { SourceClient } = require('@salesforce/source-deploy-retrieve');
const client = new SourceClient();
client.convert({
sourcePath: './sourceDir',
outputDir: './outputDir'
}).then(result => {
console.log('Convert Result:', result);
}).catch(error => {
console.error('Error:', error);
});
Other packages similar to @salesforce/source-deploy-retrieve
sfdx-cli
The sfdx-cli package is the Salesforce CLI, which provides a powerful set of tools for managing Salesforce orgs, including retrieving and deploying metadata. It offers a broader range of functionalities compared to @salesforce/source-deploy-retrieve, including org management, data manipulation, and more.
jsforce
The jsforce package is a JavaScript library for Salesforce API integration. It provides tools for interacting with Salesforce data and metadata, including retrieving and deploying metadata. While it offers similar functionalities to @salesforce/source-deploy-retrieve, it also includes capabilities for working with Salesforce data and performing SOQL queries.
force-dev-tool
The force-dev-tool package is a command-line tool for Salesforce development. It provides functionalities for retrieving, deploying, and managing Salesforce metadata. It is similar to @salesforce/source-deploy-retrieve but is more focused on providing a command-line interface for Salesforce development tasks.
Salesforce source-deploy-retrieve
Introduction
A JavaScript toolkit for working with Salesforce metadata. Built to support the Salesforce CLI deploy and retrieve experience in the Salesforce VS Code Extensions, CLI plugins, and other tools working with metadata.
Features
- Resolve Salesforce metadata files into JavaScript objects
- Parse and generate manifest files
- Convert source files between SFDX File Formats
- Generate metadata packages with the option to automatically create a zip file
- Deploy and retrieve metadata with an org
- An index to reference available metadata types.
- Utilize promises with
async/await
syntax
Issues
Please report all issues to the issues only repository.
Usage
Install the package:
npm install @salesforce/source-deploy-retrieve
See HANDBOOK.md for usage and examples.
See API Docs
Contributing
See CONTRIBUTING.md for details on how to contribute to the library.
See developing.md for details on building and testing the library locally.
Publishing
SDR publishes when changes are merged into main
. The version is bumped per the rules of the release orb and standard-version.