Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

Commit

Permalink
Update DocFX and use a different template (#4)
Browse files Browse the repository at this point in the history
Yep.

---------

Co-authored-by: Lunar Starstrum <lunar@forsaken-borders.net>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 4, 2023
1 parent 2c36b34 commit b1ca624
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 61 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

60 changes: 20 additions & 40 deletions docs/docfx.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"build": {
"globalMetadata": {
"_appFaviconPath": "images/logo.ico",
"_appFooter": "DSharpPlus.CommandAll",
"_appLogoPath": "images/logo_small.png",
"_appName": "DSharpPlus.CommandAll",
"_appTitle": "DSharpPlus.CommandAll"
},
"content": [
{
"files": [
Expand All @@ -16,63 +23,36 @@
]
}
],
"dest": "_site",
"disableGitFeatures": false,
"fileMetadataFiles": [],
"globalMetadata": {
"_appFaviconPath": "images/favicon.ico",
"_appFooter": "DSharpPlus.CommandAll",
"_appLogoPath": "images/logo.png",
"_appName": "CommandAll",
"_appTitle": "DSharpPlus.CommandAll"
},
"globalMetadataFiles": [],
"keepFileLink": false,
"noLangKeyword": false,
"overwrite": [
{
"exclude": [
"obj/**",
"_site/**"
],
"files": [
"apidoc/**.md"
]
}
],
"postProcessors": [],
"resource": [
{
"files": [
"images/**"
]
}
],
"template": [
"default",
"../libs/SingulinkFX/singulinkfx"
],
"xref": [
"https://dsharpplus.github.io/DSharpPlus/xrefmap.yml"
],
"xrefService": "https://xref.docs.microsoft.com/query?uid={uid}"
"output": "_site",
"template": [
"default",
"modern"
]
},
"metadata": [
{
"dest": "api",
"disableDefaultFilter": false,
"disableGitFeatures": false,
"includePrivateMembers": false,
"namespaceLayout": "flattened",
"noRestore": false,
"src": [
{
"src": "../",
"files": [
"*.csproj"
],
"src": "../src"
"src/OoLunar.DSharpPlus.CommandAll.csproj"
]
}
]
],
"dest": "api",
"properties": {
"LangVersion": "preview"
}
}
]
}
Binary file added docs/images/logo.ico
Binary file not shown.
Binary file modified docs/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/images/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/logo_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion libs/SingulinkFX
Submodule SingulinkFX deleted from fa996f
Binary file modified res/logo.ico
Binary file not shown.
Binary file modified res/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/logo_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 29 additions & 17 deletions tools/generate-assets.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
#!/bin/bash

# Deps
apt-get install ImageMagick yarn > /dev/null
yarn global add svgo > /dev/null

# Functions
# If svgo isn't installed, install it
if ! command -v svgo &> /dev/null; then
# Check if yarn is installed
if ! command -v yarn &> /dev/null; then
if ! command -v apt-get &> /dev/null; then
echo "Unable to install svgo. Please install svgo or yarn manually."
exit 1
fi
sudo apt-get install -y yarn > /dev/null
fi
yarn global add svgo > /dev/null
fi

# Function to regenerate assets
regenerate()
{
echo "Generating assets for $1"
Expand All @@ -13,13 +22,12 @@ regenerate()
svgo --multipass --quiet "$1"

# Small size for DocFX
convert -background none -resize 64x64 "$1" "${1%.*}_small.png"
convert -background none -resize 48x48 "$1" "${1%.*}_small.png"

# Convert to PNG
convert -background none "$1" "${1%.*}.png"

# Convert to ICO
# https://stackoverflow.com/a/15104985
convert -background transparent -define "icon:auto-resize=16,24,32,64,128,256" "$1" "${1%.*}.ico"
}

Expand All @@ -29,14 +37,18 @@ for file in res/*.svg; do
regenerate "$file"
done

# Copy all resource files into the images directory
cp res/*.{svg,png,ico} docs/images/

# Uncomment the following lines if you want to automatically commit and push changes to Git
# Check if any files were modified
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add res > /dev/null
git diff-index --quiet HEAD
if [ "$?" == "1" ]; then
git commit -m "[ci-skip] Regenerate resource files." > /dev/null
git push > /dev/null
else
echo "No resource files were modified."
fi
#git config --global user.email "github-actions[bot]@users.noreply.github.com"
#git config --global user.name "github-actions[bot]"
#git add res > /dev/null
#git diff-index --quiet HEAD
#if [ "$?" == "1" ]; then
# git commit -m "[ci-skip] Regenerate resource files." > /dev/null
# git push > /dev/null
#else
# echo "No resource files were modified."
#fi

0 comments on commit b1ca624

Please sign in to comment.