package create

<!-- prettier-ignore-start -->

Create a package.

Description for package create

First, use this command to create a package. Then create a package version.

If you don’t have a namespace defined in your sfdx-project.json file, use --no-namespace.

Your --name value must be unique within your namespace.

Run 'sf package list to list all packages in the Dev Hub org.

Aliases for package create

force:package:create

Flags

Flag Name (Long) Flag Name (Short) Description
<code>‑‑api‑version</code> N/A Type: Value<br><br>Override the api version used for api requests made by this command
<code>‑‑description</code> <code>‑d</code> Type: Value<br><br>Description of the package.
<code>‑‑error‑notification‑username</code> <code>‑o</code> Type: Value<br><br>Active Dev Hub user designated to receive email notifications for package errors.<br><br>Email notifications include information about unhandled Apex exceptions, and install, upgrade, or uninstall failures associated with your package.
<code>‑‑flags‑dir</code> N/A Type: Value<br><br>Import flag values from a directory.
<code>‑‑json</code> N/A Type: Boolean<br><br>Format output as json.
<code>‑‑name</code> <code>‑n</code> Type: Value<br>Required<br><br>Name of the package to create.
<code>‑‑no‑namespace</code> <code>‑e</code> Type: Boolean<br><br>Create the package with no namespace; available only for unlocked packages.<br><br>This flag is useful when you’re migrating an existing org to packages. But use a namespaced package for new metadata.
<code>‑‑org‑dependent</code> N/A Type: Boolean<br><br>Depends on unpackaged metadata in the installation org; applies to unlocked packages only.<br><br>Use Source Tracking in Sandboxes to develop your org-dependent unlocked package. For more information, see "Create Org-Dependent Unlocked Packages" in the Salesforce DX Developer Guide.
<code>‑‑package‑type</code> <code>‑t</code> Type: Value<br>Required<br>Valid Values: Managed, Unlocked<br><br>Type of package.<br><br>The options for package type are Managed and Unlocked (Managed=DeveloperManagedSubscriberManaged, Unlocked=DeveloperControlledSubscriberEditable). These options determine upgrade and editability rules.
<code>‑‑path</code> <code>‑r</code> Type: Value<br>Required<br><br>Path to directory that contains the contents of the package.
<code>‑‑target‑dev‑hub</code> <code>‑v</code> Type: Value<br>Required<br><br>Username or alias of the Dev Hub org. Not required if the target-dev-hub configuration variable is already set.

Examples for package create

Create an unlocked package from the files in the "force-app" directory; uses your default Dev Hub org:

sf package create --name MyUnlockedPackage --package-type Unlocked --path force-app

Create a managed packaged from the "force-app" directory files, give the package a description, and use the specified Dev Hub org:

sf package create --name MyManagedPackage --description "Your Package Descripton" --package-type Managed --path force-app --target-dev-hub devhub@example.com
<!-- prettier-ignore-end -->