Skip to content

Commit

Permalink
Merge pull request #6 from ShaunLawrie/docs
Browse files Browse the repository at this point in the history
Add docs site
  • Loading branch information
ShaunLawrie authored Oct 22, 2023
2 parents 18c3869 + 65694e4 commit 30baf80
Show file tree
Hide file tree
Showing 52 changed files with 10,441 additions and 86 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/build-test.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
src/packages
# build output
dist/
# generated types
.astro/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store
4 changes: 4 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}
12 changes: 12 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"cwd": "${workspaceFolder}/PwshSpectreConsole.Docs",
"name": "Docs Development server",
"request": "launch",
"type": "node-terminal"
}
]
}
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
58 changes: 58 additions & 0 deletions PwshSpectreConsole.Docs/UpdateDocs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#requires -Modules HelpOut

$ErrorActionPreference = "Stop"

Import-Module "..\PwshSpectreConsole\PwshSpectreConsole.psd1" -Force
Remove-Item -Recurse -Path ".\src\content\docs\reference\*" -Force
Get-Module PwshSpectreConsole | Save-MarkdownHelp -OutputPath ".\src\content\docs\reference\" -IncludeYamlHeader -YamlHeaderInformationType Metadata -ExcludeFile "*.gif", "*.png"

# Post-processing for astro stuff
$groups = @(
@{ Name = "Prompts"; Matches = @("read-") }
@{ Name = "Formatting"; Matches = @("format-") }
@{ Name = "Progress"; Matches = @("invoke-", "job") }
@{ Name = "Images"; Matches = @("image") }
@{ Name = "Writing"; Matches = @("write-", "escaped") }
@{ Name = "Config"; Matches = @("set-") }
)
$remove = @("Start-SpectreDemo.md")
$docs = Get-ChildItem ".\src\content\docs\reference\" -Filter "*.md" -Recurse
foreach($doc in $docs) {
if($remove -contains $doc.Name) {
Remove-Item $doc.FullName
continue
}

$group = $null
foreach($testGroup in $groups) {
foreach($match in $testGroup.Matches) {
if($doc.Name -like "*$match*") {
$group = $testGroup
break
}
}
}

$outLocation = ".\src\content\docs\reference\$($group.Name)\$($doc.Name)"
if($null -eq $group) {
$outLocation = $doc.FullName
}
New-Item -ItemType Directory -Path ".\src\content\docs\reference\$($group.Name)" -Force | Out-Null
$content = Get-Content $doc.FullName -Raw
Remove-Item $doc.FullName
$content -replace '```PowerShell', '```powershell' -replace '(?m)^.+\n^[\-]{10,99}', '' | Out-File $outLocation
}

# Build the docs site
npm run build --prefix .\

# Yeet it to cloudflare
$choice = Read-Host "`nDeploy to CF pages? (y/n)"
if($choice -eq "y") {
if(npx wrangler whoami | Where-Object { $_ -like "*You are logged in*" }) {
Write-Host "Already logged into cloudflare"
} else {
npx wrangler login
}
npx wrangler pages deploy .\dist --project-name pwshspectreconsole --commit-dirty=true --branch=main
}
51 changes: 51 additions & 0 deletions PwshSpectreConsole.Docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";

import tailwind from "@astrojs/tailwind";

// https://astro.build/config
export default defineConfig({
integrations: [
starlight({
title: "PwshSpectreConsole",
editLink: {
baseUrl: "https://github.com/ShaunLawrie/PwshSpectreConsole/edit/main/PwshSpectreConsole.Docs/",
},
favicon: "/favicon.png",
customCss: ["./src/tailwind.css"],
social: {
github: "https://github.com/ShaunLawrie/PwshSpectreConsole",
twitter: "https://twitter.com/Shaun_Lawrie",
},
sidebar: [
{
label: "Guides",
items: [
{
label: "Install",
link: "/guides/install/",
},
{
label: "Getting Started",
link: "/guides/get-started/",
},
{
label: "FAQs",
link: "/guides/faqs/",
},
],
},
{
label: "Command Reference",
autogenerate: {
directory: "reference",
collapsed: true,
},
},
],
}),
tailwind({
applyBaseStyles: false,
}),
],
});
Loading

0 comments on commit 30baf80

Please sign in to comment.