2

While Creating a new package version, I have to keep all the components in the same folder otherwise it is giving me errors.

Error thrown Even though the component exists in other directory.

enter image description here

So,There are 2 use cases:

  1. Fetch from the server: Here package directories structure helps as it keep all the components well segregated.
  2. Create a package: In this case, we need to move the components to a single directory for packaging. This de-means everything from point 1.

Is this correct, Or Am i missing something. Kindly suggest.

Regards,

1 Answer 1

1

You can use different folders for packaging, but requires a bit of setup. In your sfdx-project.json file, you need to specify the package directories:

  "packageDirectories": [
    {
      "default": false,
      "package": "package1",
      "path": "force-app/package1",
      "versionName": "ver 0.1",
      "versionNumber": "0.1.0.NEXT"
    },
    {
      "default": false,
      "package": "package2",
      "path": "force-app/package2",
      "versionName": "ver 0.1",
      "definitionFile": "config/features.json",
      "versionNumber": "0.1.0.NEXT",
      "dependencies": [
        {
          "package": "package1",
          "versionNumber": "0.1.0.LATEST"
        }
      ]
    },
    ...

This example demonstrates how package2 depends on components from package1. As long as you define your dependencies, and in the correct order, you'll be allowed to keep the metadata in different folders, the way you'd expect.

4
  • Thanks for your reply. I have a separate folder called Glib which host a number of components. My package depends on few components & not all present in Glib. Will it pull only the required components or , will it pull all components from Glib? Commented May 5, 2020 at 16:07
  • @RajendraSinghNagar The dependencies must exist in a package version for the other folder. As long as the dependencies exist and are valid, it will deploy okay.
    – sfdcfox
    Commented May 5, 2020 at 16:11
  • Thanks for your guidance. I will suggest others who are referring this question to look at this FAQ sheet as well. It has some needed detailed information. sfdc-db-gmail.github.io/unlocked-packages/… Commented May 6, 2020 at 4:22
  • @RajendraSinghNagar Yes, this is also in the documentation, just in different pages.
    – sfdcfox
    Commented May 6, 2020 at 4:24

You must log in to answer this question.

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