template generate project
Generate a Salesforce DX 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 necessary configuration files and directories 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: “sf config set apiVersion=57.0 –global”.
force:project:create
project:generate
| Flag Name (Long) | Flag Name (Short) | Description |
|---|---|---|
‑‑api‑version | N/A | Type: Value Will set this version as sourceApiVersion in the sfdx-project.json file Override the api version used for api requests made by this command |
‑‑default‑package‑dir | ‑p | Type: Value Default value: force-appDefault package directory name. Metadata items such as classes and Lightning bundles are placed inside this folder. |
‑‑flags‑dir | N/A | Type: Value Import flag values from a directory. |
‑‑json | N/A | Type: Boolean Format output as json. |
‑‑lwc‑language | N/A | Type: Value Valid Values: javascript, typescriptLanguage of the Lightning Web Components. If not specified, “javascript” is used. When set to 'typescript', generates TypeScript configuration files (tsconfig.json, package.json with TypeScript dependencies, and TypeScript-aware ESLint config). When you deploy the TypeScript-based Lightning Web Components, the TypeScript files are first compiled locally for validation and then the .ts files are deployed to your org for server-side type stripping. |
‑‑manifest | ‑x | Type: Boolean 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. |
‑‑name | ‑n | Type: Value Required Name of the generated project. Generates a project directory with this name; any valid directory name is accepted. Also sets the “name” property in the sfdx-project.json file to this name. |
‑‑namespace | ‑s | Type: Value Namespace associated with this project and any connected scratch orgs. |
‑‑output‑dir | ‑d | Type: Value Default value: .Directory for saving the created files. The location can be an absolute path or relative to the current working directory. The default is the current directory. |
‑‑template | ‑t | Type: Value Valid Values: standard, empty, analytics, reactinternalapp, reactexternalapp, agentDefault value: standardTemplate to use for project creation. 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.
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:
The analytics template provides similar files and the force-app/main/default/waveTemplates directory. The reactinternalapp and reactexternalapp templates provide React-based project scaffolding for internal and external UI bundle use cases. The agent template provides project scaffolding for building Agentforce agents and includes a sample agent called Local Info Agent. |
Generate a project called “mywork”:
Similar to previous example, but generate the files in a directory called “myapp”:
Similar to prevoius example, but also generate a default package.xml manifest file:
Generate a project with the minimum files and directories:
Generate a project in which the Lightning Web Components use TypeScript rather than the default JavaScript: