Skip to content

Commit caec541

Browse files
authored
Remove newtonsoft.json dependency (AutomatedLab#1775)
1 parent 0d58986 commit caec541

File tree

7 files changed

+9
-8
lines changed

7 files changed

+9
-8
lines changed

.build/02-build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ foreach ($source in [IO.DirectoryInfo[]]@('./publish/AutomatedLab', './publish/A
173173
Copy-Item -Path $sourcePath -Destination $modulePath -Force -Recurse
174174
}
175175

176-
Save-Module -Name AutomatedLab.Common, newtonsoft.json, Ships, PSFramework, xPSDesiredStateConfiguration, xDscDiagnostics, xWebAdministration -Path ./deb/automatedlab/usr/local/share/powershell/Modules
176+
Save-Module -Name AutomatedLab.Common, Ships, PSFramework, xPSDesiredStateConfiguration, xDscDiagnostics, xWebAdministration -Path ./deb/automatedlab/usr/local/share/powershell/Modules
177177

178178
# Pre-configure LabSources for the user
179179
$confPath = "./deb/automatedlab/usr/local/share/powershell/Modules/AutomatedLab/$($env:APPVEYOR_BUILD_VERSION)/AutomatedLab.init.ps1"

.build/04-publish.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if (-not $IsLinux)
2222
{
2323
Register-PSRepository -Name loc -SourceLocation $nugetpath -PublishLocation $nugetpath
2424
Publish-Module -Path (Join-Path -Path $modPath -ChildPath PSFileTransfer) -Repository loc
25-
foreach ($req in @('newtonsoft.json', 'Pester', 'Ships', 'powershell-yaml', 'PSFramework', 'AutomatedLab.Common'))
25+
foreach ($req in @('Pester', 'Ships', 'powershell-yaml', 'PSFramework', 'AutomatedLab.Common'))
2626
{
2727
Publish-Module -Name $req -Repository loc -WarningAction SilentlyContinue
2828
}
@@ -35,7 +35,6 @@ if (-not $IsLinux)
3535
}
3636

3737
$surplus = @(
38-
(Join-Path -Path $nugetpath -ChildPath *newtonsoft.json*)
3938
(Join-Path -Path $nugetpath -ChildPath *AutomatedLab.Common*)
4039
(Join-Path -Path $nugetpath -ChildPath *Pester*)
4140
(Join-Path -Path $nugetpath -ChildPath *Ships*)

AutomatedLabWorker/functions/AzureWorkerVirtualMachines/New-LabAzureResourceGroupDeployment.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@
861861
}
862862

863863
$templatePath = Join-Path -Path (Get-LabConfigurationItem -Name LabAppDataRoot) -ChildPath "Labs/$($Lab.Name)/armtemplate.json"
864-
$template | ConvertTo-JsonNewtonsoft | Set-Content -Path $templatePath
864+
ConvertTo-Json -InputObject $template -Depth 42 | Set-Content -Path $templatePath
865865

866866
Write-ScreenInfo -Message "Deploying new resource group with template $templatePath"
867867
# Without wait - unable to catch exception

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
### Bugs
88

9+
- Removed dependency to NewtonSoft.Json
10+
- The module frequently hinders import on Linux, and apparently on Windows now as well (<https://github.com/AutomatedLab/AutomatedLab.Common/issues/132>)
11+
- The module has not been updated since 2019
912
- Fixed issue with case-sensitive Linux OS name matching (#1766)
1013
- Added filtering to Install-LabSshKnownHost in an attempt to speed up the function
1114

Help/Wiki/Basic/install.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ There are two options installing AutomatedLab:
1010
```powershell
1111
Install-PackageProvider Nuget -Force
1212
# SkipPublisherCheck: AutomatedLabTest requires Pester v5. On system where Pester v3 is still the only versions, you will get an error if the parameter is not present
13-
# AllowClobber: On some occasions, other modules seem to have published ConvertTo-Json/ConvertFrom-Json, which is overwritten by Newtonsoft.Json
14-
Install-Module AutomatedLab -SkipPublisherCheck -AllowClobber
13+
Install-Module AutomatedLab -SkipPublisherCheck
1514
1615
#region Non-interactive host
1716
# Pre-configure telemetry

Installer/.Build/PostBuild.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[Parameter()]
66
[string[]]
7-
$ExternalDependency = @('PSFramework', 'newtonsoft.json', 'SHiPS', 'xPSDesiredStateConfiguration', 'xDscDiagnostics', 'xWebAdministration'),
7+
$ExternalDependency = @('PSFramework', 'SHiPS', 'xPSDesiredStateConfiguration', 'xDscDiagnostics', 'xWebAdministration'),
88

99
[Parameter()]
1010
[string[]]

Installer/.Build/PreBuild.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[Parameter()]
66
[string[]]
7-
$ExternalDependency = @('Pester', 'PSFramework', 'newtonsoft.json', 'SHiPS', 'AutomatedLab.Common', 'xPSDesiredStateConfiguration', 'xDscDiagnostics', 'xWebAdministration', 'powershell-yaml'),
7+
$ExternalDependency = @('Pester', 'PSFramework', 'SHiPS', 'AutomatedLab.Common', 'xPSDesiredStateConfiguration', 'xDscDiagnostics', 'xWebAdministration', 'powershell-yaml'),
88

99
[Parameter()]
1010
[string[]]

0 commit comments

Comments
 (0)