diff --git a/.github/workflows/preview-deployment.yml b/.github/workflows/preview-deployment.yml index 6f35140f..1c120be1 100644 --- a/.github/workflows/preview-deployment.yml +++ b/.github/workflows/preview-deployment.yml @@ -57,6 +57,8 @@ jobs: # vitepress build command does not have --debug option, so we need to set it manually where the debug package is used. # DEBUG: 'vitepress:*' VUE_PROD_HYDRATION_MISMATCH_DETAILS_FLAG: '1' + PWA_NAME: 'CrashMC 文档(预览)' + DEPLOYMENT_STATUS: 'preview' - name: Publish to Cloudflare Pages id: deploy diff --git a/.vitepress/config.ts b/.vitepress/config.ts index f05ea004..50a06559 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -79,26 +79,27 @@ const pwaConfig: PwaOptions = { categories: ["minecraft", "crash"], icons: [ { - src: "logo-new.webp", - sizes: "1024x1024", - type: "image/webp", - }, - { - src: "pwa-512x512.webp", - sizes: "512x512", - type: "image/webp", + src: "pwa-64x64.png", + sizes: "64x64", + type: "image/png" }, { - src: "pwa-192x192.webp", + src: "pwa-192x192.png", sizes: "192x192", - type: "image/webp", + type: "image/png" }, { - src: "pwa-64x64.webp", - sizes: "64x64", - type: "image/webp", + src: "pwa-512x512.png", + sizes: "512x512", + type: "image/png" }, - ], + { + src: "maskable-icon-512x512.png", + sizes: "512x512", + type: "image/png", + purpose: "maskable" + } + ] }, workbox: { globPatterns: ["**/*.{css,js,html,svg,webp,ico,txt,woff2}"], @@ -149,11 +150,6 @@ const pwaConfig: PwaOptions = { }, ], }, - pwaAssets: { - config: true, - overrideManifestIcons: true, - injectThemeColor: true, - }, } const themeConfig: DefaultTheme.Config = { @@ -324,12 +320,12 @@ export default withPwa( config: (md) => { // @ts-expect-error TS2769 md.use(BiDirectionalLinks({ - dir: "docs", - baseDir: "/", - }), + dir: "docs", + baseDir: "/", + }), ), - // @ts-expect-error TS2769 - md.use(InlineLinkPreviewElementTransform) + // @ts-expect-error TS2769 + md.use(InlineLinkPreviewElementTransform) }, }, @@ -338,6 +334,8 @@ export default withPwa( }, head: [ + ['link', { rel: 'icon', href: '/favicon.ico' }], + ['link', { rel: 'apple-touch-icon', href: '/apple-touch-icon-180x180.png' }], [ "script", { diff --git a/docs/public/apple-touch-icon-180x180.png b/docs/public/apple-touch-icon-180x180.png new file mode 100644 index 00000000..86262afd Binary files /dev/null and b/docs/public/apple-touch-icon-180x180.png differ diff --git a/docs/public/favicon.ico b/docs/public/favicon.ico new file mode 100644 index 00000000..dda3d92f Binary files /dev/null and b/docs/public/favicon.ico differ diff --git a/docs/public/maskable-icon-512x512.png b/docs/public/maskable-icon-512x512.png new file mode 100644 index 00000000..df1bb9a1 Binary files /dev/null and b/docs/public/maskable-icon-512x512.png differ diff --git a/docs/public/pwa-192x192.png b/docs/public/pwa-192x192.png new file mode 100644 index 00000000..e47e6254 Binary files /dev/null and b/docs/public/pwa-192x192.png differ diff --git a/docs/public/pwa-192x192.webp b/docs/public/pwa-192x192.webp deleted file mode 100644 index e71dfa7a..00000000 Binary files a/docs/public/pwa-192x192.webp and /dev/null differ diff --git a/docs/public/pwa-512x512.png b/docs/public/pwa-512x512.png new file mode 100644 index 00000000..7a0e001e Binary files /dev/null and b/docs/public/pwa-512x512.png differ diff --git a/docs/public/pwa-512x512.webp b/docs/public/pwa-512x512.webp deleted file mode 100644 index fb60a0ab..00000000 Binary files a/docs/public/pwa-512x512.webp and /dev/null differ diff --git a/docs/public/pwa-64x64.png b/docs/public/pwa-64x64.png new file mode 100644 index 00000000..651be5d2 Binary files /dev/null and b/docs/public/pwa-64x64.png differ diff --git a/docs/public/pwa-64x64.webp b/docs/public/pwa-64x64.webp deleted file mode 100644 index 781d0c6f..00000000 Binary files a/docs/public/pwa-64x64.webp and /dev/null differ diff --git a/package.json b/package.json index e1725c56..16af8a1f 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "docs:eslint": "eslint --ignore-path .gitignore --ext .ts,.vue \".vitepress/**/*.{ts,vue}\"", "docs:zhlint": "zhlint 'docs/**/*.md' --fix", "docs:tsc": "tsc --build && vue-tsc --noEmit", - "prepare": "husky install" + "prepare": "husky install", + "generate-pwa-assets": "pwa-assets-generator --preset minimal-2023 docs/public/logo-new.webp" }, "name": "mccrash-docs", "version": "0.0.0", diff --git a/pwa-assets.config.ts b/pwa-assets.config.ts deleted file mode 100644 index a9e34571..00000000 --- a/pwa-assets.config.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { - createAppleSplashScreens, - defineConfig, - minimal2023Preset, -} from "@vite-pwa/assets-generator/config" - -export default defineConfig({ - headLinkOptions: { - preset: "2023", - }, - preset: { - ...minimal2023Preset, - appleSplashScreens: createAppleSplashScreens( - { - padding: 0.3, - resizeOptions: { fit: "contain", background: "white" }, - darkResizeOptions: { fit: "contain", background: "black" }, - linkMediaOptions: { - log: true, - addMediaScreen: true, - xhtml: true, - }, - }, - ['iPad Air 9.7"'], - ), - }, - images: "./public/logo-new.webp", -})