2

I have multiple unlocked packages in my org

I want to remove some of the components from some of the packages and re-organize

I Cannot find a way to do these actions:

  1. remove a component from a package into the unpackaged area
  2. move a component from one package to a different one

I am using sfdx, and would be glad for a solution on it

2 Answers 2

3

remove a component from a package into the unpackaged area

Remove the component from the package source code, upload a new version, install that version with force:package:install -t DeprecateOnly.

move a component from one package to a different one

Move the component from the first package's source. Upload a new version of the first package, and install with the same command as above (deprecate only). Now, set the dependencies on the second package to the version that you just uploaded in sfdx-project.json, and then upload and install that version. You don't need the deprecate only option on the second step, as we're not removing anything from the package.

See also my own question from a while back.

1
  • looks like in most cases even if metadata is removed from the package and package installed with deprecate only, it is not removed from the package and I have to manually delete metadata or remove it from the package to include in another package
    – Patlatus
    Commented Mar 5 at 6:04
2

You can do the following

  1. To temporarily move the metadata component from the unlocked Package to an unmanaged metadata, simply find the component in the Installed unlocked package (Installed Packages detail page) and click remove. This should move the component out of the package.

  2. In the next version of your package, remove the components from the source code and install the new package version using sfdx force:package:install --package 04t... -t DeprecateOnly. Note -t is for upgrade type.

For the second Package, Include components in the source code and generate a new package version and install with upgrade type mixed mode (This is by default so you can skip upgrade type flag -t ).

1
  • 1
    What I find interesting is that there is no way to set the upgrade type if using the Setup UI to do the installation.
    – Phil W
    Commented Aug 22 at 13:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .