Create Org-Dependent Unlocked Packages
| User Permissions Needed | |
|---|---|
| To create packages: | Create and Update Second-Generation Packages |
Untangling your production org metadata can be a daunting project. But now you have a solution that enables you to package metadata without completely accounting for all metadata dependencies: org-dependent unlocked packages. When you use org-dependent unlocked packages, metadata validation occurs during package installation, instead of during package version creation.
Longstanding and large production orgs often accumulate large amounts of metadata that are difficult to modularize when adopting a package-based Application Lifecycle Management (ALM) approach. Instead, you can package metadata that depends on unpackaged metadata in the installation org.
1sf package create -t Unlocked -r force-app -n MyPackage --org-dependent| Scenario | Unlocked Packages | Org Dependent Unlocked Packages |
|---|---|---|
| Build once, install anywhere | Yes | No. These packages are designed for specific production and sandbox orgs. You can install them only in orgs that contain the metadata that the package depends on. |
| Dependency validation | Occurs during package version creation | Occurs during package installation |
| Can depend on other packages | Yes | No |
| Requires dependencies to be resolved to create the package | Yes | No |
| Supported metadata types | See the unlocked packaging channel of the Metadata Coverage Report. | See the unlocked packaging channel of the Metadata Coverage Report. |
| Recommended development and testing environment | Use scratch orgs to develop and test your unlocked packages. | Use a sandbox that contains the dependent metadata. Consider enabling Source Tracking in Sandboxes to develop your org-dependent unlocked package. Then, test the package in a sandbox org before installing it in your production org. |
| Code coverage requirement | Before you can promote and release an unlocked package, the Apex code must meet a minimum 75% code coverage requirement. | We don’t calculate code coverage, but we recommend that you ensure the Apex code in your package is well tested. |
To review which of your packages are org-dependent unlocked packages, use sf package list --verbose.