Skip to content

Commit

Permalink
Merge pull request #7 from PenguLoader/dev
Browse files Browse the repository at this point in the history
v1.1.0
  • Loading branch information
nomi-san authored Oct 1, 2023
2 parents 01c089b + f427b5c commit a725523
Show file tree
Hide file tree
Showing 50 changed files with 1,203 additions and 3,097 deletions.
46 changes: 37 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,59 @@
on:
push:
branches:
branches:
- main
- dev
workflow_dispatch:

jobs:
env-prod:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment:
name: production
url: https://pengu.lol
steps:
- run: echo >nul

env-dev:
if: github.ref == 'refs/heads/dev'
runs-on: ubuntu-latest
environment:
name: development
url: https://beta.pengu.lol
steps:
- run: echo >nul

deploy:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
environment:
name: production
url: https://pengu.lol

steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3

- name: Set environment variables
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "DENO_DEPLOY_PROJECT=pengu-docs" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
echo "DENO_DEPLOY_PROJECT=pengu-docs-dev" >> $GITHUB_ENV
fi
- uses: actions/setup-node@v3
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: 18.x

- uses: denoland/setup-deno@v1
- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: 1.x

- run: deno install --allow-read --allow-write --allow-env --allow-net --allow-run --no-check -r -f https://deno.land/x/deploy/deployctl.ts
- name: Install Deno deployctl
run: deno install --allow-read --allow-write --allow-env --allow-net --allow-run --no-check -r -f https://deno.land/x/deploy/deployctl.ts

- name: Build project
run: |
Expand All @@ -36,4 +64,4 @@ jobs:
- name: Deploy to Deno Deploy
run: |
cd .vitepress
deployctl deploy --prod --project=pengu-docs ./serve.ts --token ${{ secrets.DENO_DEPLOY_TOKEN }}
deployctl deploy --prod --project=$DENO_DEPLOY_PROJECT ./serve.ts --token ${{ secrets.DENO_DEPLOY_TOKEN }}
174 changes: 31 additions & 143 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
import { defineConfig } from 'vitepress';
import { resolve } from 'node:path';
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs';
import pkg from '../package.json';
import { defineConfig } from 'vitepress'
import { join } from 'node:path'
import pkg from '../package.json'
import { execSync } from 'node:child_process'

const gitBranch = execSync('git rev-parse --abbrev-ref HEAD').toString().trimEnd()
const isBeta = gitBranch !== 'main'

// https://vitepress.dev/reference/site-config
export default defineConfig({
srcDir: './docs',
vite: {
publicDir: resolve(__dirname, '../public'),
},

lang: 'en',
title: 'Pengu Loader',
description: 'Unleash the power of Customization from your League of Legends Client.',
appearance: 'dark',
title: "Pengu Loader" + (isBeta ? ' Beta' : ''),
description: "Unleash the power of Customization from your League of Legends Client.",

lang: 'en',
appearance: isBeta ? undefined : 'dark',
lastUpdated: true,
cleanUrls: true,

srcDir: './docs',
vite: {
publicDir: join(__dirname, '../public')
},

head: [
['meta', { name: 'theme-color', content: '#1e1e20' }],
['link', { rel: 'icon', href: '/PenguLoader.png', type: 'image/png' }],
Expand All @@ -34,16 +39,8 @@ export default defineConfig({
['meta', { name: 'twitter:image', content: 'https://pengu.lol/banner.jpg' }],
],

markdown: {
headers: {
level: [0, 0]
},
config: (md) => {
md.use(tabsMarkdownPlugin);
}
},

themeConfig: {
// https://vitepress.dev/reference/default-theme-config
logo: '/PenguLoader.png',
nav: nav(),

Expand All @@ -64,45 +61,16 @@ export default defineConfig({
],

sidebar: {
'/guide/': sidebarGuide(),
'/runtime-api/': sidebarGuide(),
'/guide/': sidebar(),
'/runtime-api/': sidebar(),
},

footer: {
message: 'Released under the WTF License.',
copyright: `Copyright © 2023-present Pengu Loader`
},
},

locales: {
root: {
label: 'English',
lang: 'en',
},
// 'vi': {
// label: 'Tiếng Việt',
// lang: 'vi',
// link: '/vi/',
// themeConfig: {
// sidebar: {
// '/vi/guide/': sidebarGuideVi(),
// '/vi/runtime-api/': sidebarGuideVi(),
// }
// }
// },
// 'pt-br': {
// label: 'Português (BR)',
// lang: 'pt-br',
// link: '/pt-br/',
// themeConfig: {
// sidebar: {
// '/pt-br/guide/': sidebarGuideBR(),
// '/pt-br/runtime-api/': sidebarGuideBR(),
// }
// }
// },
}
});
})

function nav() {
return [
Expand All @@ -117,13 +85,14 @@ function nav() {
activeMatch: '/runtime-api/'
},
{
text: `v${pkg.version}`,
link: `https://github.com/PenguLoader/PenguLoader/releases/tag/v${pkg.version}`
text: `v${pkg.version}` + (isBeta ? '-beta' : ''),
link: isBeta ? 'https://github.com/PenguLoader/PenguLoader/actions'
: `https://github.com/PenguLoader/PenguLoader/releases/tag/v${pkg.version}`
}
]
}

function sidebarGuide() {
function sidebar() {
return [
{
text: 'Getting Started',
Expand Down Expand Up @@ -151,9 +120,14 @@ function sidebarGuide() {
collapsed: false,
items: [
{ text: 'Overview', link: '/runtime-api/' },
{ text: '[AuthCallback]', link: '/runtime-api/auth-callback' },
{ text: '[Pengu]', link: '/runtime-api/pengu' },
{ text: '[CommandBar]', link: '/runtime-api/command-bar' },
{ text: '[DataStore]', link: '/runtime-api/data-store' },
{ text: '[Effect]', link: '/runtime-api/effect' },
{ text: '[PluginFS]', link: '/runtime-api/plugin-fs' },
{ text: '[Toast]', link: '/runtime-api/toast' },
{ text: '[rcp] context.rcp', link: '/runtime-api/rcp' },
{ text: 'context.socket', link: '/runtime-api/socket' },
]
},
{
Expand All @@ -164,90 +138,4 @@ function sidebarGuide() {
]
}
]
}

function sidebarGuideVi() {
return [
{
text: 'Bắt đầu',
collapsed: false,
items: [
{ text: 'Chào mừng', link: '/vi/guide/welcome' },
{ text: 'Cài đặt', link: '/vi/guide/installation' },
{ text: 'FAQs', link: '/vi/guide/faqs' },
]
},
{
text: 'Plugins',
collapsed: false,
items: [
{ text: 'Plugin JavaScript', link: '/vi/guide/javascript-plugin' },
{ text: 'Hệ Thống Mô-đun', link: '/vi/guide/module-system' },
{ text: 'Theme CSS', link: '/vi/guide/css-theme' },
{ text: 'Xử lí Asset', link: '/vi/guide/asset-handling' },
{ text: 'LCU Request', link: '/vi/guide/lcu-request' },
{ text: 'Tương Thích Với NPM', link: '/vi/guide/npm-compatibility' },
]
},
{
text: 'Runtime API',
collapsed: false,
items: [
{ text: 'Tổng Quan', link: '/vi/runtime-api/' },
{ text: '[AuthCallback]', link: '/vi/runtime-api/auth-callback' },
{ text: '[DataStore]', link: '/vi/runtime-api/data-store' },
{ text: '[Effect]', link: '/vi/runtime-api/effect' },
]
},
{
text: 'Migrations',
collapsed: false,
items: [
{ text: 'Migrate từ phiên bản v0.6', link: '/vi/guide/migration-from-v0-6' },
]
}
]
}

function sidebarGuideBR() {
return [
{
text: "Começando",
collapsed: false,
items: [
{ text: "Bem Vindo", link: "/pt-br/guide/welcome" },
{ text: "Instalação", link: "/pt-br/guide/installation" },
{ text: "FAQs", link: "/pt-br/guide/faqs" },
],
},
{
text: "Plugins",
collapsed: false,
items: [
{ text: "JavaScript Plugin", link: "/pt-br/guide/javascript-plugin" },
{ text: "Module System", link: "/pt-br/guide/module-system" },
{ text: "CSS Theme", link: "/pt-br/guide/css-theme" },
{ text: "Asset Handling", link: "/pt-br/guide/asset-handling" },
{ text: "LCU Request", link: "/pt-br/guide/lcu-request" },
{ text: "Npm Compatibility", link: "/pt-br/guide/npm-compatibility" },
],
},
{
text: "Runtime API",
collapsed: false,
items: [
{ text: "Overview", link: "/pt-br/runtime-api/" },
{ text: "[AuthCallback]", link: "/pt-br/runtime-api/auth-callback" },
{ text: "[DataStore]", link: "/pt-br/runtime-api/data-store" },
{ text: "[Effect]", link: "/pt-br/runtime-api/effect" },
],
},
{
text: "Migrations",
collapsed: false,
items: [
{ text: "Migration from v0.6", link: "/pt-br/guide/migration-from-v0-6" },
],
},
]
}
4 changes: 1 addition & 3 deletions .vitepress/theme/analytics.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="vite/client" />

declare global {
interface Window {
dataLayer?: any[];
Expand Down Expand Up @@ -29,7 +27,7 @@ function mountGoogleAnalytics(id: string) {
}

export function vitepressGoogleAnalytics(id: string) {
if (import.meta.env.PROD && id && typeof window !== 'undefined') {
if (id && typeof window !== 'undefined') {
mountGoogleAnalytics(id);
}
}
26 changes: 16 additions & 10 deletions .vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import DefaultTheme from 'vitepress/theme';
// https://vitepress.dev/guide/custom-theme
import { h } from 'vue';
import Theme from 'vitepress/theme';
import type { EnhanceAppContext } from 'vitepress';

import { vitepressGoogleAnalytics } from './analytics';
import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client';
import vitepressNprogress from 'vitepress-plugin-nprogress';

import './style.css';
import 'vitepress-plugin-nprogress/lib/css/index.css';
import './custom.css';

const theme: typeof DefaultTheme = {
...DefaultTheme,
enhanceApp: (ctx) => {
export default {
extends: Theme,
Layout: () => {
return h(Theme.Layout, null, {
// https://vitepress.dev/guide/extending-default-theme#layout-slots
})
},
enhanceApp(ctx: EnhanceAppContext) {
vitepressNprogress(ctx);
vitepressGoogleAnalytics('G-KX1BWHTJ9S');
enhanceAppWithTabs(ctx.app);
}
};

export default theme;
}
Loading

0 comments on commit a725523

Please sign in to comment.