Skip to content

Conversation

@ohah
Copy link
Owner

@ohah ohah commented Oct 26, 2025

feat: FSD 아키텍처 구현 및 Tailwind CSS 4.x 업그레이드, 모나코 에디터로 변경

📋 요약

이 PR은 Feature-Sliced Design (FSD) 아키텍처를 구현하고 유지보수성과 성능 향상을 위해 Tailwind CSS 4.x로 업그레이드합니다.

🚀 주요 변경사항

FSD 아키텍처 구현

  • ✅ 각 FSD 레이어에 index.ts 파일 추가하여 적절한 export 구현
  • ✅ FSD 규칙에 따라 파일명을 kebab-case로 변경
  • ✅ 적절한 레이어 분리 및 의존성 규칙 구현
  • ✅ TypeScript와 Vite 경로 별칭 추가 (@/*./src/*)

Tailwind CSS 4.x 업그레이드

  • ✅ Tailwind CSS 3.x에서 4.x로 업그레이드
  • ✅ Vite와의 완전한 통합을 위해 @tailwindcss/vite 플러그인 추가
  • ✅ 호환성을 위해 CSS import 업데이트
  • h-screen 클래스 적용 문제 해결

파일 구조 변경

src/
├── app/
│   ├── index.tsx
│   ├── providers.tsx
│   └── index.ts          # export * from 패턴
├── pages/
│   └── editor/
│       ├── editor-page.tsx        # EditorPage.tsx에서 이름 변경
│       ├── editor-page.test.tsx   # EditorPage.test.tsx에서 이름 변경
│       └── index.ts
├── widgets/
│   ├── code-editor/
│   │   ├── code-editor.tsx
│   │   └── index.ts
│   └── output-panel/
│       ├── output-panel.tsx
│       └── index.ts
├── features/
│   └── execute-code/
│       ├── model.ts
│       └── index.ts
└── shared/
    ├── types/
    │   └── index.ts
    ├── ui/
    │   ├── Button.tsx
    │   ├── Panel.tsx
    │   └── index.ts
    └── index.ts

🔧 기술적 세부사항

경로 별칭

  • TypeScript: tsconfig.json에서 @/*./src/*
  • Vite: vite.config.ts에서 @./src

Import 변경사항

// 이전
import { CodeEditor } from '../../widgets/code-editor/code-editor';
import { useExecutionStore } from '../../features/execute-code/model';

// 이후
import { CodeEditor } from '@/widgets/code-editor';
import { useExecutionStore } from '@/features/execute-code';

FSD 레이어 규칙

  • app → pages, widgets, features, shared
  • pages → widgets, features, shared
  • widgets → features, shared
  • features → shared
  • shared → (내부 의존성 없음)

🎯 장점

  1. 더 나은 유지보수성: 명확한 레이어 분리 및 의존성 규칙
  2. 개발자 경험 향상: @ 별칭을 사용한 절대 경로 import
  3. 성능: Vite 플러그인 통합을 통한 Tailwind CSS 4.x
  4. 일관성: FSD 명명 규칙 및 파일 구조
  5. 확장성: 확립된 패턴을 따라 새로운 기능을 쉽게 추가

🧪 테스트

  • 모든 기존 테스트 통과
  • TypeScript 컴파일 성공
  • Vite 빌드 프로세스 정상 작동
  • Tailwind CSS 클래스 올바르게 적용

📝 주요 변경사항

  • 파일명이 kebab-case로 변경됨 (EditorPage.tsx → editor-page.tsx)
  • Import 경로가 @ 별칭을 사용하도록 업데이트
  • Tailwind CSS 4.x를 위해 CSS import 구조 업데이트

🔄 마이그레이션 가이드

로컬 변경사항이 있다면:

  1. Import 문을 @ 별칭을 사용하도록 업데이트
  2. 새로운 파일명 사용 (kebab-case)
  3. 직접 파일 경로 대신 레이어 index 파일에서 import

📚 참고 자료

🔗 관련 커밋

  1. feat: add FSD index.ts files for proper exports
  2. refactor: rename files to kebab-case following FSD conventions
  3. feat: add TypeScript path mapping for @ alias
  4. feat: add Vite path alias configuration
  5. refactor: update imports to use @ path alias
  6. style: update CSS imports for Tailwind CSS 4.x

ohah added 29 commits October 26, 2025 19:10
- Add Monaco Editor for code editing
- Add Legend State for reactive state management
- Add Radix UI + Tailwind CSS for modern UI components
- Add react-resizable-panels for layout management
- Add @radix-ui/react-icons for icon components

Dependencies added:
- @monaco-editor/react: Code editor component
- @legendapp/state: Reactive state management
- @legendapp/state/react: React integration for Legend State
- @radix-ui/themes: UI component library
- @radix-ui/react-icons: Icon components
- react-resizable-panels: Resizable layout panels
- tailwindcss: Utility-first CSS framework
- postcss: CSS post-processor
- autoprefixer: CSS vendor prefixer
Implement Feature-Sliced Design (FSD) architecture for better code organization:

📁 app/
- index.tsx: Main app component
- providers.tsx: Global providers (Legend State, Radix UI)

📁 pages/editor/
- EditorPage.tsx: Main editor page with split layout

📁 widgets/
- code-editor/CodeEditor.tsx: Monaco Editor wrapper with Cmd+Enter binding
- output-panel/OutputPanel.tsx: Console output display
- tab-bar/TabBar.tsx: Multi-tab management UI

📁 features/
- execute-code/model.ts: Code execution state and API
- manage-tabs/model.ts: Tab management with localStorage sync

📁 shared/
- types/index.ts: Common TypeScript interfaces
- lib/storage.ts: localStorage helper functions
- ui/Button.tsx: Reusable button component
- ui/Panel.tsx: Reusable panel component

This structure follows FSD principles:
- Clear layer separation (app → pages → widgets → features → shared)
- Dependency rules enforcement
- Better maintainability and scalability
- Remove legacy App.tsx, App.css, App.test.tsx
- Update main.tsx to import from app/index.tsx
- Complete migration to FSD architecture

Changes:
- Delete src/App.tsx (replaced by src/app/index.tsx)
- Delete src/App.css (replaced by Tailwind CSS)
- Delete src/App.test.tsx (replaced by FSD test files)
- Update src/main.tsx to use new app structure

This completes the transition from traditional React structure to FSD architecture.
- Upgrade to Tailwind CSS v4 (latest version)
- Configure PostCSS for CSS processing
- Implement modern UI styling with Radix UI integration
- Add custom component styles for editor layout

Changes:
- Update src/index.css with @import 'tailwindcss' (v4 syntax)
- Add postcss.config.js for CSS processing
- Remove tailwind.config.js (not needed in v4)
- Add custom styles for editor-container and panel-resize-handle
- Integrate with Radix UI color system

Features:
- Dark theme support
- Responsive design
- Custom component styling
- Smooth transitions and hover effects
- Add comprehensive FSD (Feature-Sliced Design) architecture guide
- Document Legend State usage patterns and examples
- Add Radix UI + Tailwind CSS integration guide
- Update development guide with new tech stack

New documentation sections:
📚 FSD Architecture
- Folder structure explanation
- Layer responsibilities and dependencies
- Best practices and patterns

📚 Legend State
- Basic usage examples
- Action patterns for state management
- Observable patterns

📚 UI Components
- Radix UI integration guide
- Tailwind CSS class usage
- Component composition patterns

This provides developers with comprehensive guidance for working with the new architecture.
- Add FSD (Feature-Sliced Design) architecture rules
- Update tech stack documentation
- Add Legend State and Radix UI guidelines
- Define layer dependencies and responsibilities

New rules added:
🏗️ FSD Architecture Rules
- Folder structure guidelines
- Dependency rules between layers
- Layer responsibilities

🎨 Updated Tech Stack
- Legend State for reactive state management
- Radix UI + Tailwind CSS for UI components
- Monaco Editor for code editing
- React 19 with modern patterns

This ensures consistent development practices and helps developers follow the established architecture patterns.
- Update lockfile to reflect all newly added dependencies
- Ensure consistent dependency resolution across environments
- Include Monaco Editor, Legend State, Radix UI, and other UI libraries

This ensures that all team members will have the exact same dependency versions when running pnpm install.
- Remove LegendStateProvider import and usage
- Legend State v2 doesn't require a provider wrapper
- Keep only Radix UI Theme provider for styling

According to Legend State documentation:
- No boilerplate required
- No contexts, actions, reducers, dispatchers needed
- Just use observable() and useObservable() directly
- Provider pattern is not needed in v2

This fixes the SyntaxError: Importing binding name 'LegendStateProvider' is not found.
- Fix useObservable to use function syntax with .get()
- Legend State v2 requires function wrapper for reactive updates
- This should resolve the blank screen issue

Changes:
- useObservable(tabsState.tabs) → useObservable(() => tabsState.tabs.get())
- useObservable(tabsState.activeTabId) → useObservable(() => tabsState.activeTabId.get())
- useObservable(executionState.result) → useObservable(() => executionState.result.get())
- useObservable(executionState.isExecuting) → useObservable(() => executionState.isExecuting.get())

This follows the correct Legend State v2 pattern for reactive updates in React components.
- Add initial tab creation in tabsState observable
- Fix getActiveTab function to use .get() properly
- Add debugging logs for tab management
- Prevent duplicate tab loading in loadFromStorage
- Use proper ObservableArray methods for tab operations

This resolves the issue where activeTab was null and Monaco Editor wasn't rendering.
- Use .get() method to extract values from Legend State observables
- Fix React key prop to use actual string values instead of Proxy objects
- Add proper variable extraction for tabs array and activeTabId
- Resolve 'unsupported type Proxy' error in React rendering

This fixes the TabBar component rendering issues and Legend State warnings.
- Use .get() method to extract values from Legend State observables
- Add proper variable extraction for result and isExecuting observables
- Fix all references to use extracted values instead of raw observables
- Resolve Legend State primitive usage warnings

This ensures proper rendering of execution results and loading states.
- Use .get() method to extract values from activeTab observable
- Fix activeTab.code and activeTab.id access patterns
- Add proper null checking for activeTab before accessing properties
- Improve conditional rendering logic for CodeEditor component
- Add loading state display when no active tab is available

This resolves the Monaco Editor rendering issues and Legend State warnings.
- Add try-catch block in handleEditorDidMount for better error handling
- Add null checks for monaco.KeyMod and monaco.KeyCode before using
- Add console.error logging for Monaco Editor mount errors
- Improve robustness of Monaco Editor initialization

This prevents Monaco Editor initialization errors from crashing the app.
- Add conditional devtools opening in debug mode
- Enable easier debugging during development
- Only activate in debug_assertions build

This helps with debugging the Tauri application during development.
- OutputPanel.tsx → output-panel.tsx
- CodeEditor.tsx → code-editor.tsx
- Button.tsx → button.tsx
- Panel.tsx → panel.tsx
- CodeEditor.test.tsx → code-editor.test.tsx

FSD 아키텍처의 kebab-case 파일명 규칙을 준수하도록 변경
- EditorPage.tsx에서 새로운 kebab-case 파일명으로 import 경로 수정
- CodeEditor.test.tsx에서 code-editor import 경로 수정
- 모든 컴포넌트가 올바른 경로로 참조되도록 수정
- Fix icon.ico format to resolve Windows Resource Compiler error
- Update pnpm-workspace.yaml configuration
- Upgrade from Tailwind CSS 3.x to 4.x
- Add @tailwindcss/vite plugin dependency
- Update pnpm-lock.yaml with new dependencies
- Import @tailwindcss/vite plugin
- Add tailwindcss() to Vite plugins array
- Enable seamless Tailwind CSS integration with Vite
- Ensure proper Tailwind CSS class usage in EditorPage
- Update code editor component styling
- Remove redundant h-screen classes for better layout
- Add index.ts files to each FSD layer
- Use export * from pattern for cleaner re-exports
- Enable proper module resolution and clean imports
- Rename EditorPage.tsx to editor-page.tsx
- Rename EditorPage.test.tsx to editor-page.test.tsx
- Follow FSD naming conventions for better consistency
- Add baseUrl and paths configuration
- Map @/* to ./src/* for cleaner imports
- Enable absolute import paths throughout the project
- Add resolve.alias for @ to ./src
- Ensure Vite can resolve @ imports correctly
- Match TypeScript path mapping configuration
- Replace relative imports with @ alias
- Update editor-page.tsx, app/index.tsx, main.tsx
- Improve import readability and maintainability
- Update @import statement for Tailwind CSS 4.x compatibility
- Ensure proper CSS compilation with new Tailwind setup
@ohah ohah changed the title Feat/monaco editor execute feat: FSD 아키텍처 구현 및 Tailwind CSS 4.x 업그레이드, 모나코 에디터로 변경 Oct 26, 2025
ohah added 2 commits October 27, 2025 02:30
- Add Feature-Sliced Design (FSD) architecture guidelines
- Include layer dependency rules and naming conventions
- Add Tailwind CSS 4.x and path alias documentation
- Update coding conventions for FSD compliance
- Fix model.test.ts to use correct useExecutionStore API
- Add path alias configuration to vitest.config.ts
- Update test logic to properly handle Zustand state changes
- Resolve @ path alias resolution issues in tests

All tests now pass and TypeScript compilation succeeds.
@ohah ohah self-assigned this Oct 26, 2025
- Remove trailing spaces
- Add missing comma in object literal
- Improve code readability and consistency
@ohah ohah merged commit 63007f4 into main Oct 26, 2025
6 checks passed
@ohah ohah requested a review from Copilot October 26, 2025 18:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements Feature-Sliced Design (FSD) architecture and upgrades to Tailwind CSS 4.x with Monaco Editor integration. The changes improve maintainability through clear layer separation, better developer experience with path aliases, and enhanced styling capabilities.

Key Changes:

  • Restructured codebase following FSD architecture patterns with proper layer separation (app, pages, widgets, features, shared)
  • Upgraded Tailwind CSS from 3.x to 4.x with Vite plugin integration
  • Replaced code editor with Monaco Editor for enhanced editing capabilities

Reviewed Changes

Copilot reviewed 34 out of 36 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pnpm-workspace.yaml Added @parcel/watcher to onlyBuiltDependencies
docs/docs/guide/development.mdx Updated architecture documentation with FSD structure details
apps/executeJS/vitest.config.ts Added path alias configuration for tests
apps/executeJS/vite.config.ts Added Tailwind CSS 4.x plugin and path alias
apps/executeJS/tsconfig.json Configured TypeScript path mapping for @ alias
apps/executeJS/src/widgets/output-panel/output-panel.tsx New output panel component using Radix UI
apps/executeJS/src/widgets/code-editor/code-editor.tsx New Monaco editor wrapper component
apps/executeJS/src/pages/editor/editor-page.tsx Refactored editor page with FSD imports
apps/executeJS/src/features/execute-code/model.ts New execution state management using Zustand
apps/executeJS/src/app/index.tsx New app entry point with providers
apps/executeJS/src/main.tsx Updated to import from FSD structure
apps/executeJS/src/index.css Refactored to use Tailwind CSS 4.x syntax
apps/executeJS/package.json Added Monaco, Radix UI, Tailwind CSS 4.x dependencies
agent.md Updated documentation with FSD architecture details

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ohah added a commit that referenced this pull request Dec 12, 2025
feat: FSD 아키텍처 구현 및 Tailwind CSS 4.x 업그레이드, 모나코 에디터로 변경
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants