├── src ├── app │ ├── app.d.ts │ ├── (app) │ │ ├── posts │ │ │ ├── [id] │ │ │ │ ├── RecommendPost.tsx │ │ │ │ └── loading.tsx │ │ │ ├── TagItem.tsx │ │ │ ├── CoverSwitch.tsx │ │ │ ├── page.tsx │ │ │ └── Toc.tsx │ │ ├── (home) │ │ │ ├── layout.tsx │ │ │ └── page.tsx │ │ ├── icon │ │ │ └── page.tsx │ │ ├── layout.tsx │ │ ├── about │ │ │ └── page.tsx │ │ └── projects │ │ │ ├── page.tsx │ │ │ └── Projects.tsx │ ├── icon.jpg │ ├── favicon.ico │ ├── apple-icon.jpg │ ├── opengraph-image.webp │ ├── test │ │ └── page.tsx │ ├── robots.ts │ ├── sitemap.ts │ ├── not-found.tsx │ ├── globals.css │ └── layout.tsx ├── types │ ├── index.ts │ ├── type.d.ts │ └── siteConfig.ts ├── assets │ ├── Portrait.jpg │ ├── media │ │ ├── qq.webp │ │ ├── wx.webp │ │ ├── douyin.webp │ │ └── wxPublic.webp │ ├── PortraitAlt.webp │ ├── favicon │ │ └── github.png │ ├── products │ │ ├── resume.png │ │ └── codecopy.png │ ├── icons │ │ ├── XIcon.tsx │ │ ├── MinusCircleIcon.tsx │ │ ├── JueJinIcon.tsx │ │ ├── TiktokIcon.tsx │ │ ├── MoonIcon.tsx │ │ ├── SubscriberIcon.tsx │ │ ├── SunIcon.tsx │ │ ├── UTurnLeftIcon.tsx │ │ ├── CheckDoubleTickIcon.tsx │ │ ├── CloudIcon.tsx │ │ ├── FilterHorizontalIcon.tsx │ │ ├── SnailIcon.tsx │ │ ├── EyeOpenIcon.tsx │ │ ├── UsersIcon.tsx │ │ ├── TiltedSendIcon.tsx │ │ ├── UserArrowLeftIcon.tsx │ │ ├── UFOIcon.tsx │ │ ├── ScriptIcon.tsx │ │ ├── EyeCloseIcon.tsx │ │ ├── TwitterIcon.tsx │ │ ├── WxIcon.tsx │ │ ├── UserSecurityIcon.tsx │ │ ├── XSquareIcon.tsx │ │ ├── CursorIcon.tsx │ │ ├── SparkleIcon.tsx │ │ ├── ExternalLinkIcon.tsx │ │ ├── HourglassIcon.tsx │ │ ├── NewCommentIcon.tsx │ │ ├── PencilSwooshIcon.tsx │ │ ├── GitHubIcon.tsx │ │ ├── ZhihuIcon.tsx │ │ ├── CalendarIcon.tsx │ │ ├── HomeIcon.tsx │ │ ├── CursorClickIcon.tsx │ │ ├── MailIcon.tsx │ │ ├── YouTubeIcon.tsx │ │ ├── TelegramIcon.tsx │ │ ├── AtomIcon.tsx │ │ ├── GoogleBrandIcon.tsx │ │ ├── BriefcaseIcon.tsx │ │ ├── LightningIcon.tsx │ │ ├── TagIcon.tsx │ │ ├── GitHubBrandIcon.tsx │ │ ├── BilibiliIcon.tsx │ │ ├── ClipboardDataIcon.tsx │ │ ├── ClipboardCheckIcon.tsx │ │ ├── Layers3Icon.tsx │ │ ├── WxMediaIcon.tsx │ │ ├── QQIcon.tsx │ │ └── DashboardIcon.tsx │ └── index.ts ├── components │ ├── MDXComponents.tsx │ ├── ui │ │ ├── aspect-ratio.tsx │ │ ├── toaster.tsx │ │ ├── separator.tsx │ │ ├── sonner.tsx │ │ ├── popover.tsx │ │ ├── switch.tsx │ │ ├── tooltip.tsx │ │ ├── hover-card.tsx │ │ └── button.tsx │ ├── ClientOnly.tsx │ ├── DynamicIconRender.tsx │ ├── theme-providers.tsx │ ├── BaiDuAnalytics.tsx │ ├── GoogleAnalytics.tsx │ ├── ZoomAbleImage.tsx │ ├── Tag.tsx │ ├── GlobalBg.tsx │ ├── Container.tsx │ ├── Avatar.tsx │ ├── links │ │ └── RichLink.tsx │ ├── Footer.tsx │ └── ThemeToggle.tsx ├── lib │ ├── utils.ts │ ├── font.ts │ ├── math.ts │ ├── images.ts │ └── index.ts ├── style │ └── tocbot.css └── hooks │ └── useThemeToggleAnimation.ts ├── .prettierignore ├── public ├── baidu_verify_codeva-7AmpPWgzQY.html ├── logo.png ├── og.png ├── logo.webp ├── police.png ├── easykol.png ├── npmIcon.webp ├── svgShow.png ├── neovateCode.png ├── about-me-bg.webp └── site.webmanifest ├── .commitlintrc.json ├── .husky ├── pre-commit └── commit-msg ├── scripts ├── sync-post.js ├── github │ ├── job.js │ └── syncPost.js └── generate-rss.js ├── lint-staged.config.ts ├── postcss.config.mjs ├── .vscode ├── extensions.json └── settings.json ├── .prettierrc.json ├── data └── blog │ ├── post-26.mdx │ ├── post-29.mdx │ ├── post-47.mdx │ ├── post-42.mdx │ ├── post-5.mdx │ ├── post-4.mdx │ ├── post-40.mdx │ ├── post-9.mdx │ ├── post-59.mdx │ ├── post-13.mdx │ ├── post-67.mdx │ ├── post-73.mdx │ ├── post-28.mdx │ ├── post-58.mdx │ ├── post-65.mdx │ ├── post-69.mdx │ ├── post-75.mdx │ ├── post-80.mdx │ ├── post-64.mdx │ ├── post-79.mdx │ ├── post-86.mdx │ ├── post-93.mdx │ ├── post-49.mdx │ ├── post-10.mdx │ ├── post-68.mdx │ ├── post-6.mdx │ ├── post-39.mdx │ ├── post-24.mdx │ ├── post-18.mdx │ ├── post-72.mdx │ └── post-46.mdx ├── components.json ├── .gitignore ├── next.config.mjs ├── .eslintrc.json ├── tsconfig.json ├── LICENSE ├── posts ├── use-iconfont-in-wechat-miniprogram.mdx ├── fan-hua.mdx ├── mid-year-2024.mdx ├── mid-year-summary-2023.mdx ├── react-drag-drop-demo.mdx └── about.mdx ├── contentlayer.config.ts ├── README.md ├── .github └── workflows │ └── sync-post.yml ├── README-zh_CN.md └── env.mjs /src/app/app.d.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/types/index.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/(app)/posts/[id]/RecommendPost.tsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | /.next/ 2 | /node_modules 3 | .env*.local 4 | -------------------------------------------------------------------------------- /public/baidu_verify_codeva-7AmpPWgzQY.html: -------------------------------------------------------------------------------- 1 | 16b8ecfce956845b1084a0e91f0727ef -------------------------------------------------------------------------------- /.commitlintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["@commitlint/config-conventional"] 3 | } 4 | -------------------------------------------------------------------------------- /public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/public/logo.png -------------------------------------------------------------------------------- /public/og.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/public/og.png -------------------------------------------------------------------------------- /public/logo.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/public/logo.webp -------------------------------------------------------------------------------- /public/police.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/public/police.png -------------------------------------------------------------------------------- /src/app/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/src/app/icon.jpg -------------------------------------------------------------------------------- /public/easykol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/public/easykol.png -------------------------------------------------------------------------------- /public/npmIcon.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/public/npmIcon.webp -------------------------------------------------------------------------------- /public/svgShow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/public/svgShow.png -------------------------------------------------------------------------------- /src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/src/app/favicon.ico -------------------------------------------------------------------------------- /public/neovateCode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/public/neovateCode.png -------------------------------------------------------------------------------- /src/app/apple-icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/src/app/apple-icon.jpg -------------------------------------------------------------------------------- /public/about-me-bg.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/public/about-me-bg.webp -------------------------------------------------------------------------------- /src/assets/Portrait.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/src/assets/Portrait.jpg -------------------------------------------------------------------------------- /src/assets/media/qq.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/src/assets/media/qq.webp -------------------------------------------------------------------------------- /src/assets/media/wx.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/src/assets/media/wx.webp -------------------------------------------------------------------------------- /src/assets/PortraitAlt.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/src/assets/PortraitAlt.webp -------------------------------------------------------------------------------- /src/app/opengraph-image.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/src/app/opengraph-image.webp -------------------------------------------------------------------------------- /src/assets/favicon/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/src/assets/favicon/github.png -------------------------------------------------------------------------------- /src/assets/media/douyin.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/src/assets/media/douyin.webp -------------------------------------------------------------------------------- /src/assets/media/wxPublic.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/src/assets/media/wxPublic.webp -------------------------------------------------------------------------------- /src/assets/products/resume.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/src/assets/products/resume.png -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx --no-install lint-staged 5 | -------------------------------------------------------------------------------- /src/assets/products/codecopy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderPerseus/blog/HEAD/src/assets/products/codecopy.png -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx --no-install commitlint --edit "$1" 5 | -------------------------------------------------------------------------------- /scripts/sync-post.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line @typescript-eslint/no-var-requires 2 | const syncPost = require('./github/syncPost'); 3 | 4 | syncPost(); 5 | -------------------------------------------------------------------------------- /lint-staged.config.ts: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'src/**/*.(ts|tsx|js|jsx)': ['eslint --fix'], 3 | 'src/**/*.(ts|tsx|js|jsx|css|scss|md|json)': ['prettier --write'] 4 | }; 5 | -------------------------------------------------------------------------------- /src/app/(app)/(home)/layout.tsx: -------------------------------------------------------------------------------- 1 | export default function RootLayout({ 2 | children 3 | }: Readonly<{ 4 | children: React.ReactNode; 5 | }>) { 6 | return <>{children}; 7 | } 8 | -------------------------------------------------------------------------------- /postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /src/app/test/page.tsx: -------------------------------------------------------------------------------- 1 | import { type FC, memo } from 'react'; 2 | 3 | const TestPage: FC = () => { 4 | return
TestPage
; 5 | }; 6 | 7 | export default memo(TestPage); 8 | -------------------------------------------------------------------------------- /src/components/MDXComponents.tsx: -------------------------------------------------------------------------------- 1 | import ZoomAbleImage from './ZoomAbleImage'; 2 | 3 | const MDXComponents = { 4 | img: ZoomAbleImage 5 | // 其他自定义组件... 6 | }; 7 | 8 | export default MDXComponents; 9 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "esbenp.prettier-vscode", 4 | "dbaeumer.vscode-eslint", 5 | "stylelint.vscode-stylelint", 6 | "wangzy.sneak-mark" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { type ClassValue, clsx } from 'clsx'; 2 | import { twMerge } from 'tailwind-merge'; 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)); 6 | } 7 | -------------------------------------------------------------------------------- /src/components/ui/aspect-ratio.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio'; 4 | 5 | const AspectRatio = AspectRatioPrimitive.Root; 6 | 7 | export { AspectRatio }; 8 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "tabWidth": 2, 4 | "useTabs": true, 5 | "singleQuote": true, 6 | "semi": true, 7 | "trailingComma": "none", 8 | "bracketSpacing": true, 9 | "endOfLine": "auto" 10 | } 11 | -------------------------------------------------------------------------------- /src/app/(app)/posts/TagItem.tsx: -------------------------------------------------------------------------------- 1 | export function Tag({ children }: { children: React.ReactNode }) { 2 | return ( 3 | 4 | {children} 5 | 6 | ); 7 | } 8 | -------------------------------------------------------------------------------- /src/lib/font.ts: -------------------------------------------------------------------------------- 1 | import { Manrope } from 'next/font/google'; 2 | 3 | const sansFont = Manrope({ 4 | subsets: ['latin'], 5 | weight: ['400', '500', '600', '700', '800'], 6 | variable: '--font-sans', 7 | display: 'swap' 8 | }); 9 | 10 | export { sansFont }; 11 | -------------------------------------------------------------------------------- /src/types/type.d.ts: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 2 | type AnyIfEmpty = any; 3 | 4 | interface ProjectItem { 5 | id?: string; 6 | name?: string; 7 | url?: string; 8 | description?: string; 9 | icon?: StaticImageData; 10 | tags?: string[]; 11 | } 12 | -------------------------------------------------------------------------------- /src/app/(app)/(home)/page.tsx: -------------------------------------------------------------------------------- 1 | import { Container } from '@/components/Container'; 2 | import { Headline } from '@/components/IndexHeader'; 3 | 4 | export default function Home() { 5 | return ( 6 | 7 | 8 | 9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /data/blog/post-26.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: SEO 资料 3 | date: 2024-11-10T15:49:30Z 4 | slug: post-26 5 | author: chaseFunny:https://github.com/chaseFunny 6 | tags: [] 7 | --- 8 | 9 | 1. https://www.indiehackers.com/post/seo-from-a-newbie-for-beginners-bcc8c5ca10 10 | 11 | --- 12 | 此文自动发布于:github issues 13 | -------------------------------------------------------------------------------- /src/components/ClientOnly.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import * as React from 'react'; 4 | 5 | export function ClientOnly({ children }: { children: React.ReactNode }) { 6 | const [isMounted, setIsMounted] = React.useState(false); 7 | 8 | React.useEffect(() => { 9 | setIsMounted(true); 10 | }, []); 11 | 12 | if (!isMounted) return <>; 13 | 14 | return children; 15 | } 16 | -------------------------------------------------------------------------------- /src/components/DynamicIconRender.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | import * as Icons from '@radix-ui/react-icons'; 3 | export default function DynamicIconRender({ 4 | iconKey, 5 | ...props 6 | }: Readonly<{ 7 | iconKey: string; 8 | style?: React.CSSProperties; 9 | className?: string; 10 | }>) { 11 | const IconComponent = Icons[iconKey as keyof typeof Icons]; 12 | return ; 13 | } 14 | -------------------------------------------------------------------------------- /src/lib/math.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 将给定的值限制在指定的最小值和最大值之间。 3 | * 4 | * @param value 需要被限制的数值。 5 | * @param a 最小值或第一个边界值。 6 | * @param b 最大值或第二个边界值。 7 | * @returns 返回被限制在最小值和最大值之间的值。 8 | */ 9 | export function clamp(value: number, a: number, b: number) { 10 | // 确定最小值和最大值 11 | const min = Math.min(a, b); 12 | const max = Math.max(a, b); 13 | 14 | // 将值限制在最小值和最大值之间 15 | return Math.min(Math.max(value, min), max); 16 | } 17 | -------------------------------------------------------------------------------- /components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "default", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "app/globals.css", 9 | "baseColor": "neutral", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils" 16 | } 17 | } -------------------------------------------------------------------------------- /data/blog/post-29.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: 随笔 - 长期更新 3 | date: 2024-11-30T12:50:54Z 4 | slug: post-29 5 | author: chaseFunny:https://github.com/chaseFunny 6 | tags: [] 7 | --- 8 | 9 | > 记录互联网看到印象深刻的句子 10 | 11 | 1. 利用信息差、提升认知水平、强化执行力、在竞争中做到极致。 -稻盛和夫 12 | 2. 不扫兴就是最大的高情商 - [冴羽](https://yayujs.com/) 13 | 3. 可乐第一口就已经值两块五了,所以喝不完也不算浪费 14 | 15 | --- 16 | 此文自动发布于:github issues 17 | -------------------------------------------------------------------------------- /public/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "name": "luckySnail", 3 | "short_name": "luckySnail", 4 | "description": "基于 github issues 的 个人 blog", 5 | "start_url": "/", 6 | "icons": [ 7 | { 8 | "src": "/logo.png", 9 | "sizes": "192x192", 10 | "type": "image/png" 11 | }, 12 | { 13 | "src": "/logo.png", 14 | "sizes": "512x512", 15 | "type": "image/png" 16 | } 17 | ], 18 | "theme_color": "#8b5cf6", 19 | "background_color": "#ffffff", 20 | "display": "standalone" 21 | } 22 | -------------------------------------------------------------------------------- /src/app/(app)/posts/[id]/loading.tsx: -------------------------------------------------------------------------------- 1 | import { UFOIcon } from '@/assets'; 2 | import { Container } from '@/components/Container'; 3 | 4 | export default function BlogPostPageSkeleton() { 5 | return ( 6 | 7 |
8 |
9 | 10 |
11 |
12 |
13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /data/blog/post-47.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: 编码经验贴 3 | date: 2025-03-11T08:33:21Z 4 | slug: post-47 5 | author: chaseFunny:https://github.com/chaseFunny 6 | tags: ["经验"] 7 | --- 8 | 9 | #### 一、快速找到全局安装的 npm 包地址 10 | 11 | ```bash 12 | npm root -g 13 | # cd 到输出的目录,然后进入 14 | open . 15 | ``` 16 | 17 | #### 二、找到指定端口的 PID ,然后 kill 18 | 19 | ```bash 20 | ss -tulpn | grep xxxx 21 | kill PID 22 | ``` 23 | 24 | --- 25 | 此文自动发布于:github issues 26 | -------------------------------------------------------------------------------- /src/assets/icons/XIcon.tsx: -------------------------------------------------------------------------------- 1 | import { type IconProps } from '@/assets'; 2 | 3 | export function XIcon(props: IconProps = {}) { 4 | return ( 5 | 13 | 20 | 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /data/blog/post-42.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: 职场感悟 (长期更新) 3 | date: 2025-01-11T09:46:22Z 4 | slug: post-42 5 | author: chaseFunny:https://github.com/chaseFunny 6 | tags: ["经验","职场"] 7 | --- 8 | 9 | > 以下是个人在职场的真实感悟 10 | 11 | - 做好文档沉淀:当遇到 bug,解决复杂问题,业务逻辑复杂等等,都可以记录下来 12 | - 减少信息差:如果一个事情可以让大家都知道,就不需要私聊,把信息同步给到大家,说不定就能让事情做得更好 13 | 14 | 15 | 16 | # 参考资料 17 | 18 | - 如何做好技术 PM: https://mp.weixin.qq.com/s/Mur302t7-8444vaxLLUKgA 19 | - 20 | 21 | --- 22 | 此文自动发布于:github issues 23 | -------------------------------------------------------------------------------- /src/components/theme-providers.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | import { ThemeProvider } from 'next-themes'; 3 | import { type ThemeProviderProps } from 'next-themes/dist/types'; 4 | import { memo, type FC } from 'react'; 5 | 6 | const ThemeProviders: FC = ({ children, ...props }) => { 7 | return ( 8 | // @ts-ignore 9 | 15 | {children} 16 | 17 | ); 18 | }; 19 | 20 | export default memo(ThemeProviders); 21 | -------------------------------------------------------------------------------- /data/blog/post-5.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: 记录我写的烂代码 3 | date: 2024-08-03T12:10:24Z 4 | slug: post-5 5 | author: chaseFunny:https://github.com/chaseFunny 6 | tags: ["编码规范"] 7 | --- 8 | 9 | # 背景 10 | 记录我写下的所有烂代码,警示自己好好写代码,要不然打的喷嚏都是在骂我写的 💩 山 11 | 12 | ## 魔法数 13 | > 魔法数”(magic number),也称魔法值、魔法字符串、魔术数字等,指的是在代码中直接出现的没有明确含义的数字常量或字符串,通常没有给出解释或者注释来说明其用途。 14 | > 这样的数字或字符串使得代码难以理解和维护,因为读者无法立即理解这些数字的含义和作用。 15 | 16 | ![image](https://github.com/user-attachments/assets/0cf6bbcb-27a7-471d-b204-0fee7f2e74a4) 17 | 18 | 19 | --- 20 | 此文自动发布于:github issues 21 | -------------------------------------------------------------------------------- /src/app/robots.ts: -------------------------------------------------------------------------------- 1 | import { MetadataRoute } from 'next'; 2 | 3 | export default function robots(): MetadataRoute.Robots { 4 | return { 5 | rules: [ 6 | { 7 | userAgent: 'Googlebot', 8 | allow: '/' 9 | }, 10 | { 11 | userAgent: 'Applebot', 12 | allow: '/' 13 | }, 14 | { 15 | userAgent: 'bingbot', 16 | allow: '/' 17 | }, 18 | { 19 | userAgent: 'Baiduspider', 20 | allow: '/' 21 | }, 22 | { 23 | userAgent: '*', 24 | allow: '/' 25 | } 26 | ], 27 | sitemap: 'https://www.luckysnail.cn/sitemap.xml', 28 | host: 'https://www.luckysnail.cn' 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | .idea/* 23 | 24 | # debug 25 | npm-debug.log* 26 | yarn-debug.log* 27 | yarn-error.log* 28 | 29 | # local env files 30 | .env*.local 31 | .env 32 | 33 | # vercel 34 | .vercel 35 | 36 | # typescript 37 | *.tsbuildinfo 38 | next-env.d.ts 39 | 40 | # contentlayer 41 | .contentlayer 42 | -------------------------------------------------------------------------------- /src/app/(app)/icon/page.tsx: -------------------------------------------------------------------------------- 1 | import * as iconList from '@/assets/index'; 2 | import { Container } from '@/components/Container'; 3 | 4 | export default function IconPage() { 5 | return ( 6 | 7 |
8 | {Object.keys(iconList).map((key) => { 9 | // @ts-ignore 10 | const Icon = iconList[key]; 11 | return ( 12 |
13 | 14 |
{key}
15 |
16 | ); 17 | })} 18 |
19 |
20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /src/assets/icons/MinusCircleIcon.tsx: -------------------------------------------------------------------------------- 1 | import { type IconProps } from '@/assets'; 2 | 3 | export function MinusCircleIcon(props: IconProps = {}) { 4 | return ( 5 | 13 | 20 | 21 | ); 22 | } 23 | -------------------------------------------------------------------------------- /src/assets/icons/JueJinIcon.tsx: -------------------------------------------------------------------------------- 1 | import { type IconProps } from '@/assets'; 2 | 3 | export function JueJinIcon(props: IconProps = {}) { 4 | return ( 5 | 13 | 17 | 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /src/assets/icons/TiktokIcon.tsx: -------------------------------------------------------------------------------- 1 | import { type IconProps } from '@/assets'; 2 | 3 | export function TiktokIcon(props: IconProps = {}) { 4 | return ( 5 | 13 | 17 | 18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /next.config.mjs: -------------------------------------------------------------------------------- 1 | import { withContentlayer } from 'next-contentlayer'; 2 | import generate from './scripts/generate-rss.js'; 3 | /** @type {import('next').NextConfig} */ 4 | const nextConfig = { 5 | // 静态导出 6 | output: 'export', 7 | reactStrictMode: true, 8 | swcMinify: true, 9 | images: { 10 | domains: ['blog-1304565468.cos.ap-shanghai.myqcloud.com', 'github.com'] 11 | }, 12 | webpack: (config, { isServer }) => { 13 | // if (isServer) { 14 | // require('./scripts/generate-sitemap'); // eslint-disable-line 15 | // require('./scripts/generate-rss'); // eslint-disable-line 16 | // } 17 | generate(); 18 | return config; 19 | } 20 | }; 21 | 22 | export default withContentlayer(nextConfig); 23 | -------------------------------------------------------------------------------- /src/components/BaiDuAnalytics.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | import Script from 'next/script'; 3 | const BaiDuAnalytics = () => { 4 | return ( 5 | <> 6 |