<commit_before>// this module creates Config.xml, which contains the metadata for the tool's popup when installing through a YXI
const fs = require('fs')
const path = require('path')
const builder = require('xmlbuilder');

// *** this section will load the stored values from the JSON object

exports.createConfigXml = () => {
    // temp hard coded input values. The actual values will come from a JSON object.
    const name = 'ToolName'
    const description = 'The tool\'s description.'
    const toolVersion = '0.5.0'
    const categoryName = 'Connectors'
    const author = '<NAME>'
    const icon = `${name}_Icon.png`

    var xml = builder.create('AlteryxJavaScriptPlugin', {encoding: 'UTF-8'})
        .ele('Properties')
            .ele('MetaInfo')
                .ele('Name', name).up()
                .ele('Description', description).up()
                .ele('ToolVersion', toolVersion).up()
                .ele('CategoryName', categoryName).up()
                .ele('Author', author).up()
                .ele('Icon', icon)
        .end({ pretty: true});

    // need to create relative path for file creation
    fs.writeFile('Config.xml', xml, (err) => {
        if (err) throw err
        console.log('Config.xml has been saved')
    })
}<commit_msg>US26092: promisfied; removed hard-coded values; creating configXmlPath variable<commit_after>// this module creates Config.xml, which contains the metadata for the tool's popup when installing through a YXI
const fs = require('fs')
const path = require('path')
const builder = require('xmlbuilder');

// *** this section will load the stored values from the JSON object

exports.createConfigXml = (result) => new Promise((resolve, reject) => {
    // temp hard coded input values. The actual values will come from a JSON object.
    const name = result.ToolName
    const description = result.Description
    const toolVersion = result.Version
    const categoryName = result.Category
    const author = result.Author
    const icon = result.IconPath
    // const configXmlPath = ``

    var xml = builder.create('AlteryxJavaScriptPlugin', {encoding: 'UTF-8'})
        .ele('Properties')
            .ele('MetaInfo')
                .ele('Name', name).up()
                .ele('Description', description).up()
                .ele('ToolVersion', toolVersion).up()
                .ele('CategoryName', categoryName).up()
                .ele('Author', author).up()
                .ele('Icon', icon)
        .end({ pretty: true});

    // need to create relative path for file creation
    fs.writeFile('Config.xml', xml, (err) => {
        if (err) reject(err)
        console.log('Config.xml has been saved')
        // const inputResult = result
        // inputResult.ConfigXml = configXmlPath
        // resolve(inputResult)
    })
})
{'fraction_non_alphanumeric': 0.1288256227758007, 'fraction_numerical': 0.0035587188612099642, 'mean_word_length': 2.5854591836734695, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1966687', 'n_tokens_mistral': 760, 'n_tokens_neox': 727, 'n_words': 244}