Skip to content

Commit

Permalink
Added CI job to ensure VS Code versions match in npm configs (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
BeardedFish authored Jul 13, 2024
1 parent d6693c3 commit 8605870
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/ci/scripts/Confirm-NpmVisualStudioCodeVersionsMatch.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# File Name: Confirm-NpmVisualStudioCodeVersionsMatch.ps1
# Author: Darian Benam <[email protected]>
# Date Created: Saturday, July 13, 2024
# Date Updated: Saturday, July 13, 2024

#Requires -Version 7

param(
[Parameter(Mandatory = $true)]
[string] $NpmPackageJsonPath,
[Parameter(Mandatory = $true)]
[string] $NpmPackageLockJsonPath
)

$NpmPackageJson = Get-Content -Raw -Path $NpmPackageJsonPath | ConvertFrom-Json -AsHashTable
$NpmPackageLockJson = Get-Content -Raw -Path $NpmPackageLockJsonPath | ConvertFrom-Json -AsHashTable

if ($NpmPackageJson.engines.vscode -ne $NpmPackageJson.devDependencies.'@types/vscode')
{
Write-Error "Visual Studio Code Versions do not match in '$NpmPackageJsonPath'!"
exit 1
}

$NpmPackageLockJsonPackageParent = $NpmPackageLockJson.packages.''

if ($NpmPackageLockJsonPackageParent.engines.vscode -ne $NpmPackageLockJsonPackageParent.devDependencies.'@types/vscode')
{
Write-Error "Visual Studio Code Versions do not match in '$NpmPackageLockJsonPath'!"
exit 1
}

Write-Output 'Versions Match'
9 changes: 9 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ on:
- '*'

jobs:
check-vscode-npm-versions-match:
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Check npm Visual Studio Code Versions
shell: pwsh
run: |
./.github/ci/scripts/Confirm-NpmVisualStudioCodeVersionsMatch.ps1 -NpmPackageJsonPath package.json -NpmPackageLockJsonPath package-lock.json
validate:
runs-on: windows-latest
steps:
Expand Down

0 comments on commit 8605870

Please sign in to comment.