sfdx-hardis
Version:
Swiss-army-knife Toolbox for Salesforce. Allows you to define a complete CD/CD Pipeline. Orchestrate base commands and assist users with interactive wizards
11 lines (10 loc) • 2.18 kB
TypeScript
import { SfCommand } from '@salesforce/sf-plugins-core';
import { AnyJson } from "@salesforce/ts-types";
export declare class PackageXmlAppend extends SfCommand<any> {
static readonly description = "\n## Command Behavior\n\n**Appends the content of one or more Salesforce `package.xml` files into a single target `package.xml` file.**\n\nThis command is useful for consolidating metadata definitions from various sources into a single manifest. For instance, you might have separate `package.xml` files for different features or metadata types, and this command allows you to combine them into one comprehensive file for deployment or retrieval.\n\nKey functionalities:\n\n- **Multiple Input Files:** Takes a comma-separated list of `package.xml` file paths as input.\n- **Single Output File:** Merges the content of all input files into a specified output `package.xml` file.\n- **Metadata Consolidation:** Combines the `<types>` and `<members>` elements from all input files, ensuring that all unique metadata components are included in the resulting file.\n\n<details markdown=\"1\">\n<summary>Technical explanations</summary>\n\nThe command's technical implementation involves:\n\n- **File Parsing:** It reads and parses the XML content of each input `package.xml` file.\n- **Content Merging:** It iterates through the parsed XML structures, merging the `types` and `members` arrays. If a metadata type exists in multiple input files, its members are combined (duplicates are typically handled by the underlying XML utility).\n- **XML Building:** After consolidating the metadata, it rebuilds the XML structure for the output `package.xml` file.\n- **File Writing:** The newly constructed XML content is then written to the specified output file.\n- **`appendPackageXmlFilesContent` Utility:** The core logic for this operation is encapsulated within the `appendPackageXmlFilesContent` utility function, which handles the parsing, merging, and writing of the `package.xml` files.\n</details>\n";
static readonly examples: string[];
static readonly flags: any;
protected packageXmlFiles: string[];
protected outputFile: string;
run(): Promise<AnyJson>;
}