chore: website fixes (#446)

This commit is contained in:
Vlad Frangu
2022-05-25 10:58:30 +03:00
committed by GitHub
parent 748db34e30
commit ca1110a1ae
8 changed files with 5448 additions and 2726 deletions

View File

@@ -1,40 +0,0 @@
name: Website build check
on:
push:
branches:
- '**'
pull_request:
jobs:
build_website:
name: 'Website build'
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Add problem matcher
run: echo "::add-matcher::.github/problemMatchers/eslint.json" && echo "::add-matcher::.github/problemMatchers/tsc.json"
- name: Check for any website changes
id: website_files_changed
uses: tj-actions/changed-files@v18.7
with:
files: website/**/*
- name: Install common dependencies
if: steps.website_files_changed.outputs.any_changed == 'true'
run: npm ci
- name: Install website dependencies
if: steps.website_files_changed.outputs.any_changed == 'true'
run: pushd website && npm ci && popd
- name: Check lint on discord-api-types/website
if: steps.website_files_changed.outputs.any_changed == 'true'
run: pushd website && npm run test:lint && popd
- name: Run build on website
if: steps.website_files_changed.outputs.any_changed == 'true'
run: pushd website && NODE_OPTIONS=--max_old_space_size=4096 npm run build && popd

View File

@@ -147,9 +147,11 @@ const config = {
{ name: 'subject', content: 'Documentation website for discord-api-types' },
{ name: 'summary', content: Description },
{ name: 'target', content: 'all' },
{ name: 'twitter:card', content: 'summary' },
{ name: 'twitter:card', content: 'summary_large_image' },
{ name: 'twitter:creator', content: '@WolfgalVlad' },
{ name: 'twitter:site', content: '@WolfgalVlad' },
{ name: 'twitter:title', content: Title },
{ name: 'twitter:description', content: Description },
{ name: 'url', content: BaseUrl },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ property: 'og:description', content: Description },
@@ -160,15 +162,14 @@ const config = {
{ property: 'og:locale', content: 'en_US' },
{ property: 'og:site_name', content: Title },
{ property: 'og:title', content: Title },
{ property: 'og:type', content: 'website' },
{ property: 'og:type', content: 'article' },
{ property: 'og:url', content: BaseUrl }
],
navbar: {
title: 'discord-api-types',
logo: {
alt: 'Discord API Types Logo',
src: 'svgs/logo_light.svg',
srcDark: 'svgs/logo_dark.svg'
src: 'svgs/logo_light.svg'
},
items: [
{
@@ -188,12 +189,20 @@ const config = {
label: 'API',
position: 'left',
items: [
{ label: versions.length === 0 ? 'Development Time' : '@next', to: versions.length === 0 ? 'api' : 'api/next' },
{ label: versions.length === 0 ? 'Development Time' : 'next 🚧', to: versions.length === 0 ? 'api' : 'api/next' },
...versions.map((version, i) => ({
label: version,
to: i === 0 ? 'api' : `api/${version}`
}))
]
},
// Right
{
href: 'https://github.com/discordjs/discord-api-types',
position: 'right',
className: 'header-github-link',
'aria-label': 'GitHub repository'
}
]
},

7997
website/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,8 @@
"format": "prettier --write \"{src,static,scripts,docs}/**/*.{js,jsx,ts,tsx,css,scss,json,md,mdx,yml}\"",
"format:check": "prettier --check \"{src,static,scripts,docs}/**/*.{js,jsx,ts,tsx,css,scss,json,md,mdx,yml}\"",
"test:lint": "run-s lint:no-fix format:check lint:md-no-fix",
"vercel-build": "npm run build"
"vercel-build": "npm run build",
"postinstall": "echo TEMPORARY PATCHES FOR ISSUES && patch-package"
},
"dependencies": {
"@docusaurus/core": "2.0.0-beta.20",
@@ -40,6 +41,7 @@
"clsx": "^1.1.1",
"docusaurus-plugin-sass": "^0.2.2",
"docusaurus-plugin-typedoc-api": "^1.11.0",
"patch-package": "^6.4.7",
"prism-react-renderer": "^1.3.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",

View File

@@ -0,0 +1,62 @@
diff --git a/node_modules/@sapphire/docusaurus-plugin-ts2esm2cjs/dist/index.js b/node_modules/@sapphire/docusaurus-plugin-ts2esm2cjs/dist/index.js
index fa63a72..ecab1c5 100644
--- a/node_modules/@sapphire/docusaurus-plugin-ts2esm2cjs/dist/index.js
+++ b/node_modules/@sapphire/docusaurus-plugin-ts2esm2cjs/dist/index.js
@@ -74,7 +74,7 @@ var transformNode = (node, options) => {
{
type: node.type,
lang: node.lang,
- meta: `${jsHighlight} showLineNumbers`,
+ meta: `${jsHighlight}`,
value: prettierFormatCode(restoreNewLines(cjsCode), options.prettierOptions)
},
{
@@ -84,7 +84,7 @@ var transformNode = (node, options) => {
{
type: node.type,
lang: node.lang,
- meta: `${jsHighlight} showLineNumbers`,
+ meta: `${jsHighlight}`,
value: prettierFormatCode(restoreNewLines(esmCode), options.prettierOptions)
},
{
@@ -94,7 +94,7 @@ var transformNode = (node, options) => {
{
type: node.type,
lang: node.lang,
- meta: `${tsHighlight} showLineNumbers`,
+ meta: `${tsHighlight}`,
value: node.value
},
{
diff --git a/node_modules/@sapphire/docusaurus-plugin-ts2esm2cjs/dist/index.mjs b/node_modules/@sapphire/docusaurus-plugin-ts2esm2cjs/dist/index.mjs
index b7c3523..506c78b 100644
--- a/node_modules/@sapphire/docusaurus-plugin-ts2esm2cjs/dist/index.mjs
+++ b/node_modules/@sapphire/docusaurus-plugin-ts2esm2cjs/dist/index.mjs
@@ -48,7 +48,7 @@ var transformNode = (node, options) => {
{
type: node.type,
lang: node.lang,
- meta: `${jsHighlight} showLineNumbers`,
+ meta: `${jsHighlight}`,
value: prettierFormatCode(restoreNewLines(cjsCode), options.prettierOptions)
},
{
@@ -58,7 +58,7 @@ var transformNode = (node, options) => {
{
type: node.type,
lang: node.lang,
- meta: `${jsHighlight} showLineNumbers`,
+ meta: `${jsHighlight}`,
value: prettierFormatCode(restoreNewLines(esmCode), options.prettierOptions)
},
{
@@ -68,7 +68,7 @@ var transformNode = (node, options) => {
{
type: node.type,
lang: node.lang,
- meta: `${tsHighlight} showLineNumbers`,
+ meta: `${tsHighlight}`,
value: node.value
},
{

View File

@@ -0,0 +1,20 @@
diff --git a/node_modules/docusaurus-plugin-typedoc-api/lib/components/MemberDeclaration.js b/node_modules/docusaurus-plugin-typedoc-api/lib/components/MemberDeclaration.js
index c42d124..ba78fb2 100644
--- a/node_modules/docusaurus-plugin-typedoc-api/lib/components/MemberDeclaration.js
+++ b/node_modules/docusaurus-plugin-typedoc-api/lib/components/MemberDeclaration.js
@@ -38,6 +38,15 @@ function MemberDeclaration({
const minimal = useMinimalLayout.useMinimalLayout();
const showTypes = reflection.typeParameter && reflection.typeParameter.length > 0;
const showDeclaration = !minimal && ((_reflection$type = reflection.type) === null || _reflection$type === void 0 ? void 0 : _reflection$type.declaration);
+
+ if (!reflection.type) {
+ // TEMPORARY: define type as literal
+ reflection.type = {
+ type: 'literal',
+ value: typeof reflection.defaultValue !== 'undefined' ? reflection.defaultValue : 'unknown type',
+ }
+ }
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
className: "tsd-panel-content",

View File

@@ -115,3 +115,17 @@ footer > .container {
width: 64px;
margin-top: -25%;
}
// Inspired from docusaurus - see THIRD_PARTY_LICENSE.md
.header-github-link:hover {
opacity: 0.6;
}
.header-github-link::before {
content: '';
width: 24px;
height: 24px;
display: flex;
background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='white' d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E")
no-repeat;
}

View File

@@ -20,15 +20,21 @@
}
}
.main-wrapper > :not(.hero) {
max-width: 96rem;
width: 100%;
margin-left: auto;
margin-right: auto;
.main-wrapper {
> :not(.hero) {
max-width: 96rem;
width: 100%;
margin-left: auto;
margin-right: auto;
}
> .theme-back-to-top-button {
width: 3rem;
}
}
// Theme the theme switcher icon to always be white
.navbar__items.navbar__items--right > :first-child,
.navbar__items.navbar__items--right > :nth-child(2),
.navbar-sidebar__brand > :nth-child(2) {
color: #f5f6f7;