Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VitePress migration #230

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
45 changes: 17 additions & 28 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,42 @@ name: Deploy site
on:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Unrelated to this file)
Do you think it's worth having a CI build check linting, so after you fixing stuff it stays consistent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know of any particular one; would be nice to have though.

push:
branches: [ master ]
workflow_dispatch:

jobs:
doc-deploy:
runs-on: ubuntu-22.04
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false
submodules: recursive

- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.11.0'

# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Configure GitHub Pages
uses: actions/configure-pages@v5

- name: Cache pip
uses: actions/cache@v3
- name: Setup Node
uses: actions/setup-node@v4
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
node-version: 20
cache: npm

- name: Install dependencies
run: pip install -r requirements.txt
run: npm ci

- name: Run Mkdocs
# Build the site using mkdocs
run: mkdocs build --verbose --clean --strict
- name: Build site
run: npm run docs:build

- name: Post-Mkdocs touch/copy files
# miscellaneous files needed for GitHub etc
run: |
touch site/.nojekyll
cp CNAME site/CNAME
touch docs/.vitepress/dist/.nojekyll
cp CNAME docs/.vitepress/dist/CNAME

- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: site # The folder the action should deploy.
folder: docs/.vitepress/dist # The folder the action should deploy.
clean: true # Automatically remove deleted files from the deploy branch
40 changes: 12 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,26 @@
name: Test build
name: Test site build

on:
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-22.04
doc-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false
submodules: recursive

- name: Set up Python 3.x
uses: actions/setup-python@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.11.0'

# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Cache pip
uses: actions/cache@v3
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
node-version: 20
cache: npm

- name: Install dependencies
run: pip install -r requirements.txt
run: npm ci

- name: Run Mkdocs
# Build the site using mkdocs
run: mkdocs build --verbose --clean --strict
- name: Build site
run: npm run docs:build
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
site
venv
# Node.js and NPM
node_modules
npm-debug.log*
codekit-config.json

# VitePress
docs/.vitepress/cache
docs/.vitepress/dist
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "docs/.vitepress/theme"]
path = docs/.vitepress/theme
url = https://github.com/hacks-guide/vitepress-theme
36 changes: 32 additions & 4 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,35 @@
ISC License (ISC)
Copyright (c) 2024, Nintendo Homebrew

Copyright 2023 Nintendo Homebrew Staff
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Additionally, files in `docs/.vitepress` is licensed under the following:

Copyright (c) 2024, Nintendo Homebrew

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
104 changes: 104 additions & 0 deletions docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
Copyright (C) 2024 Nintendo Homebrew
SPDX-License-Identifier: MIT
*/

import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vitepress'

import container from 'markdown-it-container'

import * as i18n from './i18n'

export default defineConfig({
title: "NH Switch Guide",
description: "Switch CFW Guide.",
sitemap: {
hostname: 'https://switch.hacks.guide'
},
head: [['link', { rel: 'icon', href: '/img/favicon.ico' }]],
themeConfig: {
docFooter: {
prev: false,
next: false
},
socialLinks: [
{ icon: 'discord', link: 'https://discord.gg/C29hYvh' },
{ icon: 'github', link: 'https://github.com/nh-server/switch-guide' }
]
},
locales: {
root: i18n.en_US
},
vite: {
resolve: {
alias: [
{
find: /^.*\/VPDocOutlineItem\.vue$/,
replacement: fileURLToPath(
new URL('./theme/components/VPDocOutlineItem.vue', import.meta.url)
)
},
{
find: /^.*\/VPFooter\.vue$/,
replacement: fileURLToPath(
new URL('./theme/components/VPFooter.vue', import.meta.url)
)
},
{
find: /^.*\/VPHero\.vue$/,
replacement: fileURLToPath(
new URL('./theme/components/VPHero.vue', import.meta.url)
)
}
]
}
},
markdown: {
config: (md) => {
md.use(container, "cards", {
render: (tokens, idx) => {
const token = tokens[idx];
if (token.nesting === 1) {
return `<div class="cards">\n`;
} else {
return `</div>\n`;
}
}
});
md.use(container, 'card', {
render: (tokens, idx) => {
const token = tokens[idx];
if (token.nesting === 1) {
return `<div class="card">\n`;
} else {
return `</div>\n`;
}
}
});
md.use(container, "tabs", {
render: (tokens, idx) => {
const token = tokens[idx];
if (token.nesting === 1) {
return `<Tabs ${token.info}>\n`;
} else {
return `</Tabs>\n`;
}
}
});
md.use(container, 'tab', {
render: (tokens, idx) => {
const token = tokens[idx];
if (token.nesting === 1) {
let tokenData = token.info.match(/^ ?tab\s(default\s)?(.*)$/);
let isDefault = typeof tokenData[1] !== 'undefined';
let name = tokenData[2];
return `<Tab name="${name}" ${isDefault ? "default=true" : ""}>`;
} else {
return `</Tab>\n`;
}
}
});
}
}
})
Loading
Loading