Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/PSModule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ Test:
# Skip: true
# MacOS:
# Skip: true
# Build:
# Docs:
# Skip: true
Build:
Site:
Skip: true

Linter:
env:
Expand Down
75 changes: 0 additions & 75 deletions .github/mkdocs.yml

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/Process-PSModule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ permissions:

jobs:
Process-PSModule:
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@11117919e65242d3388727819a751f74ad24ea9e # v5.5.0
secrets: inherit
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@1653be8d36607d9535f600278c44789979477813 # v6.1.16
secrets:
APIKey: ${{ secrets.APIKey }}
2 changes: 1 addition & 1 deletion .github/workflows/Update-FontsData.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
Expand Down
71 changes: 71 additions & 0 deletions .github/zensical.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[project]
site_name = "-{{ REPO_NAME }}-"
repo_name = "-{{ REPO_OWNER }}-/-{{ REPO_NAME }}-"
repo_url = "https://github.com/-{{ REPO_OWNER }}-/-{{ REPO_NAME }}-"

[project.theme]
variant = "classic"
language = "en"
font.text = "Roboto"
font.code = "Sono"
logo = "Assets/icon.png"
favicon = "Assets/icon.png"
features = [
"navigation.instant",
"navigation.instant.progress",
"navigation.indexes",
"navigation.top",
"navigation.tracking",
"navigation.expand",
"search.suggest",
"search.highlight",
"content.code.copy"
]

[[project.theme.palette]]
media = "(prefers-color-scheme)"
toggle.icon = "material/link"
toggle.name = "Switch to dark mode"

[[project.theme.palette]]
media = "(prefers-color-scheme: dark)"
scheme = "slate"
primary = "black"
accent = "green"
toggle.icon = "material/toggle-switch-off-outline"
toggle.name = "Switch to light mode"

[[project.theme.palette]]
media = "(prefers-color-scheme: light)"
scheme = "default"
primary = "indigo"
accent = "green"
toggle.icon = "material/toggle-switch"
toggle.name = "Switch to system preference"

[project.theme.icon]
repo = "material/github"

[project.markdown_extensions.toc]
permalink = true

[project.markdown_extensions.attr_list]
[project.markdown_extensions.admonition]
[project.markdown_extensions.md_in_html]
[project.markdown_extensions."pymdownx.details"]
[project.markdown_extensions."pymdownx.superfences"]

[[project.extra.social]]
icon = "fontawesome/brands/discord"
link = "https://discord.gg/jedJWCPAhD"
name = "-{{ REPO_OWNER }}- on Discord"

[[project.extra.social]]
icon = "fontawesome/brands/github"
link = "https://github.com/-{{ REPO_OWNER }}-/"
name = "-{{ REPO_OWNER }}- on GitHub"

[project.extra.consent]
title = "Cookie consent"
description = "We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for. With your consent, you're helping us to make our documentation better."
actions = ["accept", "reject"]
41 changes: 41 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Contributing to NerdFonts

Thank you for your interest in contributing! This repository is part of the
[PSModule](https://github.com/PSModule) framework and follows the shared
contribution guidelines.

## Getting started

1. Read the repository [README](README.md) to understand what the module does
and how it is built.
2. Familiarize yourself with the PSModule framework documentation at
<https://msxorg.github.io/docs/Frameworks/Process-PSModule/>.

## How to contribute

- **Bug reports and feature requests:** open a [GitHub issue](../../issues).
- **Code changes:** open a [pull request](../../pulls).
- **Keep changes small and focused.** Each pull request should address one
concern.
- **Open draft pull requests early** so maintainers can provide feedback while
work is in progress.

## Repository conventions

- Source code lives in `src/`.
- Tests live in `tests/` and are run with [Pester](https://pester.dev/).
- The module manifest is generated by the
[Process-PSModule](https://github.com/PSModule/Process-PSModule) workflow.
- Commit messages should be short and specific.

## Development

```powershell
Import-Module ./src
Invoke-Pester
```

## Code of conduct

Be respectful and constructive. We want this project to be welcoming for
everyone.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ To uninstall a NerdFont for all users (requires elevated privileges):
Uninstall-Font -Name 'FiraCode*' -Scope AllUsers
```

## Documentation

Every command has full reference documentation, generated from its comment-based help and published at [psmodule.io/NerdFonts](https://psmodule.io/NerdFonts/). Explore the commands and read detailed help directly from PowerShell:

```powershell
Get-Command -Module NerdFonts
Get-Help -Name Install-NerdFont -Examples
```

## Contributing

Coder or not, you can contribute to the project! We welcome all contributions.
Expand Down
2 changes: 1 addition & 1 deletion src/functions/public/Get-NerdFont.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Get the NerdFont with the name ending with 'Code'.

.LINK
https://psmodule.io/NerdFonts/Functions/Get-NerdFont
https://psmodule.io/NerdFonts/Functions/Get-NerdFont/

.NOTES
More information about the NerdFonts can be found at:
Expand Down
8 changes: 4 additions & 4 deletions src/functions/public/Install-NerdFont.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Requires -Modules @{ ModuleName = 'Fonts'; RequiredVersion = '1.1.21' }
#Requires -Modules @{ ModuleName = 'Admin'; RequiredVersion = '1.1.6' }
#Requires -Modules @{ ModuleName = 'Fonts'; ModuleVersion = '1.1.27'; MaximumVersion = '1.999.999' }
#Requires -Modules @{ ModuleName = 'Admin'; ModuleVersion = '1.1.13'; MaximumVersion = '1.999.999' }

function Install-NerdFont {
<#
Expand Down Expand Up @@ -40,7 +40,7 @@ function Install-NerdFont {
Installs only the monospace variant of all Nerd Fonts to the current user.

.LINK
https://psmodule.io/NerdFonts/Functions/Install-NerdFont
https://psmodule.io/NerdFonts/Functions/Install-NerdFont/

.NOTES
More information about the NerdFonts can be found at:
Expand Down Expand Up @@ -95,7 +95,7 @@ Please run the command again with elevated rights (Run as Administrator) or prov
$seenNames = [System.Collections.Generic.HashSet[string]]::new([System.StringComparer]::OrdinalIgnoreCase)

$guid = (New-Guid).Guid
$tempPath = Join-Path -Path $HOME -ChildPath "NerdFonts-$guid"
$tempPath = Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath "NerdFonts-$guid"
if (-not (Test-Path -Path $tempPath -PathType Container)) {
Write-Verbose "Create folder [$tempPath]"
$null = New-Item -Path $tempPath -ItemType Directory
Expand Down
25 changes: 18 additions & 7 deletions tests/NerdFonts.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -265,25 +265,36 @@ Describe 'Module' {
$script:NerdFonts = $fonts
}

$fileLock = $null
try {
# Place a regular placeholder file so Test-Path returns true for cache-hit detection
# Lock the cached file with an exclusive share so Copy-Item fails, forcing the
# function to fall back to a real download using live test data.
if (-not (Test-Path -LiteralPath $cacheTagDir)) {
$null = New-Item -ItemType Directory -Path $cacheTagDir -Force
}
Set-Content -LiteralPath $cachedFile -Value 'placeholder'
if (Test-Path -LiteralPath $cachedFile) {
Remove-Item -LiteralPath $cachedFile -Recurse -Force -ErrorAction SilentlyContinue
}
Set-Content -LiteralPath $cachedFile -Value 'locked-cache-entry' -Force
$fileLock = [System.IO.File]::Open(
$cachedFile,
[System.IO.FileMode]::Open,
[System.IO.FileAccess]::Read,
[System.IO.FileShare]::None
)

Mock -ModuleName NerdFonts Get-Font { @() }
Mock -ModuleName NerdFonts Install-Font {}
# Mock Copy-Item to throw only for the cache-read path, simulating
# a locked/unreadable cached file cross-platform.
Mock -ModuleName NerdFonts Copy-Item {
throw 'Simulated cache read failure'
} -ParameterFilter { $LiteralPath -and $LiteralPath -eq $cachedFile }

# Should not throw — falls back to download
{ Install-NerdFont -Name $fontName -Force:$false -ErrorAction Stop } | Should -Not -Throw
Should -Invoke -ModuleName NerdFonts Install-Font -Times 1 -Exactly
} finally {
# Release the lock before restoring cache state.
if ($fileLock) {
$fileLock.Dispose()
$fileLock = $null
}
# Restore original cache state so no user/CI state is mutated
if ($hadExistingCache) {
Move-Item -LiteralPath $backupPath -Destination $cachedFile -Force -ErrorAction SilentlyContinue
Expand Down
Loading