Skip to content

Commit

Permalink
Merge pull request #799 from d35ha/npp-plugins
Browse files Browse the repository at this point in the history
Add JSTool and XMLTools plugins for Notepad++
  • Loading branch information
Ana06 authored Dec 19, 2023
2 parents e4cf21e + 6c2e026 commit e1d68d4
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>notepadpp.plugin.jstool.vm</id>
<version>1.2312.0</version>
<description>A JavaScript (JSON) tool for Notepad++ (formerly JSMinNpp)</description>
<authors>Sun Junwen</authors>
<dependencies>
<dependency id="common.vm" />
<dependency id="notepadplusplus.vm" />
</dependencies>
</metadata>
</package>
32 changes: 32 additions & 0 deletions packages/notepadpp.plugin.jstool.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
$ErrorActionPreference = 'Stop'
Import-Module vm.common -Force -DisableNameChecking

try {
$toolName = "JSMinNPP"
$pluginsDir = Join-Path ${Env:ProgramFiles} "Notepad++\plugins" -Resolve
$toolDir = New-Item (Join-Path $pluginsDir $toolName) -itemtype directory
VM-Assert-Path $toolDir

$zipUrl= "https://github.com/sunjw/jstoolnpp/raw/6bde4de9171975b445b5b8efa9153b10660bf5a7/trunk/ReleasedFiles/JSToolNPP.1.2312.0.uni.32.zip"
$zipSha256 = "dc46e2bf466bd6431351e73bc332e47134b5e04d3c79cfc4738b79ecfed050ed"
$zipUrl_64 = "https://github.com/sunjw/jstoolnpp/raw/6bde4de9171975b445b5b8efa9153b10660bf5a7/trunk/ReleasedFiles/JSToolNPP.1.2312.0.uni.64.zip"
$zipSha256_64 ="bc819fad1a12a6a29392ad67dfb88d730bb8ac4ecee98f47bb73a0fab387c63e"

# Remove files from previous zips for upgrade
VM-Remove-PreviousZipPackage ${Env:chocolateyPackageFolder}

# Download and unzip
$packageArgs = @{
packageName = ${Env:ChocolateyPackageName}
unzipLocation = $toolDir
url = $zipUrl
checksum = $zipSha256
checksumType = 'sha256'
url64bit = $zipUrl_64
checksum64 = $zipSha256_64
}
Install-ChocolateyZipPackage @packageArgs
VM-Assert-Path (Join-Path $toolDir "$toolName.dll")
} catch {
VM-Write-Log-Exception $_
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$ErrorActionPreference = 'Continue'

$toolDir = Join-Path ${Env:ProgramFiles} "Notepad++\plugins\JSMinNPP"
Remove-Item $toolDir -Recurse -Force -ea 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>notepadpp.plugin.xmltools.vm</id>
<version>3.1.1.20231219</version>
<description>XML Tools plugin for Notepad++</description>
<authors>Nicolas Crittin</authors>
<dependencies>
<dependency id="common.vm" />
<dependency id="notepadplusplus.vm" />
</dependencies>
</metadata>
</package>
32 changes: 32 additions & 0 deletions packages/notepadpp.plugin.xmltools.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
$ErrorActionPreference = 'Stop'
Import-Module vm.common -Force -DisableNameChecking

try {
$toolName = "XMLTools"
$pluginsDir = Join-Path ${Env:ProgramFiles} "Notepad++\plugins" -Resolve
$toolDir = New-Item (Join-Path $pluginsDir $toolName) -itemtype directory
VM-Assert-Path $toolDir

$zipUrl= "https://github.com/morbac/xmltools/releases/download/3.1.1.13/XMLTools-3.1.1.13-x86.zip"
$zipSha256 = "9521d91be847a9c9fcfc6cb6ea5455fd7dfe840f4f12a8fd95e5137116dbd6c3"
$zipUrl_64 = "https://github.com/morbac/xmltools/releases/download/3.1.1.13/XMLTools-3.1.1.13-x64.zip"
$zipSha256_64 ="7631ea990e731172e28e9fe85ac4861185c0292143603b9486bc969cc8e8e046"

# Remove files from previous zips for upgrade
VM-Remove-PreviousZipPackage ${Env:chocolateyPackageFolder}

# Download and unzip
$packageArgs = @{
packageName = ${Env:ChocolateyPackageName}
unzipLocation = $toolDir
url = $zipUrl
checksum = $zipSha256
checksumType = 'sha256'
url64bit = $zipUrl_64
checksum64 = $zipSha256_64
}
Install-ChocolateyZipPackage @packageArgs
VM-Assert-Path (Join-Path $toolDir "$toolName.dll")
} catch {
VM-Write-Log-Exception $_
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$ErrorActionPreference = 'Continue'

$toolDir = Join-Path ${Env:ProgramFiles} "Notepad++\plugins\XMLTools"
Remove-Item $toolDir -Recurse -Force -ea 0

0 comments on commit e1d68d4

Please sign in to comment.