From ef422dcda84de0c947488a07fc6b1006607f7378 Mon Sep 17 00:00:00 2001 From: taskylizard <75871323+taskylizard@users.noreply.github.com> Date: Thu, 25 Jan 2024 16:32:45 +0000 Subject: [PATCH] style: format with new style --- .github/workflows/deploy-api.yml | 2 +- .github/workflows/deploy-gh-pages.yml | 2 +- .github/workflows/single-page.yml | 4 +- .prettierrc.json | 14 -- .prettierrc.yaml | 6 + .vitepress/config.mts | 117 +++++++++------- .vitepress/constants.ts | 127 ++++++++++-------- .vitepress/hooks/Template.vue | 13 +- .vitepress/hooks/index.ts | 8 +- .vitepress/hooks/meta.ts | 121 +++++++++-------- .vitepress/hooks/opengraph.ts | 94 ++++++------- .vitepress/hooks/rss.ts | 49 ++++--- .vitepress/hooks/satoriConfig.ts | 54 ++++---- .vitepress/markdown/base64.ts | 26 ++-- .vitepress/markdown/emoji.ts | 44 +++--- .vitepress/markdown/toggleStarred.ts | 14 +- .vitepress/middleware/cors.ts | 8 +- .vitepress/routes/index.post.ts | 34 ++--- .vitepress/routes/test.ts | 4 +- .vitepress/theme/Layout.vue | 46 +++---- .vitepress/theme/PostLayout.vue | 26 ++-- .vitepress/theme/Posts.vue | 21 +-- .vitepress/theme/components/Announcement.vue | 7 +- .vitepress/theme/components/Authors.vue | 40 +++--- .vitepress/theme/components/CardField.vue | 4 +- .vitepress/theme/components/Feedback.vue | 87 +++++++----- .vitepress/theme/components/Feedback2.vue | 53 +++++--- .vitepress/theme/components/InputField.vue | 6 +- .vitepress/theme/components/Modal.vue | 15 ++- .vitepress/theme/components/SidebarCard.vue | 14 +- .vitepress/theme/components/Switch.vue | 6 +- .vitepress/theme/components/ToggleStarred.vue | 5 +- .vitepress/theme/composables/nprogress.ts | 30 ++--- .vitepress/theme/index.ts | 22 +-- .vitepress/theme/posts.data.ts | 28 ++-- .vitepress/theme/style.css | 12 +- .vitepress/types/Feedback.ts | 33 ++--- .vitepress/utils.ts | 13 +- .vitepress/vue-shim.d.ts | 6 +- eslint.config.js | 6 +- nitro.config.ts | 14 +- tsconfig.json | 4 +- unocss.config.ts | 30 ++--- 43 files changed, 686 insertions(+), 583 deletions(-) delete mode 100644 .prettierrc.json create mode 100644 .prettierrc.yaml diff --git a/.github/workflows/deploy-api.yml b/.github/workflows/deploy-api.yml index 2b46d14a2..f5ef493fb 100644 --- a/.github/workflows/deploy-api.yml +++ b/.github/workflows/deploy-api.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 - cache: "pnpm" + cache: 'pnpm' - run: pnpm install --no-frozen-lockfile diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml index 36a52e373..efe470b39 100644 --- a/.github/workflows/deploy-gh-pages.yml +++ b/.github/workflows/deploy-gh-pages.yml @@ -33,7 +33,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: '3.10' - name: Install dependencies run: pnpm install - name: Preprocess files diff --git a/.github/workflows/single-page.yml b/.github/workflows/single-page.yml index 9bf1c5913..0aea5b3ec 100644 --- a/.github/workflows/single-page.yml +++ b/.github/workflows/single-page.yml @@ -19,10 +19,10 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: '3.10' - name: Create local changes run: python .github/single-page.py - uses: stefanzweifel/git-auto-commit-action@v4 with: - commit_message: "♻️ update single page" + commit_message: '♻️ update single page' diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index 62e685119..000000000 --- a/.prettierrc.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "semi": true, - "printWidth": 100, - "tabWidth": 2, - "useTabs": false, - "singleQuote": false, - "quoteProps": "as-needed", - "jsxSingleQuote": false, - "trailingComma": "all", - "bracketSpacing": true, - "bracketSameLine": true, - "arrowParens": "always", - "proseWrap": "always" -} diff --git a/.prettierrc.yaml b/.prettierrc.yaml new file mode 100644 index 000000000..88e0a1580 --- /dev/null +++ b/.prettierrc.yaml @@ -0,0 +1,6 @@ +proseWrap: always +semi: false +singleQuote: true +printWidth: 80 +trailingComma: none +htmlWhitespaceSensitivity: ignore diff --git a/.vitepress/config.mts b/.vitepress/config.mts index e62e0b795..097692c7c 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -1,93 +1,108 @@ -import { defineConfig } from "vitepress"; -import UnoCSS from "unocss/vite"; -import consola from "consola"; -import { commitRef, feedback, meta, search, sidebar, socialLinks } from "./constants"; -import { generateImages, generateMeta, generateFeed } from "./hooks"; -import { toggleStarredPlugin } from "./markdown/toggleStarred"; -import { base64DecodePlugin } from "./markdown/base64"; -import { movePlugin, emojiRender, defs } from "./markdown/emoji"; +import { defineConfig } from 'vitepress' +import UnoCSS from 'unocss/vite' +import consola from 'consola' +import { + commitRef, + feedback, + meta, + search, + sidebar, + socialLinks +} from './constants' +import { generateImages, generateMeta, generateFeed } from './hooks' +import { toggleStarredPlugin } from './markdown/toggleStarred' +import { base64DecodePlugin } from './markdown/base64' +import { movePlugin, emojiRender, defs } from './markdown/emoji' -const baseUrl = process.env.GITHUB_ACTIONS ? "/FMHYedit" : "/"; +const baseUrl = process.env.GITHUB_ACTIONS ? '/FMHYedit' : '/' export default defineConfig({ - title: "FMHY", + title: 'FMHY', description: meta.description, - titleTemplate: ":title • freemediaheckyeah", - lang: "en-US", + titleTemplate: ':title • freemediaheckyeah', + lang: 'en-US', lastUpdated: false, cleanUrls: true, - appearance: "dark", + appearance: 'dark', base: baseUrl, - srcExclude: ["readme.md", "single-page"], + srcExclude: ['readme.md', 'single-page'], ignoreDeadLinks: true, sitemap: { - hostname: meta.hostname, + hostname: meta.hostname }, head: [ - ["meta", { name: "theme-color", content: "#7bc5e4" }], - ["meta", { name: "og:type", content: "website" }], - ["meta", { name: "og:locale", content: "en" }], - ["link", { rel: "icon", href: "/test.png" }], + ['meta', { name: 'theme-color', content: '#7bc5e4' }], + ['meta', { name: 'og:type', content: 'website' }], + ['meta', { name: 'og:locale', content: 'en' }], + ['link', { rel: 'icon', href: '/test.png' }], // PWA - ["link", { rel: "icon", href: "/test.png", type: "image/svg+xml" }], - ["link", { rel: "alternate icon", href: "/test.png" }], - ["link", { rel: "mask-icon", href: "/test.png", color: "#7bc5e4" }], + ['link', { rel: 'icon', href: '/test.png', type: 'image/svg+xml' }], + ['link', { rel: 'alternate icon', href: '/test.png' }], + ['link', { rel: 'mask-icon', href: '/test.png', color: '#7bc5e4' }], // prettier-ignore ["meta", { name: "keywords", content: meta.keywords.join(" ") }], - ["link", { rel: "apple-touch-icon", href: "/test.png", sizes: "192x192" }], + ['link', { rel: 'apple-touch-icon', href: '/test.png', sizes: '192x192' }] ], transformHead: async (context) => generateMeta(context, meta.hostname), buildEnd: async (context) => { generateImages(context) .then(() => generateFeed(context)) - .finally(() => consola.success("Success!")); + .finally(() => consola.success('Success!')) }, vite: { - optimizeDeps: { exclude: ["workbox-window"] }, + optimizeDeps: { exclude: ['workbox-window'] }, plugins: [ UnoCSS({ - configFile: "../unocss.config.ts", + configFile: '../unocss.config.ts' }), { - name: "custom:adjust-order", + name: 'custom:adjust-order', configResolved(c) { - movePlugin(c.plugins as any, "vitepress", "before", "unocss:transformers:pre"); - }, - }, + movePlugin( + c.plugins as any, + 'vitepress', + 'before', + 'unocss:transformers:pre' + ) + } + } ], build: { // Shut the fuck up - chunkSizeWarningLimit: Number.POSITIVE_INFINITY, - }, + chunkSizeWarningLimit: Number.POSITIVE_INFINITY + } }, markdown: { emoji: { defs }, config(md) { - md.use(emojiRender); - md.use(toggleStarredPlugin); - md.use(base64DecodePlugin); - }, + md.use(emojiRender) + md.use(toggleStarredPlugin) + md.use(base64DecodePlugin) + } }, themeConfig: { search, footer: { - message: `${feedback} (rev: ${commitRef})`, + message: `${feedback} (rev: ${commitRef})` }, - outline: "deep", - logo: "/fmhy.ico", + outline: 'deep', + logo: '/fmhy.ico', nav: [ - { text: "Beginners Guide", link: "/beginners-guide" }, - { text: "Glossary", link: "https://rentry.org/The-Piracy-Glossary" }, - { text: "Guides", link: "https://rentry.co/fmhy-guides" }, - { text: "Backups", link: "https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/backups" }, + { text: 'Beginners Guide', link: '/beginners-guide' }, + { text: 'Glossary', link: 'https://rentry.org/The-Piracy-Glossary' }, + { text: 'Guides', link: 'https://rentry.co/fmhy-guides' }, { - text: "About", - items: [ - { text: "Posts", link: "/posts" }, - { text: "Feedback", link: "/feedback" }, - ], + text: 'Backups', + link: 'https://www.reddit.com/r/FREEMEDIAHECKYEAH/wiki/backups' }, + { + text: 'About', + items: [ + { text: 'Posts', link: '/posts' }, + { text: 'Feedback', link: '/feedback' } + ] + } ], sidebar, - socialLinks, - }, -}); + socialLinks + } +}) diff --git a/.vitepress/constants.ts b/.vitepress/constants.ts index 6f25c14fb..7f67f2145 100644 --- a/.vitepress/constants.ts +++ b/.vitepress/constants.ts @@ -1,92 +1,101 @@ -import type { DefaultTheme } from "vitepress"; +import type { DefaultTheme } from 'vitepress' export const meta = { - name: "FreeMediaHeckYeah", - description: "The largest collection of free stuff on the internet!", - hostname: "https://fmhy.net", - keywords: ["stream", "movies", "gaming", "reading", "anime"], -}; + name: 'FreeMediaHeckYeah', + description: 'The largest collection of free stuff on the internet!', + hostname: 'https://fmhy.net', + keywords: ['stream', 'movies', 'gaming', 'reading', 'anime'] +} export const commitRef = process.env.CF_PAGES ? `${process.env.CF_PAGES_COMMIT_SHA.slice(0, 8)}` - : "dev"; + : 'dev' -export const feedback = `Made with ❤️`; +export const feedback = `Made with ❤️` -export const search: DefaultTheme.Config["search"] = { +export const search: DefaultTheme.Config['search'] = { options: { miniSearch: { searchOptions: { - combineWith: "AND", + combineWith: 'AND', fuzzy: false, // @ts-ignore - boostDocument: (_, term, storedFields: Record) => { + boostDocument: ( + _, + term, + storedFields: Record + ) => { const titles = (storedFields?.titles as string[]) .filter((t) => Boolean(t)) - .map((t) => t.toLowerCase()); + .map((t) => t.toLowerCase()) // Uprate if term appears in titles. Add bonus for higher levels (i.e. lower index) const titleIndex = - titles.map((t, i) => (t?.includes(term) ? i : -1)).find((i) => i >= 0) ?? -1; - if (titleIndex >= 0) return 10000 - titleIndex; + titles + .map((t, i) => (t?.includes(term) ? i : -1)) + .find((i) => i >= 0) ?? -1 + if (titleIndex >= 0) return 10000 - titleIndex - return 1; - }, - }, + return 1 + } + } }, - detailedView: true, + detailedView: true }, - provider: "local", -}; + provider: 'local' +} export const socialLinks: DefaultTheme.SocialLink[] = [ - { icon: "github", link: "https://github.com/fmhy/FMHYEdit" }, - { icon: "discord", link: "https://discord.gg/Stz6y6NgNg" }, + { icon: 'github', link: 'https://github.com/fmhy/FMHYEdit' }, + { icon: 'discord', link: 'https://discord.gg/Stz6y6NgNg' }, { - icon: "reddit", - link: "https://reddit.com/r/FREEMEDIAHECKYEAH", - }, -]; + icon: 'reddit', + link: 'https://reddit.com/r/FREEMEDIAHECKYEAH' + } +] export const sidebar: DefaultTheme.Sidebar = [ - { text: "📛 Adblocking / Privacy", link: "/adblockvpnguide" }, - { text: "🤖 Artificial Intelligence", link: "/ai" }, - { text: "📺 Movies / TV / Anime", link: "/videopiracyguide" }, - { text: "🎵 Music / Podcasts / Radio", link: "/audiopiracyguide" }, - { text: "🎮 Gaming / Emulation", link: "/gamingpiracyguide" }, - { text: "📗 Books / Comics / Manga", link: "/readingpiracyguide" }, - { text: "💾 Downloading", link: "/downloadpiracyguide" }, - { text: "🌀 Torrenting", link: "/torrentpiracyguide" }, - { text: "🧠 Educational", link: "/edupiracyguide" }, - { text: "📱 Android / iOS", link: "/android-iosguide" }, - { text: "🐧 Linux / MacOS", link: "/linuxguide" }, - { text: "🌍 Non-English", link: "/non-english" }, - { text: "📂 Miscellaneous", link: "/miscguide" }, + { text: '📛 Adblocking / Privacy', link: '/adblockvpnguide' }, + { text: '🤖 Artificial Intelligence', link: '/ai' }, + { text: '📺 Movies / TV / Anime', link: '/videopiracyguide' }, + { text: '🎵 Music / Podcasts / Radio', link: '/audiopiracyguide' }, + { text: '🎮 Gaming / Emulation', link: '/gamingpiracyguide' }, + { text: '📗 Books / Comics / Manga', link: '/readingpiracyguide' }, + { text: '💾 Downloading', link: '/downloadpiracyguide' }, + { text: '🌀 Torrenting', link: '/torrentpiracyguide' }, + { text: '🧠 Educational', link: '/edupiracyguide' }, + { text: '📱 Android / iOS', link: '/android-iosguide' }, + { text: '🐧 Linux / MacOS', link: '/linuxguide' }, + { text: '🌍 Non-English', link: '/non-english' }, + { text: '📂 Miscellaneous', link: '/miscguide' }, { - text: "🔧 Tools", + text: '🔧 Tools', collapsed: false, items: [ - { text: "💻 System Tools", link: "/system-tools" }, - { text: "🗃️ File Tools", link: "/file-tools" }, - { text: "🔗 Internet Tools", link: "/internet-tools" }, - { text: "💬 Social Media Tools", link: "/social-media-tools" }, - { text: "📝 Text Tools", link: "/text-tools" }, - { text: "👾 Gaming Tools", link: "/gamingpiracyguide#gaming-tools" }, - { text: "📷 Image Tools", link: "/img-tools" }, - { text: "📼 Video Tools", link: "/video-tools" }, - { text: "🔊 Audio Tools", link: "/audiopiracyguide#audio-tools" }, - { text: "🍎 Educational Tools", link: "/edupiracyguide#educational-tools" }, - { text: "👨‍💻 Developer Tools", link: "/devtools" }, - ], + { text: '💻 System Tools', link: '/system-tools' }, + { text: '🗃️ File Tools', link: '/file-tools' }, + { text: '🔗 Internet Tools', link: '/internet-tools' }, + { text: '💬 Social Media Tools', link: '/social-media-tools' }, + { text: '📝 Text Tools', link: '/text-tools' }, + { text: '👾 Gaming Tools', link: '/gamingpiracyguide#gaming-tools' }, + { text: '📷 Image Tools', link: '/img-tools' }, + { text: '📼 Video Tools', link: '/video-tools' }, + { text: '🔊 Audio Tools', link: '/audiopiracyguide#audio-tools' }, + { + text: '🍎 Educational Tools', + link: '/edupiracyguide#educational-tools' + }, + { text: '👨‍💻 Developer Tools', link: '/devtools' } + ] }, { - text: "➕️ More", + text: '➕️ More', collapsed: true, items: [ - { text: "🔞 NSFW", link: "/nsfwpiracy" }, - { text: "⚠️ Unsafe Sites", link: "/unsafesites" }, - { text: "📦 Storage", link: "/storage" }, - ], - }, -]; + { text: '🔞 NSFW', link: '/nsfwpiracy' }, + { text: '⚠️ Unsafe Sites', link: '/unsafesites' }, + { text: '📦 Storage', link: '/storage' } + ] + } +] diff --git a/.vitepress/hooks/Template.vue b/.vitepress/hooks/Template.vue index ec2d921fe..f6c370a2d 100644 --- a/.vitepress/hooks/Template.vue +++ b/.vitepress/hooks/Template.vue @@ -1,15 +1,20 @@