generate Commands
generate function
Description for generate function
Both '--language' and '--name' are required flags. Function names must start with a capital letter.
Examples for generate function
Create a JavaScript function:
1sf generate function --function-name MyFunction --language javascriptUsage
- sf generate function
- [-n FUNCTION-NAME]
- -l LANGUAGE
Flags
- -n | --function-name FUNCTION-NAME
- Optional
-
Function name. Must start with a capital letter.
- Type: option
- -l | --language LANGUAGE
- Required
-
Language. Can be one of: javascript, typescript, java.
- Type: option
- Permissible values are: javascript, typescript, java
generate project
Description for generate project
A Salesforce DX project has a specific structure and a configuration file (sfdx-project.json) that identifies the directory as a Salesforce DX project. This command generates the basic scaffolding to get you started.
By default, the generated sfdx-project.json file sets the sourceApiVersion property to the default API version currently used by Salesforce CLI. To specify a different version, set the apiVersion configuration variable. For example:
1sf config set apiVersion=53.0 --globalExamples for generate project
Generate a project called MyProject:
1sf generate project --name MyProject
Generate the minimum number of files and directories:
1sf generate project --name MyProject --template empty
Generate the project in /Users/jdoe/sf-projects rather than the current directory:
1sf generate project --name MyProject --template empty --output-dir /Users/jdoe/sf-projectsUsage
- sf generate project
- [--json]
- [-p DEFAULT-PACKAGE-DIR]
- [-x]
- -n NAME
- [-s NAMESPACE]
- [-d OUTPUT-DIR]
- [-t TEMPLATE]
Flags
- --json
- Optional
-
Format output as json.
- Type: boolean
- -p | --default-package-dir DEFAULT-PACKAGE-DIR
- Optional
-
Default package directory name.
The default package directory name. Metadata items such as classes and Lightning bundles are placed inside this folder.
- Type: option
- Default value: force-app
- -x | --manifest
- Optional
-
Generate a manifest (package.xml) for change-set based development.
Generates a default manifest (package.xml) for fetching Apex, Visualforce, Lightning components, and static resources.
- Type: boolean
- -n | --name NAME
- Required
-
Name of the generated project.
Creates a project directory with this name. Also sets the "name" property in the sfdx-project.json file to this name.
- Type: option
- -s | --namespace NAMESPACE
- Optional
-
Project associated namespace.
The namespace associated with this project and any connected scratch orgs.
- Type: option
- -d | --output-dir OUTPUT-DIR
- Optional
-
Directory to store the newly created project files.
The location can be an absolute path or relative to the current working directory.
- Type: option
- Default value: .
- -t | --template TEMPLATE
- Optional
-
Template to use to create the project.
The template determines the sample configuration files and directories that this command generates. For example, the empty template provides these files and directory to get you started.
- .forceignore
- config/project-scratch-def.json
- sfdx-project.json
- package.json
- force-app (basic source directory structure)
The standard template provides a complete force-app directory structure so you know where to put your source. It also provides additional files and scripts, especially useful when using Salesforce Extensions for VS Code. For example:
- .gitignore: Use Git for version control.
- .prettierrc and .prettierignore: Use Prettier to format your Aura components.
- .vscode/extensions.json: When launched, Visual Studio Code, prompts you to install the recommended extensions for your project.
- .vscode/launch.json: Configures Replay Debugger.
- .vscode/settings.json: Additional configuration settings.
The analytics template provides similar files and the force-app/main/default/waveTemplates directory.
- Type: option
- Permissible values are: standard, empty, analytics
- Default value: standard