UpdateFigma.ps1
<#PSScriptInfo .VERSION 0.0.1 .GUID e993c3f1-f299-4e54-8eea-735b27e2d042 .AUTHOR Fabrice Sanga .COMPANYNAME sangafabrice .COPYRIGHT © 2022 SangaFabrice. All rights reserved. .TAGS figma nuget-package update prototyping .LICENSEURI https://github.com/sangafabrice/reg-cli/blob/main/LICENSE.md .PROJECTURI https://github.com/sangafabrice/reg-cli/tree/figma .ICONURI https://rawcdn.githack.com/sangafabrice/reg-cli/bea24049ab697b7a7f4ff20dea67f10b1bfa59bd/icon.png .EXTERNALMODULEDEPENDENCIES DownloadInfo,RegCli .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES Initialize Figma updater script. .PRIVATEDATA #> #Requires -Module @{ModuleName = 'DownloadInfo'; ModuleVersion = '5.0.4'} #Requires -Module @{ModuleName = 'RegCli'; ModuleVersion = '6.2.2'} [CmdletBinding()] Param ( [ValidateNotNullOrEmpty()] [ValidateScript({ Test-InstallLocation $_ $PSScriptRoot })] [string] $InstallLocation = "${Env:ProgramData}\Figma", [ValidateNotNullOrEmpty()] [ValidateScript({ Test-InstallerLocation $_ })] [string] $SaveTo = $PSScriptRoot ) & { $NameLocation = "$InstallLocation\Figma.exe" Try { $UpdateModule = Import-CommonScript chrome-installer | Import-Module -PassThru -Force -Verbose:$False @{ UpdateInfo = $( Write-Verbose 'Retrieve install or update information...' Try { Get-DownloadInfo -From Figma } Catch { } ) NameLocation = $NameLocation SaveTo = $SaveTo SoftwareName = 'Figma Desktop' InstallerType = 'Squirrel' Verbose = $VerbosePreference -ine 'SilentlyContinue' } | ForEach-Object { Invoke-CommonScript @_ } } Catch { } Finally { $UpdateModule | Remove-Module -Verbose:$False } } <# .SYNOPSIS Updates Figma software. .DESCRIPTION The script installs or updates Figma on Windows. .NOTES Required: at least Powershell Core 7. .PARAMETER InstallLocation Path to the installation directory. It is restricted to file system paths. It does not necessary exists. It defaults to "%ProgramData%\Figma". .PARAMETER SaveTo Path to the directory of the downloaded installer. It is an existing file system path. It defaults to the script directory. .EXAMPLE Get-ChildItem 'C:\ProgramData\Figma' -ErrorAction SilentlyContinue PS > .\UpdateFigma.ps1 -InstallLocation 'C:\ProgramData\Figma' -SaveTo . PS > Get-ChildItem 'C:\ProgramData\Figma' | Select-Object Name -First 5 Name ---- locales resources chrome_100_percent.pak chrome_200_percent.pak d3dcompiler_47.dll PS > Get-ChildItem | Select-Object Name Name ---- figma_desktop_116.3.8.exe UpdateFigma.ps1 Install Figma to 'C:\ProgramData\Figma' and save its setup installer to the current directory. #> |