<commit_before>// update the associated domains from the link-domain field of the app's config.xml
(function () {
  // properties
  'use strict'
  var path = require('path')
  var fs = require('fs')
  var plist = require('plist')
  var mkpath = require('mkpath')
  var ASSOCIATED_DOMAINS = 'com.apple.developer.associated-domains'

  // entry
  module.exports = {
    addAssociatedDomains: addAssociatedDomains
  }

  // methods
  function addAssociatedDomains (preferences) {
    var file = path.join(preferences.projectRoot, 'platforms', 'ios', preferences.bundleName, 'Resources', preferences.bundleName + '.entitlements')
    var entitlements = getEntitlements(file)

    entitlements = updateEntitlements(entitlements, preferences)

    setEntitlements(file, entitlements)
  }

  function setEntitlements (file, entitlements) {
    var plistContent = plist.build(entitlements)

    mkpath.sync(path.dirname(file))

    fs.writeFileSync(file, plistContent, 'utf8')
  }

  function getEntitlements (file) {
    var content

    try {
      content = fs.readFileSync(file, 'utf8')
    } catch (err) {
      return {}
    }

    return plist.parse(content)
  }

  function updateEntitlements (entitlements, preferences) {
    entitlements[ASSOCIATED_DOMAINS] = updateAssociatedDomains(preferences)

    return entitlements
  }

  function updateAssociatedDomains (preferences) {
    var domainList = []
    var prefix = 'applinks:'

    domainList.push(prefix + preferences.linkDomain)

    if (preferences.linkDomain.indexOf('app.link') !== -1) {
      var first = preferences.linkDomain.split('.')[0]
      var second = preferences.linkDomain.split('.')[1]
      var rest = preferences.linkDomain.split('.').slice(2).join('.')
      var alternate = first + '-alternate'
      var test = 'test-' + second

      domainList.push(prefix + alternate + '.' + second + '.' + rest)
      domainList.push(prefix + first + '.' + test + '.' + rest)
      domainList.push(prefix + alternate + '.' + test + '.' + rest)
    }

    return domainList
  }
})()<commit_msg>chore: removed test link domain from associated domains<commit_after>// update the associated domains from the link-domain field of the app's config.xml
(function () {
  // properties
  'use strict'
  var path = require('path')
  var fs = require('fs')
  var plist = require('plist')
  var mkpath = require('mkpath')
  var ASSOCIATED_DOMAINS = 'com.apple.developer.associated-domains'

  // entry
  module.exports = {
    addAssociatedDomains: addAssociatedDomains
  }

  // methods
  function addAssociatedDomains (preferences) {
    var file = path.join(preferences.projectRoot, 'platforms', 'ios', preferences.bundleName, 'Resources', preferences.bundleName + '.entitlements')
    var entitlements = getEntitlements(file)

    entitlements = updateEntitlements(entitlements, preferences)

    setEntitlements(file, entitlements)
  }

  function setEntitlements (file, entitlements) {
    var plistContent = plist.build(entitlements)

    mkpath.sync(path.dirname(file))

    fs.writeFileSync(file, plistContent, 'utf8')
  }

  function getEntitlements (file) {
    var content

    try {
      content = fs.readFileSync(file, 'utf8')
    } catch (err) {
      return {}
    }

    return plist.parse(content)
  }

  function updateEntitlements (entitlements, preferences) {
    entitlements[ASSOCIATED_DOMAINS] = updateAssociatedDomains(preferences)

    return entitlements
  }

  function updateAssociatedDomains (preferences) {
    var domainList = []
    var prefix = 'applinks:'

    domainList.push(prefix + preferences.linkDomain)

    if (preferences.linkDomain.indexOf('app.link') !== -1) {
      var first = preferences.linkDomain.split('.')[0]
      var second = preferences.linkDomain.split('.')[1]
      var rest = preferences.linkDomain.split('.').slice(2).join('.')
      var alternate = first + '-alternate'

      domainList.push(prefix + alternate + '.' + second + '.' + rest)
    }

    return domainList
  }
})()
{'fraction_non_alphanumeric': 0.12518778167250877, 'fraction_numerical': 0.0030045067601402104, 'mean_word_length': 3.5449374288964735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '6181912', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1211, 'n_words': 263}