Bear with me but I am completely confused as the documentation is fragmented, not entirely specific, and contradictory in places.

Background

I am creating an unlocked no namespace package for our org. The test methods for that package requires the use of classes (existing in our org) as those classes are shared testing classes. I need to be able to use those classes in the unlocked package so I do not keep recreating duplicate classes.

What I did

  1. Scratch org with Package A (needing the test methods)
  2. I create a package in another scratch org with the shared classes, created a package and package version
  3. I added the dependency to Package A project son
  4. I installed the package to the Package A scratch org

Questions

  1. Where do you actually create the package for the shared classes? I created it in a scratch org like the docs said. But what happens when the scratch org is deleted due to expiration

  2. I cannot promote the package version as it says I do not have the required permissions. What permission is required to promote?

  3. Do I need to promote the unlocked package to a released version at all?

  4. When I finally install the shared Package B into the prod org, will it overwrite the current classes since they were previously existing?

Sorry for the confusion but the workflow does not seem well defined. Basic premise is trying to develop a feature package and use existing artifacts from prod to support test methods in the new package

Any clarification would be helpful. My question may also not be clear as I am a bit confused....

up vote 6 down vote accepted

Where do you actually create the package for the shared classes? I created it in a scratch org like the docs said. But what happens when the scratch org is deleted due to expiration

Packages are created in the DevHub org, so they won't be deleted with a scratch org.

I cannot promote the package version as it says I do not have the required permissions. What permission is required to promote?

You need the System Permissions > Create and Update Second-Generation Packages. You'll also need the other permissions from the documentation. Also, you need to enable 2GP if you haven't already (Setup > Dev Hub > Enable Unlocked Packages (GA) and Second-Generation Managed Packages (Beta)).

Do I need to promote the unlocked package to a released version at all?

Unlocked packages don't have a "beta" or "released" status like normal managed packages.

When I finally install the shared Package B into the prod org, will it overwrite the current classes since they were previously existing?

Yes, they will be updated and marked as part of the package.

  • Thank you. I will check permissions. i thought I had them since I was able to create the package. Anyway. Thank you for the confirmation, sometimes that's all that is needed – Eric Oct 19 at 17:25
  • @sfdxfox - one more stupid question. Where do I find the package in the dev hub org? Is it only via the cli.... – Eric Oct 19 at 17:25
  • @Eric Make sure the 2GP feature is enabled, too (just added an edit). – sfdcfox Oct 19 at 17:26
  • 2
    @Eric You can query them as well, but you're right, there's no GUI for these yet, as far as I can tell (I only have limited experience, so I might have missed something). – sfdcfox Oct 19 at 17:28

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.