package create

Create a package.

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.

force:package:create

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

Override the api version used for api requests made by this command
‑‑description‑dType: Value

Description of the package.
‑‑error‑notification‑username‑oType: Value

Active Dev Hub user designated to receive email notifications for package errors.

Email notifications include information about unhandled Apex exceptions, and install, upgrade, or uninstall failures associated with your package.
‑‑flags‑dirN/AType: Value

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

Format output as json.
‑‑name‑nType: Value
Required

Name of the package to create.
‑‑no‑namespace‑eType: Boolean

Create the package with no namespace; available only for unlocked packages.

This flag is useful when you’re migrating an existing org to packages. But use a namespaced package for new metadata.
‑‑org‑dependentN/AType: Boolean

Depends on unpackaged metadata in the installation org; applies to unlocked packages only.

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.
‑‑package‑type‑tType: Value
Required
Valid Values: Managed, Unlocked

Type of package.

The options for package type are Managed and Unlocked (Managed=DeveloperManagedSubscriberManaged, Unlocked=DeveloperControlledSubscriberEditable). These options determine upgrade and editability rules.
‑‑path‑rType: Value
Required

Path to directory that contains the contents of the package.
‑‑target‑dev‑hub‑vType: Value
Required

Username or alias of the Dev Hub org. Not required if the target-dev-hub configuration variable is already set.

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

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