diff --git a/src/utils/generatePackageXml.ts b/src/utils/generatePackageXml.ts new file mode 100644 index 0000000..dcf794d --- /dev/null +++ b/src/utils/generatePackageXml.ts @@ -0,0 +1,80 @@ +import * as fs from 'fs'; +import * as path from 'path'; + +// Method to generate package.xml with additional types +function createChangeList(apexClasses: string[], lwcComponents: string[]): void { + const apexXml = apexClasses.map((name) => `${name}`).join('\n '); + const lwcXml = lwcComponents.map((name) => `${name}`).join('\n '); + + const additionalTypes = ` + + * + OmniDataTransform + + + * + OmniIntegrationProcedure + + + * + OmniScript + + + * + OmniUiCard + + `; + + const packageXmlContent = ` + + + + ${apexXml} + ApexClass + + + ${lwcXml} + LightningComponentBundle + + ${additionalTypes} + 57.0 + +`; + + const filePath = path.join(__dirname, 'package.xml'); + fs.writeFileSync(filePath, packageXmlContent.trim()); +} + +// Backup method without additional types +function backupChangeList(apexClasses: string[], lwcComponents: string[]): void { + const apexXml = apexClasses.map((name) => `${name}`).join('\n '); + const lwcXml = lwcComponents.map((name) => `${name}`).join('\n '); + + const packageXmlContent = ` + + + + ${apexXml} + ApexClass + + + ${lwcXml} + LightningComponentBundle + + 57.0 + +`; + + const filePath = path.join(__dirname, 'backup-package.xml'); + fs.writeFileSync(filePath, packageXmlContent.trim()); +} + +// remove all this code later --- only for testing +const apexClasses = ['MyApexClass1', 'MyApexClass2']; +const lwcComponents = ['MyLwcComponent1', 'MyLwcComponent2']; + +// creating normal package.xml with additional types +createChangeList(apexClasses, lwcComponents); + +// creating backup-package.xml without additional types +backupChangeList(apexClasses, lwcComponents);