Convert a managed-released first-generation managed package into a second-generation managed package.
Description for package convert
The package conversion command automatically selects the latest released major.minor first-generation managed package version, and converts it into a second-generation managed package version.
Use –patch-version to specify a released patch version.
To retrieve details about a package version create request, including status and package version ID (04t), run “sf package version create report -i 08c…”.
To protect the contents of your package and to prevent unauthorized installation of your package, specify the –installation-key flag.
To promote a package version to released, you must use the –code-coverage parameter. The package must also meet the code coverage requirements.
To list package version creation requests in the org, run “sf package version create list”.
Aliases for package convert
force:package:convert
Flags
Flag Name (Long)
Flag Name (Short)
Description
‑‑api‑version
N/A
Type: Value
Override the api version used for api requests made by this command
‑‑code‑coverage
‑c
Type: Boolean
Calculate and store the code coverage percentage by running the packaged Apex tests included in this package version.
Before you can promote and release a managed package version, the Apex code must meet a minimum 75% code coverage requirement.
‑‑definition‑file
‑f
Type: Value
Path to a definition file that contains features and org preferences that the metadata of the package version depends on.
This definition file is similar to the scratch org definition file.
‑‑flags‑dir
N/A
Type: Value
Import flag values from a directory.
‑‑installation‑key
‑k
Type: Value
Installation key for key-protected package.
Either an –installation-key value or the –installation-key-bypass flag is required.
‑‑installation‑key‑bypass
‑x
Type: Boolean
Bypass the installation key requirement.
If you bypass this requirement, anyone can install your package. Either an –installation-key value or the –installation-key-bypass flag is required.
‑‑json
N/A
Type: Boolean
Format output as json.
‑‑package
‑p
Type: Value Required
ID (starts with 033) of the first-generation managed package to convert.
‑‑patch‑version
‑a
Type: Value
Specific released patch version to be converted.
Specify a released patch version as major.minor.patch to convert to a second-generation managed package version.
‑‑seed‑metadata
‑m
Type: Value
Directory containing metadata to be deployed prior to conversion.
The directory containing metadata that will be deployed on the build org prior to attempting package conversion.
‑‑target‑dev‑hub
‑v
Type: Value Required
Username or alias of the Dev Hub org. Not required if the target-dev-hub configuration variable is already set.
‑‑verbose
N/A
Type: Boolean
Display verbose command output.
‑‑wait
‑w
Type: Value Default value:0 minutes
Minutes to wait for the package version to be created.
Examples for package convert
Create a second-generation managed package version from the first-generation managed package with the specified ID and give it the installation key “password123”; uses your default Dev Hub org: