Newer Version Available
Deploy the Package Metadata to the Packaging Org
Before you deploy the package metadata into your packaging org, you convert from source
format to metadata format.
It’s likely that you have some files that you don’t want to convert to metadata
format. Create a .forceignore file to indicate
which files to ignore.
-
Convert from source format to the metadata format.
sfdx force:source:convert --outputdir mdapi_output_dir --packagename managed_pkg_nameCreate the output directory in the root of your project, not in the package directory. If the output directory doesn’t exist, it’s created. Be sure to include the --packagename so that the converted metadata is added to the managed package in your packaging org.
-
Review the contents of the output directory.
ls -lR mdapi_output_dir
-
Authenticate the packaging org, if needed. This example specifies the org with
an alias called MyPackagingOrgAlias, which helps you refer to the org more
easily in subsequent commands.
sfdx auth:web:login --setalias MyPackagingOrgAliasYou can also authenticate with an OAuth client ID: sfdx auth:web:login --clientid oauth_client_id
-
Deploy the package metadata back to the packaging org.
sfdx force:mdapi:deploy --deploydir mdapi_output_dir --targetusername me@example.comThe --targetusername is the username. Instead of the username, you can use -u MyPackagingOrgAlias to refer to your previously defined org alias. You can use other options, like --wait to specify the number of minutes to wait. Use the --zipfile parameter to provide the path to a zip file that contains your metadata. Don’t run tests at the same time as you deploy the metadata. You can run tests during the package upload process.A message displays the job ID for the deployment.
-
Check the status of the deployment.
When you run force:mdapi:deploy, the job ID and target username are stored, so you don’t have to specify these required parameters to check the status. These stored values are overwritten when you run force:mdapi:deploy again.sfdx force:mdapi:deploy:reportIf you want to check the status of a different deploy operation, specify the job ID on the command line, which overrides the stored job ID.