Skip to content

Commit b10c3d5

Browse files
author
James Brundage
committed
feat: WebSocket Website ( Fixes #19 )
1 parent 8ce2317 commit b10c3d5

File tree

3 files changed

+133
-1
lines changed

3 files changed

+133
-1
lines changed

Build/GitHub/Jobs/BuildWebSocket.psd1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@
2222
id = 'PipeScript'
2323
},
2424
'RunEZOut',
25-
'RunHelpOut'
25+
'RunHelpOut',
26+
@{
27+
name = 'Use PSJekyll Action'
28+
uses = 'PowerShellWeb/PSJekyll@main'
29+
id = 'PSJekyll'
30+
},
2631
<#@{
2732
name = 'Run WebSocket (on branch)'
2833
if = '${{github.ref_name != ''main''}}'

Build/WebSocket.PSJekyll.ps1

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
$sitePath = Join-Path $PSScriptRoot 'docs'
2+
3+
$sourceModule = Get-Module PSJekyll
4+
if (-not $sourceModule) {
5+
$sourceModule = Import-Module ($PSScriptRoot | Split-Path) -PassThru
6+
}
7+
8+
9+
Push-Location $sitePath
10+
$PSJekyll.CurrentSite.Domain = "websocket.powershellweb.com"
11+
$PSJekyll.CurrentSite.Data = @{LastDateBuilt = [datetime]::UtcNow.Date.ToString('yyyy-MM-dd')}
12+
$PSJekyll.CurrentSite.Data = @{
13+
"PSModule/Info" = $sourceModule |
14+
Select-Object -Property Name,
15+
Version,
16+
Description,
17+
Copyright,
18+
CompanyName,
19+
Author,
20+
@{
21+
Name = 'Tags'
22+
Expression = { @($_.PrivateData.PSData.Tags | Select-Object -Unique)}
23+
}
24+
"PSModule/Exports" = @(
25+
foreach ($command in $sourceModule.ExportedCommands.Values) {
26+
[Ordered]@{
27+
Name = $command.Name
28+
CommandType = $command.CommandType
29+
Definition = $command.Definition
30+
ParameterName = $command.Parameters.Keys
31+
Parameter = @(
32+
$command.Parameters.Values |
33+
Select-Object -Property Name,
34+
@{
35+
Name='ParameterType'
36+
Expression = { $_.ParameterType.ToString() }
37+
},
38+
Position,
39+
Mandatory,
40+
ValueFromPipeline,
41+
ValueFromPipelineByPropertyName,
42+
ValueFromRemainingArguments,
43+
HelpMessage
44+
)
45+
}
46+
}
47+
)
48+
49+
"PSModule/FunctionNames" = $sourceModule.ExportedFunctions.Keys
50+
"PSModule/CmdletNames" = $sourceModule.ExportedCmdlets.Keys
51+
"PSModule/AliasNames" = $sourceModule.ExportedAliases.Keys
52+
"PSModule/Aliases" = @($sourceModule.ExportedAliases.Values |
53+
ForEach-Object { [Ordered]@{Name=$_.Name;Definition=$_.Definition} })
54+
55+
"PSModule/VariableNames" = $sourceModule.ExportedVariables.Keys
56+
"PSModule/TypeNames" = $sourceModule.ExportedTypeFiles |
57+
ForEach-Object { (Select-Xml -XPath //Types/Type -Path $_).Node.Name }
58+
59+
}
60+
$PSJekyll.CurrentSite.Data
61+
# It is important to use [Ordered], otherwise, the order of the keys will be random.
62+
# (this will generate more changes than necessary in the git repository, and will be noisier than desired)
63+
$PSJekyll.CurrentSite.Config = [Ordered]@{
64+
title = "WebSocket"
65+
description = "Work with WebSockets in PowerShell"
66+
url = "https://websocket.powershellweb.com"
67+
permalink = 'pretty'
68+
palette = 'Konsolas'
69+
analyticsId = 'G-R5C30737B2'
70+
googleFont = 'Noto Sans'
71+
stylesheet = 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css'
72+
defaults = @([Ordered]@{
73+
values = @{layout='Default'}
74+
})
75+
}
76+
$PSJekyll.CurrentSite.Config
77+
78+
foreach ($templateMember in $PSJekyll.Template.psobject.Members) {
79+
if ($templateMember.Name -notmatch '^(?>layout|include)\p{P}{0,}') {
80+
continue
81+
}
82+
$templateFileType = $matches.0 -replace '\p{P}{0,}$'
83+
$templateFileName = $templateMember.Name -replace "^$([Regex]::Escape($templateFileType))\p{P}{0,}"
84+
85+
if ($templateMember.Name -notmatch '\.([^\.]+?)$') {
86+
$templateFileName += '.html'
87+
}
88+
$templateOut =
89+
if ($templateMember.Invoke) {
90+
$templateMember.Invoke()
91+
} else {
92+
$templateMember.Value
93+
}
94+
try {
95+
$PSJekyll.CurrentSite.$templateFileType = $templateFileName, $templateOut
96+
} catch {
97+
$err = $_
98+
Write-Error -Message "Failed to set $templateFileName of $templateFileType : $err"
99+
}
100+
}
101+
102+
$PSJekyll.CurrentSite.Page = 'Tree', "{% include SiteTree.html %}"
103+
$PSJekyll.CurrentSite.Page = 'Repos', "{% include Repos.md %}"
104+
$PSJekyll.CurrentSite.Page = 'Releases', "{% include Releases.md %}"
105+
$PSJekyll.CurrentSite.Page = 'Contibutors', "{% include Contributor.md %}"
106+
$PSJekyll.CurrentSite.Page = 'Members', "{% include OrgMember.md %}"
107+
$PSJekyll.CurrentSite.Page = 'Function', "{% include PSFunctions.md %}"
108+
$PSJekyll.CurrentSite.Page = 'Functions', "{% include PSFunctions.md %}"
109+
$PSJekyll.CurrentSite.Page = 'Alias', "{% include PSAlias.md %}"
110+
$PSJekyll.CurrentSite.Page = 'Aliases', "{% include PSAlias.md %}"
111+
$PSJekyll.CurrentSite.Page = 'Cmdlet', "{% include PSCmdlet.md %}"
112+
$PSJekyll.CurrentSite.Page = 'Cmdlets', "{% include PSCmdlet.md %}"
113+
$PSJekyll.CurrentSite.Page = 'PSTag', "{% include PSTag.md %}"
114+
$PSJekyll.CurrentSite.Page = 'PSTypeName', "{% include PSTypeName.md %}"
115+
$PSJekyll.CurrentSite.Layout
116+
$PSJekyll.CurrentSite.Include
117+
$PSJekyll.CurrentSite.Page
118+
119+
Pop-Location

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## WebSocket 0.1
2+
3+
> Like It? [Star It](https://github.com/PowerShellWeb/WebSocket)
4+
> Love It? [Support It](https://github.com/sponsors/StartAutomating)
5+
6+
* Initial Release of WebSocket module
7+
* Get-WebSocket gets content from a WebSocket
8+
* Docker container for WebSocket

0 commit comments

Comments
 (0)