sf-package-list v1.0.0
sf-package-list
Convert Salesforce manifest files (package.xml
) into list format and reverse the process when needed.
Install
sf plugins install sf-package-list@x.y.z
Why
The package list format offers several benefits for developers:
- Readability – The format is much simpler and easier to scan compared to XML, making it quicker to understand which metadata is being deployed or destroyed.
- Ease of Editing – Developers can easily add, remove, or modify metadata items without worrying about XML syntax or structure.
- Version Control Friendly – The format reduces unnecessary diffs in Git since there's no XML nesting, indentation, or attributes that could change subtly.
- Better for Scripting – It integrates well with automation scripts, as it's easier to parse with simple text-processing tools compared to XML.
- Faster Declaration – Developers can quickly list metadata items without dealing with XML formatting, leading to a more efficient workflow.
It's a way to streamline deployments and make metadata management more accessible.
Commands
sf sfpl list
Convert a Salesforce package.xml into list format.
USAGE
$ sf sfpl list [-x <value>] [-l <value>] [--json]
FLAGS
-x, --package-xml=<value> Path to the package.xml to convert to list format.
-l, --package-list=<value> Output path to save the package list to.
GLOBAL FLAGS
--json Format output as json.
EXAMPLES
Convert package.xml into list format in a text file.
$ sf sfpl list -x package.xml -l package.txt
sf sfpl xml
Convert a package list back into a Salesforce package.xml.
USAGE
$ sf sfpl xml [-x <value>] [-l <value>] [--json]
FLAGS
-l, --package-list=<value> Text file containing the package list to convert into an XML.
-x, --package-xml=<value> Path to the package.xml to create.
GLOBAL FLAGS
--json Format output as json.
EXAMPLES
Convert the list file back into a Salesforce package.xml
$ sf sfpl list -x package.xml -l package.txt
Use Case
In my use case, we use sfdx-git-delta
to create incremental packages via the git diff, but we also allow the developers to declare additional metadata to deploy via the GitLab merge request description/commit message. Instead of needing the developers to copy and paste an entire package.xml into the description, which may cause errors if XML formatting is off, we use this custom package list format to provide a simpler way for developers to provide metadata without needing to conform to the XML schema.
Issues
If you encounter any issues or would like to suggest features, please create an issue.
License
This project is licensed under the MIT license. Please see the LICENSE file for details.
3 months ago