UNPKG

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

14 lines (13 loc) 2.56 kB
import { SfCommand } from '@salesforce/sf-plugins-core'; import { AnyJson } from "@salesforce/ts-types"; export declare class PackageXmlRemove extends SfCommand<any> { static readonly description = "\n## Command Behavior\n\n**Removes metadata components from a `package.xml` file that are also present in another `package.xml` file (e.g., a `destructiveChanges.xml`).**\n\nThis command is useful for refining your `package.xml` manifests by excluding components that are being deleted or are otherwise irrelevant for a specific deployment or retrieval. For example, you can use it to create a `package.xml` that only contains additions and modifications, by removing items listed in a `destructiveChanges.xml`.\n\nKey functionalities:\n\n- **Source `package.xml`:** The main `package.xml` file from which components will be removed (specified by `--packagexml`). Defaults to `package.xml`.\n- **Filter `package.xml`:** The `package.xml` file containing the components to be removed from the source (specified by `--removepackagexml`). Defaults to `destructiveChanges.xml`.\n- **Output File:** The path to the new `package.xml` file that will contain the filtered content (specified by `--outputfile`).\n- **Removed Only Output:** The `--removedonly` flag allows you to generate a `package.xml` that contains *only* the items that were removed from the source `package.xml`.\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 both the source `package.xml` and the filter `package.xml`.\n- **Content Comparison and Filtering:** It compares the metadata types and members defined in both files. Components found in the filter `package.xml` are excluded from the output.\n- **XML Building:** After filtering, it rebuilds the XML structure for the new `package.xml` file.\n- **File Writing:** The newly constructed XML content is then written to the specified output file.\n- **`removePackageXmlFilesContent` Utility:** The core logic for this operation is encapsulated within the `removePackageXmlFilesContent` utility function, which handles the parsing, filtering, and writing of the `package.xml` files.\n</details>\n"; static readonly examples: string[]; static readonly requiresProject = false; static readonly flags: any; protected packageXmlFile: string; protected removePackageXmlFile: string; protected removedOnly: boolean; protected outputFile: string; run(): Promise<AnyJson>; }