<commit_before>$me = $MyInvocation.MyCommand.Definition;

function Update-Version
{
  param([string] $path)

  $xml = [xml](Get-Content $path)
  $versionAttr = $xml.DocumentElement['Metadata']['Identity'].Attributes['Version']
  $oldVersion = $versionAttr.Value
  $parts = $oldVersion.Split('.');
  $parts[3] = ([convert]::ToInt32($parts[3]) + 1).ToString()
  $newVersion = [string]::Join('.', $parts)
  Write-Host "Updated" ([IO.Path]::GetFileName([IO.Path]::GetDirectoryName($path))) "from" $oldVersion "to" $newVersion
  $versionAttr.Value = $newVersion
  $xml.Save($path)
}

function Update-Manifest
{
  param([string] $name)
  $path = [IO.Path]::Combine($me, '..\..\Nodejs\Product\', $name, 'source.extension.vsixmanifest')
  Update-Version $path
}

Update-Manifest 'InteractiveWindow'
Update-Manifest 'NodeJs'
Update-Manifest 'Profiling'
<commit_msg>Support other version bump types<commit_after>param (
    [string]$bump = "build" # or 'revision' or 'minor' or 'major'
 )

$me = $MyInvocation.MyCommand.Definition;

function Update-Version
{
  param([string] $path)

  $xml = [xml](Get-Content $path)
  $versionAttr = $xml.DocumentElement['Metadata']['Identity'].Attributes['Version']
  $oldVersion = $versionAttr.Value
  $parts = $oldVersion.Split('.');
  $incrementIndex = -1;
  switch($bump) {
    "build" {
      $incrementIndex = 3 
    }
    "revision" {
      $incrementIndex = 2
      $parts[3] = "0"
    }
    "minor" {
      $incrementIndex = 1
      $parts[3] = $parts[2] = "0"
    }
    "major" {
      $incrementIndex = 0
      $parts[3] = $parts[2] = $parts[1] = "0"
    }
    default {
      Write-Host 'Must specify "build", "revision", "minor", or "major"'
      exit 1
    }
  }
  $parts[$incrementIndex] = ([convert]::ToInt32($parts[$incrementIndex]) + 1).ToString()
  $newVersion = [string]::Join('.', $parts)
  Write-Host "Updated" ([IO.Path]::GetFileName([IO.Path]::GetDirectoryName($path))) "from" $oldVersion "to" $newVersion
  $versionAttr.Value = $newVersion
  $xml.Save($path)
}

function Update-Manifest
{
  param([string] $name)
  $path = [IO.Path]::Combine($me, '..\..\Nodejs\Product\', $name, 'source.extension.vsixmanifest')
  Update-Version $path
}

Update-Manifest 'InteractiveWindow'
Update-Manifest 'NodeJs'
Update-Manifest 'Profiling'

{'fraction_non_alphanumeric': 0.19131197893813076, 'fraction_numerical': 0.010092145677928916, 'mean_word_length': 4.265588914549654, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '211844', 'n_tokens_mistral': 818, 'n_tokens_neox': 796, 'n_words': 144}