My scratch orgs have this feature:
So I create a
PermissionSet enable this feature on the scratch org. But when running
sfdx force:source:convert --outputdir mdapi_output --packagename packageName the permission set is included and is causing failure when pushing on an org for packaging (
sfdx force:mdapi:deploy --deploydir mdapi_output -u XXX).
Is there a way to exclude it from packaging ?
forceignore file excludes it from pull/push on scratch and it is not the goal.
Create a directory structure like
donotconvert/main/default/permissionsets/ and move your debug apex permset under there. Add the
donotconvert directory to the list of
sfdx-project.json. Now when you run
force:source:convert specify the directory structure to convert using the
Answered by Suraj on January 6, 2022
My read of the documentation is that the .forceignore file mentioned by others is only when you're pushing and pulling to the scratch org or converting from mdapi TO DX, not the other way around.
For our team where we just ran into this, I'm writing a bash script (but it could be written in anything) that will copy the DX force-app code tree to something like mdapimidway, prune out the files we don't want to convert and deploy and then call the convert command with the midway tree as the source to convert
sfdx force:source:convert -r mdapimidway/ -d mdapioutput/
The real power of DX isn't that it has functional parity with other tools, it's that you can throw it into the middle of your own scripts to take care of all the things they didn't think of.
Answered by Dave Lyon on January 6, 2022
.forceignore. As stated in the documentation:
When syncing metadata between your local file system and a scratch org, you often have source files you want to exclude. Similarly, you often want to exclude certain files when converting source to Salesforce DX project format. In both cases, you can exclude individual files or all files in a specific directory with a .forceignore file. (Emphasis added.)
Answered by sfdcfox on January 6, 2022
Just had the same sort of problem and didn't find a mechanism in SFDX for this sort of filtering.
We are using Ant as well as SFDX and that has good filtering mechanisms (and we also have files split into separate trees so need to merge those trees) so we are first copying to a new tree of files where the files we don't want are excluded and then running the convert:
<target name="clean"> <delete dir="./mdapi-source/staged"/> <delete dir="./mdapi-source/cvux"/> </target> <target name="convert" depends="clean"> <copy todir="./mdapi-source/staged"> <fileset dir="./sfdx-source/int/test"/> <fileset dir="./sfdx-source/int/main"/> <fileset dir="./sfdx-source/wiz/test"> <exclude name="**/aura/**"/> <exclude name="**/staticresources/**"/> </fileset> <fileset dir="./sfdx-source/wiz/main"/> </copy> <exec dir="." executable="sfdx" osfamily="unix" failonerror="true"> <arg value="force:source:convert"/> <arg value="--rootdir" /> <arg value="./mdapi-source/staged" /> <arg value="--outputdir" /> <arg value="./mdapi-source/cvux" /> </exec> </target>
There might be something that helps in the sfdx-isv/sfdx-falcon-template project that:
This template can be used as a starting point for any Salesforce DX project, but has been specialized for building managed packages. Each directory in this repository contains a README file describing its purpose, what type of files it should contain, and additional setup/configuration details (if needed).
Answered by Keith C on January 6, 2022
0 Asked on November 20, 2020 by jairam
2 Asked on November 20, 2020 by c0depirate
1 Asked on November 12, 2020 by devforce
1 Asked on November 11, 2020 by crm-guy
2 Asked on November 8, 2020 by johannes-schapdick
1 Asked on November 4, 2020 by the-chinese-filipino
1 Asked on November 4, 2020 by degmo
1 Asked on November 3, 2020 by sankhadeep-biswas
1 Asked on October 27, 2020 by chaithra-k-n
0 Asked on October 26, 2020 by vignesh-waran
0 Asked on October 25, 2020
1 Asked on October 11, 2020 by r-rothwell
1 Asked on October 8, 2020 by itai-shmida
1 Asked on October 3, 2020 by nandy
1 Asked on October 3, 2020 by dsk
1 Asked on September 30, 2020 by sfdc-in
1 Asked on September 19, 2020 by naveen-vm
Get help from others!