Skip to content

Commit 72481c8

Browse files
committed
Start of adding 2.X to new website
1 parent 90ab826 commit 72481c8

File tree

6 files changed

+115
-5
lines changed

6 files changed

+115
-5
lines changed

.nuke/build.schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"PushToNuGet",
3535
"RegenerateBindings",
3636
"ShipApi",
37-
"SignPackages"
37+
"SignPackages",
38+
"Website"
3839
]
3940
},
4041
"Verbosity": {

eng/build/Build.Website.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using Nuke.Common;
5+
using Nuke.Common.IO;
6+
using static Nuke.Common.Tools.Git.GitTasks;
7+
using static Nuke.Common.Tools.Npm.NpmTasks;
8+
9+
partial class Build
10+
{
11+
void FullBuildWebsite()
12+
{
13+
if (!GitHasCleanWorkingCopy())
14+
{
15+
Assert.Fail("Working directory is not clean.");
16+
}
17+
(RootDirectory / "docs").CreateOrCleanDirectory();
18+
(RootDirectory / "eng" / "submodules" / "silk.net-2.x" / "documentation").Copy(
19+
RootDirectory / "docs",
20+
ExistsPolicy.DirectoryMerge
21+
);
22+
(RootDirectory / "docs" / "images").CreateOrCleanDirectory();
23+
Npm($"npm run docusaurus docs:version v2", RootDirectory / "sources" / "Website");
24+
(RootDirectory / "docs").CreateOrCleanDirectory();
25+
Git($"checkout HEAD {RootDirectory / "docs"}");
26+
}
27+
}

eng/build/Build.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,6 @@ out var releaseNotes
131131
)
132132
)
133133
);
134+
135+
Target Website => CommonTarget(x => x.Executes(FullBuildWebsite));
134136
}

eng/submodules/silk.net-2.x

Submodule silk.net-2.x updated 83 files

sources/Website/docusaurus.config.ts

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ import remarkGithubAdmonitionsToDirectives from "remark-github-admonitions-to-di
55
import { visit } from 'unist-util-visit';
66
import { pathToFileURL } from 'node:url';
77
import path from 'node:path';
8+
import { exec } from 'node:child_process';
9+
10+
function getSilk2Version(): string {
11+
let ver = "";
12+
exec(
13+
"git describe --tags HEAD --abbrev=0",
14+
{ cwd: "../../eng/submodules/silk.net-2.x" },
15+
(_a, stdout, _b)=> ver = stdout
16+
);
17+
return ver;
18+
}
819

920
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
1021

@@ -32,15 +43,15 @@ const rewriteSourceLinks = (options) => {
3243
if (!path.relative(docsRoot, resolvedUrlPath).startsWith("..")) {
3344
return;
3445
}
35-
console.log(resolvedUrlPath + " - " + node.url + " - " + fileDirPath + " - " + path.relative(docsRoot, resolvedUrlPath));
46+
// console.log(resolvedUrlPath + " - " + node.url + " - " + fileDirPath + " - " + path.relative(docsRoot, resolvedUrlPath));
3647
let silk2Rel = path.relative(silk2Src, resolvedUrlPath);
3748
if (!silk2Rel.startsWith("..")) {
38-
console.log(`replaced ${silk2Rel}`);
49+
// console.log(`replaced ${silk2Rel}`);
3950
node.url = `https://github.com/dotnet/Silk.NET/blob/main/src/${silk2Rel}`
4051
}
4152
let silk3Rel = path.relative(repoRoot, resolvedUrlPath);
4253
if (!silk3Rel.startsWith("..")) {
43-
console.log(`replaced ${silk3Rel}`);
54+
// console.log(`replaced ${silk3Rel}`);
4455
node.url = `https://github.com/dotnet/Silk.NET/blob/develop/3.0/${silk3Rel}`
4556
}
4657
});
@@ -76,6 +87,8 @@ const config: Config = {
7687
locales: ['en'],
7788
},
7889

90+
staticDirectories: ["static", "../../eng/submodules/silk.net-2.x/documentation/images"],
91+
7992
presets: [
8093
[
8194
'classic',
@@ -93,6 +106,17 @@ const config: Config = {
93106
remarkGithubAdmonitionsToDirectives,
94107
rewriteSourceLinks
95108
],
109+
// TODO uncomment when v3 is released
110+
// lastVersion: "current",
111+
versions: {
112+
current: {
113+
label: 'v3.0.0',
114+
path: "v3"
115+
},
116+
"v2": {
117+
label: getSilk2Version()
118+
}
119+
},
96120
},
97121
blog: {
98122
showReadingTime: true,
@@ -128,6 +152,12 @@ const config: Config = {
128152
label: 'Documentation',
129153
},
130154
{to: '/blog', label: 'Blog', position: 'left'},
155+
{
156+
type: 'docsVersionDropdown',
157+
position: 'right',
158+
dropdownItemsAfter: [],
159+
dropdownActiveClassDisabled: true,
160+
},
131161
{
132162
href: 'https://github.com/facebook/docusaurus',
133163
label: 'GitHub',
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"version": "3.0.0",
3+
"resources": [
4+
{
5+
"@id": "https://gitlab.com/api/v4/projects/51457475/packages/nuget/query",
6+
"@type": "SearchQueryService",
7+
"comment": "Filter and search for packages by keyword."
8+
},
9+
{
10+
"@id": "https://gitlab.com/api/v4/projects/51457475/packages/nuget/query",
11+
"@type": "SearchQueryService/3.0.0-beta",
12+
"comment": "Filter and search for packages by keyword."
13+
},
14+
{
15+
"@id": "https://gitlab.com/api/v4/projects/51457475/packages/nuget/query",
16+
"@type": "SearchQueryService/3.0.0-rc",
17+
"comment": "Filter and search for packages by keyword."
18+
},
19+
{
20+
"@id": "https://gitlab.com/api/v4/projects/51457475/packages/nuget/metadata",
21+
"@type": "RegistrationsBaseUrl",
22+
"comment": "Get package metadata."
23+
},
24+
{
25+
"@id": "https://gitlab.com/api/v4/projects/51457475/packages/nuget/metadata",
26+
"@type": "RegistrationsBaseUrl/3.0.0-beta",
27+
"comment": "Get package metadata."
28+
},
29+
{
30+
"@id": "https://gitlab.com/api/v4/projects/51457475/packages/nuget/metadata",
31+
"@type": "RegistrationsBaseUrl/3.0.0-rc",
32+
"comment": "Get package metadata."
33+
},
34+
{
35+
"@id": "https://gitlab.com/api/v4/projects/51457475/packages/nuget/download",
36+
"@type": "PackageBaseAddress/3.0.0",
37+
"comment": "Get package content (.nupkg)."
38+
},
39+
{
40+
"@id": "https://gitlab.com/api/v4/projects/51457475/packages/nuget",
41+
"@type": "PackagePublish/2.0.0",
42+
"comment": "Push and delete (or unlist) packages."
43+
},
44+
{
45+
"@id": "https://gitlab.com/api/v4/projects/51457475/packages/nuget/symbolpackage",
46+
"@type": "SymbolPackagePublish/4.9.0",
47+
"comment": "Push symbol packages."
48+
}
49+
]
50+
}

0 commit comments

Comments
 (0)