VS Code Extension: Salesforce Auto Update Package.xml
A VS Code extension that monitors create, delete, and update events in the force-app
folder of a Salesforce project. It automatically updates the package.xml
file to reflect changes in metadata, saving developers from manually managing deployment packages after each file modification.
The extension also works with Git branches to ensure the appropriate version of the package.xml
file is updated based on the active branch.
Features
- File Monitoring: Detects file changes (create, delete, update) in the
force-app/main/default
directory and updates package.xml
and destructiveChanges.xml
accordingly.
- Git Branch Awareness (Optional): If Git is connected, the extension updates the appropriate
package.xml
version based on the active branch:
- Master Branch: Updates
manifest/package.xml
and the latest package.xml
.
- Release Branch: Updates
manifest/package.xml
and the release version of package.xml
.
- Patch Branch: Updates
manifest/patch-package.xml
and the release version of package.xml
.
- No Git Required: If Git is not connected, the extension updates the
package.xml
file based on file changes without considering the branch.
- Sort XML File: The extension provides the ability to sort XML files using the command
Ctrl+Shift+P
and selecting "Dot: Sort XML File".
Installation
Install the Extension in VS Code
- Open the Extensions view in VS Code (
Ctrl+Shift+X
or Cmd+Shift+X
on macOS).
- Search for Auto Update Package.xml and click Install.
Prerequisites
- Your project should have a
force-app/main/default
directory containing Salesforce metadata files.
- Git is optional; the extension works with or without Git.
Usage
Automatic File Monitoring
Once installed, the extension automatically starts monitoring file changes in force-app/main/default
.
File Changes Handling
- File Creation/Modification: The extension adds or updates the corresponding metadata entries in
package.xml
.
- File Deletion: The extension removes the entry from
package.xml
and adds it to destructiveChanges.xml
for proper removal from Salesforce.
Git Branch Awareness (Optional)
If Git is connected, the extension updates the appropriate package.xml
version based on the active branch:
- Master Branch: Updates
manifest/package.xml
and the latest package.xml
.
- Release Branch: Updates
manifest/package.xml
and the release version of package.xml
.
- Patch Branch: Updates
manifest/patch-package.xml
and the release version of package.xml
.
If Git is not connected, the extension updates the default package.xml
without considering the branch.
Example Workflow
- Switch to the desired Git branch (if applicable) or continue working in your Salesforce project.
- Create, modify, or delete files in
force-app/main/default
.
- The extension automatically updates
package.xml
and destructiveChanges.xml
as needed.
Configuration
No additional configuration is required. The extension automatically detects file changes and updates package.xml
and destructiveChanges.xml
.
Contributing
Contributions are welcome! You can help by:
- Reporting issues and suggesting improvements.
- Improving documentation.
Feel free to give us feedback and contribute to the project!