Skip to content

Commit 77c2508

Browse files
committed
📝 [docs] Enforces NuGet license URL for MIT license
Updates module metadata and documentation to enforce the inclusion of the NuGet license URL when the MIT license is specified. - 📝 [docs] Updates the module manifest (`.psd1`) and build script to include the `LicenseUri` property, setting it to `https://licenses.nuget.org/MIT` when the license is MIT. - This ensures that NuGet clients correctly render the license information. - 📝 [docs] Modifies the `Update-NuGetPackageMetadata.ps1` script to add or update the `licenseUrl` node in the NuGet package metadata. - It ensures that the `licenseUrl` is set to `https://licenses.nuget.org/MIT` when the license is MIT. - Removes the deprecated `licenseUrl` from the metadata after setting the new `licenseUrl`. - 📝 [docs] Updates the `Publishing.md` documentation to include a note about the NuGet.org requirement for packages declaring the MIT license to also expose the `licenseUrl`. - 💡 This informs users about the automatic normalization of the `licenseUrl` by the script. Signed-off-by: Nick2bad4u <[email protected]>
1 parent ea410a3 commit 77c2508

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

ColorScripts-Enhanced/ColorScripts-Enhanced.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
)
143143

144144
# A URL to the license for this module.
145-
# LicenseUri = ''
145+
LicenseUri = 'https://licenses.nuget.org/MIT'
146146

147147
# License expression or path to license file
148148
License = 'MIT'

build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ $tagsBlock
299299
)
300300
301301
# A URL to the license for this module.
302-
# LicenseUri = '$licenseUri'
302+
LicenseUri = 'https://licenses.nuget.org/MIT'
303303
304304
# License expression or path to license file
305305
License = 'MIT'

docs/Publishing.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ dotnet nuget push 'C:\path\to\ColorScripts-Enhanced.<version>.nupkg' --api-key $
3333

3434
The GitHub publish workflow runs this script automatically.
3535

36+
> **Note:** NuGet.org expects packages that declare the `MIT` license expression to also expose `https://licenses.nuget.org/MIT` via `licenseUrl`. The normalization script sets this automatically so older NuGet clients render the license correctly.
37+
3638
### Getting an API Key
3739

3840
1. Create an account at <https://www.powershellgallery.com>.

scripts/Update-NuGetPackageMetadata.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,16 @@ try {
127127
$licenseNode.InnerText = 'MIT'
128128
$licenseNode.SetAttribute('type', 'expression')
129129

130+
$licenseUrlNode = Get-OrCreateNode -Parent $metadataNode -Name 'licenseUrl' -Manager $nsMgr -NamespaceUri $namespaceUri
131+
$licenseUrlNode.InnerText = 'https://licenses.nuget.org/MIT'
132+
130133
$iconNode = Get-OrCreateNode -Parent $metadataNode -Name 'icon' -Manager $nsMgr -NamespaceUri $namespaceUri
131134
$iconNode.InnerText = 'icon.png'
132135

133136
$readmeNode = Get-OrCreateNode -Parent $metadataNode -Name 'readme' -Manager $nsMgr -NamespaceUri $namespaceUri
134137
$readmeNode.InnerText = 'README.md'
135138

136-
foreach ($deprecated in 'licenseUrl', 'iconUrl') {
139+
foreach ($deprecated in 'iconUrl') {
137140
$deprecatedNode = $metadataNode.SelectSingleNode("ns:$deprecated", $nsMgr)
138141
if ($deprecatedNode) {
139142
[void]$metadataNode.RemoveChild($deprecatedNode)

0 commit comments

Comments
 (0)