Skip to content

Latest commit

Β 

History

History
121 lines (86 loc) Β· 3.95 KB

File metadata and controls

121 lines (86 loc) Β· 3.95 KB

Loopz

This is Frontend Monorepo built with Turborepo with Tailwind CSS and Next.js.

πŸ›οΈ Project Structure

.
β”œβ”€β”€ apps
β”‚   β”œβ”€β”€ admin
β”‚   β”‚   β”œβ”€β”€ app
β”‚   β”‚   └── public
β”‚   └── client
β”‚       β”œβ”€β”€ app
β”‚       └── public
└── packages
    β”œβ”€β”€ eslint-config
    β”œβ”€β”€ tailwind-config
    β”œβ”€β”€ typescript-config
    └── ui
        └── src

πŸ“¦ Node.js ν™˜κ²½ μ„€μ • κ°€μ΄λ“œ

이 ν”„λ‘œμ νŠΈλŠ” Node.js v22.16.0(LTS) 을 μ‚¬μš©ν•©λ‹ˆλ‹€.
μ •ν™•ν•œ μ‹€ν–‰ ν™˜κ²½ μœ μ§€λ₯Ό μœ„ν•΄ μ•„λž˜ κ°€μ΄λ“œλ₯Ό μ°Έκ³ ν•˜μ—¬ 버전을 톡일해 μ£Όμ„Έμš”.

πŸ“Œ NVM μ‚¬μš© ꢌμž₯

# .nvmrc λ‚΄ λͺ…μ‹œλœ λ²„μ „μœΌλ‘œ Node.js μ„€μΉ˜
nvm install

# μ„€μΉ˜λœ 버전 μ‚¬μš©
nvm use

pnpm-workspace.yaml의 버전 κ°•μ œ μ„€μ • (μ˜μ‘΄μ„± κ΄€λ¦¬μš©)

이 ν”„λ‘œμ νŠΈλŠ” pnpm을 μ‚¬μš©ν•˜λ©°, λ‹€λ₯Έ Node.js λ²„μ „μ—μ„œ μ˜μ‘΄μ„± μ„€μΉ˜λ₯Ό λ°©μ§€ν•˜κΈ° μœ„ν•΄ λ‹€μŒ 섀정이 ν¬ν•¨λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€:

# pnpm-workspace.yaml
nodeVersion: 22.16.0

# Node.js 22.16.0이 μ•„λ‹Œ ν™˜κ²½μ—μ„œλŠ” pnpm install이 μ—λŸ¬λ₯Ό λ°œμƒμ‹œν‚΅λ‹ˆλ‹€
engineStrict: true

λ”°λΌμ„œ, μ˜μ‘΄μ„± μΆ”κ°€ λ˜λŠ” μ„€μΉ˜ μ „, λ°˜λ“œμ‹œ Node.js 버전을 ν™•μΈν•˜μ„Έμš”:

node -v     # v22.16.0 이어야 ν•©λ‹ˆλ‹€

πŸ“¦ ꢌμž₯ μ„€μΉ˜ μˆœμ„œ (Onboarding Guide)

# 1. ν”„λ‘œμ νŠΈ λ‚΄ Node.js 버전 μ„€μΉ˜
nvm install
nvm use

# 2. pnpm μ„€μΉ˜ (* μ„€μΉ˜κ°€ μ•ˆλ˜μ–΄ μžˆμ„ 경우)
corepack enable pnpm # 둜컬 κΈ€λ‘œλ²Œ ν™˜κ²½μ— pnpm μ„€μΉ˜
corepack install # ν”„λ‘œμ νŠΈ λ‚΄ λͺ…μ‹œλœ λ²„μ „μ˜ package manager μ„€μΉ˜

# 3. νŒ¨ν‚€μ§€ μ„€μΉ˜
pnpm install

What's inside?

This Turborepo includes the following packages/apps:

Apps and Packages

  • docs: a Next.js app with Tailwind CSS
  • web: another Next.js app with Tailwind CSS
  • ui: a stub React component library with Tailwind CSS shared by both web and docs applications
  • @repo/eslint-config: eslint configurations (includes eslint-config-next and eslint-config-prettier)
  • @repo/typescript-config: tsconfig.jsons used throughout the monorepo

Each package/app is 100% TypeScript.

Building packages/ui

This example is set up to produce compiled styles for ui components into the dist directory. The component .tsx files are consumed by the Next.js apps directly using transpilePackages in next.config.ts. This was chosen for several reasons:

  • Make sharing one tailwind.config.ts to apps and packages as easy as possible.
  • Make package compilation simple by only depending on the Next.js Compiler and tailwindcss.
  • Ensure Tailwind classes do not overwrite each other. The ui package uses a ui- prefix for it's classes.
  • Maintain clear package export boundaries.

Another option is to consume packages/ui directly from source without building. If using this option, you will need to update the tailwind.config.ts in your apps to be aware of your package locations, so it can find all usages of the tailwindcss class names for CSS compilation.

For example, in tailwind.config.ts:

  content: [
    // app content
    `src/**/*.{js,ts,jsx,tsx}`,
    // include packages if not transpiling
    "../../packages/ui/*.{js,ts,jsx,tsx}",
  ],

If you choose this strategy, you can remove the tailwindcss and autoprefixer dependencies from the ui package.

Utilities

This Turborepo has some additional tools already setup for you: