From 6618f25b2e3155eabce433b03b33040e99ae94d0 Mon Sep 17 00:00:00 2001 From: Bagus Nur Listiyono <28079733+bagusnl@users.noreply.github.com> Date: Fri, 27 Dec 2024 21:41:25 +0700 Subject: [PATCH] optimize + add lighthouse test in CI --- .github/workflows/gh-pages.yaml | 31 ++++++++++++++++++++++++++++++- home/.vitepress/config.mts | 3 +++ home/scripts/index.logo.vue | 4 ++-- lighthouserc.js | 11 +++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 lighthouserc.js diff --git a/.github/workflows/gh-pages.yaml b/.github/workflows/gh-pages.yaml index f64552d..cfa40a6 100644 --- a/.github/workflows/gh-pages.yaml +++ b/.github/workflows/gh-pages.yaml @@ -59,4 +59,33 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 \ No newline at end of file + uses: actions/deploy-pages@v4 + + test: + env: + LHCI_GITHUB_APP_TOKEN: $ {{ secrets.LHCI_GITHUB_APP_TOKEN }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Not needed if lastUpdated is not enabled + # - uses: pnpm/action-setup@v3 # Uncomment this block if you're using pnpm + # with: + # version: 9 # Not needed if you've set "packageManager" in package.json + # - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm # or pnpm / yarn + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Install dependencies + run: npm ci # or pnpm install / yarn install / bun install + - name: Build with VitePress + run: npm run home:build + - name: run Lighthouse CI + run: | + npm install -g @lhci/cli@0.14.x + lhci autorun \ No newline at end of file diff --git a/home/.vitepress/config.mts b/home/.vitepress/config.mts index f872130..94f4cbd 100644 --- a/home/.vitepress/config.mts +++ b/home/.vitepress/config.mts @@ -31,6 +31,9 @@ export default defineConfig({ ['meta', { name: 'twitter:image', content: 'https://collapselauncher.com/img/banner.webp' }], ['meta', { name: 'robots', content: 'index, follow' }], ['meta', { name: 'author', content: 'Collapse Launcher Team' }], + ['link', { rel: 'preload', href: '/img/logo.webp', as: 'image'}], + ['link', { rel: 'preload', href: 'https://fonts.gstatic.com/s/outfit/v11/QGYvz_MVcBeNP4NJtEtq.woff2', as: 'font', type: 'font/woff2', crossorigin: 'anonymous'}], + ['link', { rel: 'preload', href: 'https://fonts.gstatic.com/s/outfit/v11/QGYvz_MVcBeNP4NJuktqQ4E.woff2', as: 'font', type: 'font/woff2', crossorigin: 'anonymous'}], ], appearance: 'dark', themeConfig: { diff --git a/home/scripts/index.logo.vue b/home/scripts/index.logo.vue index 2ba4c77..ce84a94 100644 --- a/home/scripts/index.logo.vue +++ b/home/scripts/index.logo.vue @@ -3,13 +3,13 @@