Tuesday 2 March 2021

Comparison of 2GP and 1GP Managed Packages

 Hi,

If we are familiar with first-generation managed packages (1GP) and wonder how 2GP differs from 1GP, here are some key distinctions.


1GP Managed Packages2GP Managed Packages
The packaging org is the source of truth for the metadata in your package.Your version control system is the source of truth (source-driven system) for the metadata in your package.

And unlike 1GP, 2GP doesn’t use packaging or patch orgs.

The packaging org owns the package. The metadata in the package resides in the packaging org.The Dev Hub owns the package, but the Dev Hub doesn’t contain the packaged metadata.

We recommend that you enable Dev Hub in your Partner Business Org (PBO).

A packaging org can own only one managed package.A Dev Hub can own one or more packages.
The namespace of the managed package is created in the packaging org.The namespace of a managed package is created in a namespace org and linked to the Dev Hub.

See Namespaces for more details. And you can associate multiple namespaces to a single Dev Hub.

A namespace is linked with a 2GP when you run the force:package:create Salesforce CLI command. And you must specify the namespace in the sfdx-project.json file.

A namespace can be associated with only one package.Multiple packages can use the same namespace.
Global Apex is the only way to share code across packages.Multiple packages sharing the same namespace can share code using public Apex classes and methods with @namespaceAccessible annotation.
Some packaging operations, like package create and package uninstall, can’t be automated.All packaging operations can be automated using Salesforce CLI.
Package versioning is linear.Package versioning supports branches.
Patch versions can only be created in specialized orgs called patch orgs.Patch versions are created using Salesforce CLI. The version control system is the source of truth, and there are no patch orgs.

  • Despite these distinctions, 1GP and 2GP managed packages have many things in common. 
  • They share the key packaging concept of associating metadata with a package.
  • They both allow you to iterate and create package and patch versions, which can be installed and uninstalled in subscriber orgs. 
  • Both managed package types enable you to submit a package for AppExchange security review, and list your package on AppExchange. 
  • Both managed package types can use the License Management App, Subscriber Support Console, and Feature Management App.

Reference:

No comments:

Post a Comment

Best Practices for Building Prompt Templates

 Hi, The following best practices should be considered when building prompt templates: Make sure that your prompt templates are concise and ...