project convert source

Convert source-formatted files into metadata that you can deploy using Metadata API.

Description for project convert source 

To convert source-formatted files into the metadata format, so that you can deploy them using Metadata API, run this command. Then deploy the metadata using “sf project deploy”.

To convert Metadata API–formatted files into the source format, run “sf project convert mdapi”.

To specify a package name that includes spaces, enclose the name in single quotes.

To convert multiple components, either set multiple –metadata <name> flags or a single –metadata flag with multiple names separated by spaces. Enclose names that contain spaces in one set of double quotes. The same syntax applies to –source-dir.

Aliases for project convert source 

force:source:convert

Flags 

Flag Name (Long)Flag Name (Short)Description
‑‑api‑versionN/AType: Value

API Version to use in the generated project’s manifest. By default, will use the version from sfdx-project.json

Override the api version used for api requests made by this command
‑‑flags‑dirN/AType: Value

Import flag values from a directory.
‑‑jsonN/AType: Boolean

Format output as json.
‑‑manifest‑xType: Value

Path to the manifest (package.xml) file that specifies the metadata types to convert.

If you specify this flag, don’t specify –metadata or –source-dir.
‑‑metadata‑mType: Value

Metadata component names to convert.
‑‑output‑dir‑dType: Value
Default value: metadataPackage_1787758447448

Output directory to store the Metadata API–formatted files in.
‑‑package‑name‑nType: Value

Name of the package to associate with the metadata-formatted files.
‑‑root‑dir‑rType: Value

Source directory other than the default package to convert.
‑‑source‑dir‑pType: Value

Paths to the local source files to convert.

The supplied paths can be to a single file (in which case the operation is applied to only one file) or to a folder (in which case the operation is applied to all metadata types in the directory and its sub-directories).

If you specify this flag, don’t specify –manifest or –metadata.

Examples for project convert source 

Convert source-formatted files in the specified directory into metadata-formatted files; writes converted files into a new directory:

1sf project convert source --root-dir path/to/source

Similar to previous example, but writes converted files to the specified output directory and associates the files with the specified package:

1sf project convert source --root-dir path/to/source --output-dir path/to/outputdir --package-name 'My Package'