1

Say for example I have broken my metadata up by having one package for standard objects, a number of packages for functional groupings of custom objects and a package for apex classes.

I'm not clear on how I can manage my project folder when I do some customisation for a build that includes modification of a standard object, addition of a new custom object and an update to an existing apex class.

Do I use three folders like ..\force-app\main\package1, ..\force-app\main\package2 and ..\force-app\main\package3?

2

It is generally recommended to use a directory for a package in the project workspace. So you are right that your project will have a folder structure as you have mentioned.

You do not need to use force-app, feel free to use the folder name that is more meaningful.

Example project workspace directory names as below

recruiting-module-baseobjects/main/default

recruiting-module-basecode/main/default

It is also recommended you enable source tracking on your sandboxes or use scratch orgs. That way it is easier to use commands like force:source:pull that automatically pulls into respective folders as long as you have a project directory path defined in sfdx-project.json

Take a peek into one of the sample apps Easy-Spaces repo and see how we compose the app into modules or packages and map to the directory in the sfdx-project.json and also configure dependencies.

Also, one thing to note is not every metadata is supported for unlocked packaging so it is better to not put them in the package but still have a folder (unpackaged name fits well) where you can group them and deploy them using force:source:deploy or force:mdapi:deploy after/before you install the packages.

When you finally are done with the development you create package and package versions using the Salesforce command-line tool (CLI) by providing the package directory and package name.

| improve this answer | |
  • 1
    Thank you. Excellent answer and the enable source tracking tip is very valuable. The key understanding I was missing is the proper use of folders and mapping them to the packages in sfdx-project.json. – Geoffry Billing Sep 16 at 0:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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