<commit_before>#!/usr/bin/env node

'use strict';

var cordovaLib = 'cordova';
var configParserLib = 'ConfigParser';

try {
	var cordova_util = require (cordovaLib + '/src/util');
} catch (e) {
	cordovaLib = 'cordova/node_modules/cordova-lib';
	configParserLib = 'configparser/ConfigParser';
	cordova_util = require (cordovaLib + '/src/cordova/util');
}

var projectRoot = cordova_util.isCordova(process.cwd());
var projectXml = cordova_util.projectConfig(projectRoot);
var configParser = cordova_util.config_parser || cordova_util.configparser;

if (!configParser) {
	var configParser = require(cordovaLib + '/src/' + configParserLib);
}
var projectConfig = new configParser(projectXml);

// console.log (projectConfig.name(), projectConfig.packageName());

var path    = require('path');
var fs      = require('fs');
var plist   = require('plist');
var libxml  = require('libxmljs');

var mp = require('./lib/mobile_preferences.js');


fs.readFile('app-settings.json', function(err, data) {
	if (err) {
		throw err;
    }
    
	var configJson = JSON.parse(data);

    var iosItems = mp.iosBuildItems(configJson);
    
	var plistXml = plist.build({ PreferenceSpecifiers: iosItems });    <commit_msg>cordova folder can be optional sometimes<commit_after>#!/usr/bin/env node

'use strict';

var cordovaLib = 'cordova';
var configParserLib = 'ConfigParser';

try {
	var cordova_util = require (cordovaLib + '/src/util');
} catch (e) {
	cordovaLib = 'cordova/node_modules/cordova-lib';
	configParserLib = 'configparser/ConfigParser';
}

try {
	cordova_util = require (cordovaLib + '/src/cordova/util');

	var projectRoot = cordova_util.isCordova(process.cwd());
	var projectXml = cordova_util.projectConfig(projectRoot);
	var configParser = cordova_util.config_parser || cordova_util.configparser;

	if (!configParser) {
		var configParser = require(cordovaLib + '/src/' + configParserLib);
	}
	var projectConfig = new configParser(projectXml);
} catch (e) {
	console.error ('cordova error', e);
}

// console.log (projectConfig.name(), projectConfig.packageName());

var path    = require('path');
var fs      = require('fs');
var plist   = require('plist');
var libxml  = require('libxmljs');

var mp = require('./lib/mobile_preferences.js');


fs.readFile('app-settings.json', function(err, data) {
	if (err) {
		throw err;
    }
    
	var configJson = JSON.parse(data);

    var iosItems = mp.iosBuildItems(configJson);
    
	var plistXml = plist.build({ PreferenceSpecifiers: iosItems });    
{'fraction_non_alphanumeric': 0.14554931836407378, 'fraction_numerical': 0.0, 'mean_word_length': 4.709382151029748, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '6782163', 'n_tokens_mistral': 835, 'n_tokens_neox': 821, 'n_words': 178}