Last active
June 28, 2023 13:09
-
-
Save infocynic/aa68a0642f4ab1cdaf2b7c60616c0200 to your computer and use it in GitHub Desktop.
Generate .gitignore for common components of managed SF packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[Parameter(Mandatory = $true, HelpMessage = "Specify the target org alias or username.")] | |
[string]$targetOrg | |
) | |
param ( | |
[Parameter(Mandatory = $true, HelpMessage = "Specify the root directory for the metadata; e.g., force-app/main/default.")] | |
[string]$rootDir | |
) | |
$metadataTypesToIgnore = @('classes','triggers','pages','aura','flows','lwc','staticresources') | |
(sf package installed list -o $targetOrg --json | ConvertFrom-Json).result | Sort-Object SubscriberPackageNamespace | ForEach-Object { | |
if ($_.SubscriberPackageNamespace) { | |
$pkg = $_ | |
"" | |
$metadataTypesToIgnore | ForEach-Object { | |
"$rootDir/$_/$($pkg.SubscriberPackageNamespace)__*" } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment