Skip to content

๐Ÿชต 1. TypeDoc ๋ฐฐํฌํ•˜๊ธฐ

choiseona edited this page Dec 5, 2024 · 1 revision

TypeDoc

1. typedoc, typedoc-plugin-extras ์„ค์น˜

  • typedoc๋งŒ ์„ค์น˜ํ•ด์ค˜๋„ ๋ฌธ์ œ ์—†์ง€๋งŒ ํŒŒ๋น„์ฝ˜ ๊ฐ™์€ ๊ธฐํƒ€ ์†์„ฑ๋“ค์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด ์ถ”๊ฐ€ ํ”Œ๋Ÿฌ๊ทธ์ธ๋„ ์„ค์น˜ํ•ด์คฌ์Šต๋‹ˆ๋‹ค.
pnpm add -D typedoc typedoc-plugin-extras

2. typedoc.json ์ž‘์„ฑ

  • name: ๋ฐฐํฌ ๋งํฌ ์ œ๋ชฉ
  • out: TypeDoc ๋‚ด์šฉ์ด ๋‹ด๊ฒจ์žˆ๋Š” html, css ๋ฌธ์„œ๊ฐ€ ์ €์žฅ๋  ๋””๋ ‰ํ† ๋ฆฌ ๊ฒฝ๋กœ
  • readme: ๋ฌธ์„œ์˜ ๋ฉ”์ธ ํŽ˜์ด์ง€๋กœ ์‚ฌ์šฉํ•  README ํŒŒ์ผ ๊ฒฝ๋กœ
  • favicon: favicon ์„ค์ • (typedoc-plugin-extras ํ˜น์€ ๊ธฐํƒ€ ํ”Œ๋Ÿฌ๊ทธ์ธ ์„ค์น˜ ํ•„์ˆ˜)
  • plugin: ์‚ฌ์šฉํ•  TypeDoc ํ”Œ๋Ÿฌ๊ทธ์ธ ๋ชฉ๋ก
  • entryPoints: ๋ฌธ์„œํ™”ํ•  TypeScript ํŒŒ์ผ๋“ค์˜ ์ง„์ž…์  ๊ฒฝ๋กœ
  • exclude: ๋ฌธ์„œํ™”์—์„œ ์ œ์™ธํ•  ํŒŒ์ผ/๋””๋ ‰ํ† ๋ฆฌ ํŒจํ„ด
{
  "name": "Webebeb Team's FE Tools Docs",
  "out": "./docs",
  "readme": "../README.md",
  "favicon": "./public/favicon.ico",
  "plugin": ["typedoc-plugin-extras"],
  "entryPoints": ["src/utils/index.ts", "src/hooks/index.ts"],
  "exclude": ["**/node_modules/**", "**/dist/**"]
}

3. TypeDoc ๋ฌธ์„œ ์ž๋™ ๋ฐฐํฌ GitHub Actions ์›Œํฌํ”Œ๋กœ์šฐ

  • main ๋˜๋Š” develop ๋ธŒ๋žœ์น˜์— push๋  ๋•Œ ์‹คํ–‰
  • pnpm๊ณผ Node.js(v18) ํ™˜๊ฒฝ ์„ค์ • & ์˜์กด์„ฑ ์„ค์น˜
  • TypeDoc์œผ๋กœ ๋ฌธ์„œ ๋นŒ๋“œ
  • GitHub Pages๋กœ ๋ฌธ์„œ ๋ฐฐํฌ (./client/docs โ†’ gh-pages ๋ธŒ๋žœ์น˜)
name: Deploy Documentation

on:
  push:
    branches: ['main', 'develop']
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-latest

    defaults:
      run:
        working-directory: ./client

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup pnpm
        uses: pnpm/action-setup@v2
        with:
          version: 8
          run_install: false

      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: 18
          cache: 'pnpm'
          cache-dependency-path: './client/pnpm-lock.yaml'

      - name: Install dependencies
        working-directory: ./client
        run: pnpm install

      - name: Build documentation
        run: pnpm typedoc

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./client/docs
          force_orphan: true
          commit_message: 'docs: deploy documentation'

4. ์‹ค์ œ ๋ฌธ์„œ ํ…Œ์ŠคํŠธ

  • Github pages๋กœ ๋ฌธ์„œ ๋ฐฐํฌ๋ฅผ ์›ํ•œ๋‹ค๋ฉด ๊ผญ๊ผญ ์•ž์— workflow ์„ธํŒ…๊นŒ์ง€ ์„ ํ–‰๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
  • TypeDoc์ด JSDoc ์ฃผ์„์„ ํŒŒ์‹ฑํ•˜์—ฌ ๋ฌธ์„œํ™” ํ•ด์ค๋‹ˆ๋‹ค.
  • ๋˜ํ•œ vscode์—์„œ ์ž‘์—…ํ•  ๋•Œ๋„ ํ•ด๋‹น ํ•จ์ˆ˜์— ๋งˆ์šฐ์Šค ํ˜ธ๋ฒ„ ์‹œ example ๋“ฑ์„ ๋ฏธ๋ฆฌ ๋ณผ ์ˆ˜ ์žˆ์–ด ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค.
import { clsx, type ClassValue } from 'clsx';
import { twMerge } from 'tailwind-merge';

/**
 * Tailwind CSS ํด๋ž˜์Šค๋“ค์„ ๋ณ‘ํ•ฉํ•˜๋Š” ์œ ํ‹ธ๋ฆฌํ‹ฐ ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.
 *
 * - clsx๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์กฐ๊ฑด๋ถ€ ํด๋ž˜์Šค๋ฅผ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
 * - tailwind-merge๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Tailwind ํด๋ž˜์Šค ์ถฉ๋Œ์„ ํ•ด๊ฒฐํ•ฉ๋‹ˆ๋‹ค.
 *
 * @param inputs - ๋ณ‘ํ•ฉํ•  ํด๋ž˜์Šค๋“ค์˜ ๋ฐฐ์—ด. ClassValue ํƒ€์ž…์€ ๋ฌธ์ž์—ด, ๊ฐ์ฒด, ๋ฐฐ์—ด ๋“ฑ์„ ํฌํ•จํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
 * @returns ๋ณ‘ํ•ฉ๋œ ํด๋ž˜์Šค ๋ฌธ์ž์—ด
 *
 * @example
 * ```tsx
 * // ๋ฒ„ํŠผ ์ปดํฌ๋„ŒํŠธ์—์„œ์˜ ์‚ฌ์šฉ ์˜ˆ์‹œ
 * const buttonVariants = cva(
 *   'inline-flex items-center justify-center',
 *   {
 *     variants: {
 *       variant: {
 *         primary: 'bg-violet-500 hover:bg-violet-600',
 *         // ...
 *       },
 *       size: {
 *         sm: 'h-11 text-2xl',
 *         // ...
 *       }
 *     },
 *     defaultVariants: {
 *       variant: 'primary',
 *       size: 'sm'
 *     }
 *   }
 * );
 *
 * const Button = ({ className, variant, size, ...props }) => {
 *   return (
 *     <button
 *       className={cn(
 *         buttonVariants({ variant, size, className }),
 *       )}
 *       {...props}
 *     />
 *   );
 * };
 * ```
 *
 * @see {@link https://github.com/lukeed/clsx clsx}
 * @see {@link https://github.com/dcastil/tailwind-merge tailwind-merge}
 * @see {@link https://github.com/shadcn/ui shadcn/ui}
 * @category Utils
 */
export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs));
}

๋ฐฐํฌ ์™„๋ฃŒ๋œ ๋งํฌ

cn.ts ๋ฐฐํฌ ๋งํฌ

๐Ÿ˜Ž ์›จ๋ฒ ๋ฒ ๋ฒ ๋ฒฑ

๐Ÿ‘ฎ๐Ÿป ํŒ€ ๊ทœ์น™

๐Ÿ’ป ํ”„๋กœ์ ํŠธ

๐Ÿชต ์›จ๋ฒ ๋ฒฑ ๊ธฐ์ˆ ๋กœ๊ทธ

๐Ÿช„ ๋ฐ๋ชจ ๊ณต์œ 

๐Ÿ”„ ์Šคํ”„๋ฆฐํŠธ ๊ธฐ๋ก

๐Ÿ“— ํšŒ์˜๋ก

Clone this wiki locally