Keep up with the Latest Salesforce CLI Enhancements

Stay up to date with recent Salesforce CLI enhancements.

Where: These changes apply to Salesforce CLI version 2.117.7 and later.

How: Read the Salesforce CLI weekly release notes for detailed information about all the new and changed features and issue fixes in recent releases.

Generate New App Components

Use these new CLI commands to generate app artifacts.

  • template generate digital-experience site (Developer Preview): Generate an Experience Cloud site.
  • template generate flexipage (Beta): Generate a FlexiPage, also known as a Lightning page.
  • template generate ui-bundle: Generate a UI bundle, which contains the code and metadata to build a UI experience that uses non-native Salesforce frameworks, such as React.
  • ui-bundle dev: Preview a UI bundle locally and in real-time, without deploying it to your org.

This example generates a React-based UI bundle called MyReactApp in the force-app/main/default/uiBundles directory.

sf template generate ui-bundle --name MyReactApp --template reactbasic --output-dir force-app/main/default/uiBundles

Generate New Types of DX Projects

Use these new --template values to generate new types of DX projects with the template project generate command.

  • reactinternalapp or reactexternalapp: Template for generating a React-based internal or external DX project.
  • agent: Template for generating a DX project that contains a sample agent. The project also contains a scratch org configuration file that has the features and settings for creating an Agentforce-ready scratch org.

Also use the new --lwc-language typescript flag to set the language of the Lightning Web Components in the DX project to TypeScript. If not specified, the default is JavaScript.

This example shows how to generate a React-based DX project that contains scaffolding for external UI bundle use cases. Any Lightning Web Components in the project use TypeScript rather than the default JavaScript:

 sf template generate project --name myreactproject --template reactexternalapp --lwc-language typescript

Easily Show the Ignore Files in Your Project

The debug log information outputted by the --dev-debug flag (for any CLI command) now includes the list of files that the deployment or retrieval ignored. Use this information to debug your .forceignore file and understand exactly what's being ignored when you run project deploy|retrieve start.

New JIT Plugins

We added these two plugins to the just-in-time (JIT) list:

  • lightning-dev: Contains the lightning dev app, lightning dev component, and lightning dev site commands.
  • ui-bundle-dev: Contains the ui-bundle dev command.

Just-in-time (JIT) plugins aren't released in the core Salesforce CLI. Rather, when you run a CLI command that's contained in the plugin, Salesforce CLI first checks if the plugin is installed. If it's not, Salesforce CLI automatically installs it and then runs your command.

Add Comments to Flag Values Files (Community Contribution)

Improve the usability and maintainability of the configuration files that contain flag values by adding comments that begin with either # or //.

For example, say the file flags/sobject in your DX project contains the value of the --sobject flag of data create record. You can comment the file like this:

# Create a record in the Account object
Account

A member of the Salesforce CLI open-source community, Jon Freed, contributed this new feature. Thank you.