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

57 lines 2.61 kB
/* jscpd:ignore-start */ import { SfCommand, Flags, optionalOrgFlagWithDeprecations } from '@salesforce/sf-plugins-core'; import { Messages } from '@salesforce/core'; import { WebSocketClient } from '../../../common/websocketClient.js'; import { DocBuilderPackageXML } from '../../../common/docBuilder/docBuilderPackageXml.js'; Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); const messages = Messages.loadMessages('sfdx-hardis', 'org'); export default class PackageXml2Markdown extends SfCommand { static title = 'PackageXml to Markdown'; static description = `Generates a markdown documentation from a package.xml file`; static examples = [ '$ sf hardis:doc:packagexml2markdown', '$ sf hardis:doc:packagexml2markdown --inputfile manifest/package-all.xml' ]; static flags = { inputfile: Flags.string({ char: 'x', description: 'Path to package.xml file. If not specified, the command will look in manifest folder', }), outputfile: Flags.string({ char: 'f', description: 'Force the path and name of output report file. Must end with .md', }), debug: Flags.boolean({ char: 'd', default: false, description: messages.getMessage('debugMode'), }), websocket: Flags.string({ description: messages.getMessage('websocket'), }), skipauth: Flags.boolean({ description: 'Skip authentication check when a default username is required', }), "target-org": optionalOrgFlagWithDeprecations }; // Set this to true if your command requires a project workspace; 'requiresProject' is false by default static requiresProject = false; inputFile; outputFile; debugMode = false; /* jscpd:ignore-end */ async run() { const { flags } = await this.parse(PackageXml2Markdown); this.inputFile = flags.inputfile || null; this.outputFile = flags.outputfile || null; this.debugMode = flags.debug || false; // Generate markdown for package.xml const instanceUrl = flags?.['target-org']?.getConnection()?.instanceUrl; this.outputFile = await DocBuilderPackageXML.generatePackageXmlMarkdown(this.inputFile, this.outputFile, null, instanceUrl); // Open file in a new VsCode tab if available WebSocketClient.requestOpenFile(this.outputFile); // Return an object to be displayed with --json return { outputFile: this.outputFile }; } } //# sourceMappingURL=packagexml2markdown.js.map