Skip to content

Refactor: npm -> pnpm 으로 전환 및 Turborepo 도입#5

Open
aryu1217 wants to merge 5 commits intomainfrom
refactor/extract-shared-packages
Open

Refactor: npm -> pnpm 으로 전환 및 Turborepo 도입#5
aryu1217 wants to merge 5 commits intomainfrom
refactor/extract-shared-packages

Conversation

@aryu1217
Copy link
Copy Markdown
Member

@aryu1217 aryu1217 commented Apr 28, 2026

Summary by CodeRabbit

릴리스 노트

  • 버그 수정

    • 로그아웃 버튼이 처리 중일 때 비활성화되어 중복 요청 방지 및 안정성 향상
  • 신규 기능

    • 회원가입/검증 오류 메시지 처리 통합으로 일관된 오류 표시
  • 작업

    • 패키지 관리 및 빌드 워크플로우 pnpm/터보레포로 전환
    • 각 패키지에 타입체크 스크립트 추가 및 TypeScript 구성 정비
    • 캐시/빌드 관련 디렉터리 제외 규칙 추가 (.turbo 등)

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4205449e-adaf-4b33-a8bd-e069822e9402

📥 Commits

Reviewing files that changed from the base of the PR and between 953ff76 and 27aa6dd.

📒 Files selected for processing (1)
  • package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json

📝 Walkthrough

Walkthrough

npm 워크스페이스에서 pnpm + TurboRepo로 전환하고, 여러 앱에서 내부 @ocean-kit/* 워크스페이스 의존성을 추가·조정하며, 공유 인증 헬퍼와 각 패키지별 타입체크/tsconfig 파일을 도입했습니다.

Changes

Cohort / File(s) Summary
루트 및 빌드 워크플로우
package.json, pnpm-workspace.yaml, turbo.json, .gitignore
루트 패키지 매니저를 pnpm@10.33.2로 고정하고 npm 워크스페이스 스크립트를 pnpm --filter / turbo 기반으로 변경. pnpm-workspace.yamlturbo.json 추가. .turbo/ 폴더를 .gitignore에 추가.
공통 패키지: 타입체크·tsconfig 추가
packages/dashboard-domain/package.json, packages/shared-auth/package.json, packages/shared-axios/package.json, packages/shared-types/package.json, packages/submission-domain/package.json, packages/*/tsconfig.json
여러 패키지에 typecheck npm 스크립트 추가 및 각 패키지별 tsconfig.json 신설(allowJs:false, incremental:false, src/**/*.ts 포함). 내부 의존성들을 "workspace:*"로 조정.
shared-auth: 헬퍼 추가
packages/shared-auth/src/signup.ts
`getValidationErrorMessage(error: unknown): string
앱 레벨: OC-ADMIN 변경
apps/OC-ADMIN/package.json, apps/OC-ADMIN/tsconfig.json, apps/OC-ADMIN/eslint.config.mjs, apps/OC-ADMIN/src/app/register/page.tsx
@ocean-kit/* 워크스페이스 의존성 5개 추가, tsconfig의 @ocean-kit/* 경로 별칭 제거( @/* 유지), eslint config 블록 순서 조정, 로컬 검증 메시지 로직을 @ocean-kit/shared-auth/signupgetValidationErrorMessage로 대체.
앱 레벨: OC-DASHBOARD 변경
apps/OC-DASHBOARD/package.json, apps/OC-DASHBOARD/next.config.ts, apps/OC-DASHBOARD/tsconfig.json
@ocean-kit/dashboard-domain 워크스페이스 의존성 추가, next.config.tstranspilePackages@ocean-kit/shared-auth 추가, tsconfig의 @ocean-kit/* 경로 별칭 제거( @/* 유지).
앱 레벨: OC-RECORD 변경
apps/OC-RECORD/package.json, apps/OC-RECORD/tsconfig.json, apps/OC-RECORD/eslint.config.mjs, apps/OC-RECORD/src/app/register/page.tsx, apps/OC-RECORD/src/app/home/page.jsx
@ocean-kit/shared-auth, @ocean-kit/shared-axios를 workspace 의존성으로 추가, @ocean-kit/submission-domain 버전을 workspace:*로 변경, tsconfig의 도메인 별칭 제거, eslint 블록 순서 조정, register 페이지가 getValidationErrorMessage 공유 구현 사용, home 페이지의 logout에 재진입 방지(로딩 플래그 및 버튼 disabled).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 바삭한 코드밭 파먹고, pnpm 씨앗 심었네,
터보바람 불어와 패키지들 가지런히,
검증 메시지 함께 나누니 오류도 웃고,
재진입 막힌 문은 안전하게 닫혔네,
토끼가 뛰어놀며 배포를 축하하네! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 npm에서 pnpm으로 전환하고 Turborepo를 도입하는 것이라는 주요 변화를 명확하게 설명하고 있으며, 제공된 파일 변경 사항들(package.json, turbo.json, pnpm-workspace.yaml 등)과 일치합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/extract-shared-packages

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@aryu1217 aryu1217 changed the title Refactor/extract shared packages Refactor: npm -> pnpm 으로 전환 및 Turborepo 도입 Apr 28, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
packages/shared-axios/tsconfig.json (1)

1-10: 패키지 tsconfig 중복을 공통 프리셋으로 추출하는 것을 권장합니다.

동일한 compilerOptions/include/exclude가 여러 패키지에 반복되어 설정 드리프트가 생기기 쉬워 보입니다. tsconfig.package.json(루트)로 추출해 extends만 유지하면 관리가 더 단순해집니다.

예시 diff
-  "extends": "../../tsconfig.base.json",
+  "extends": "../../tsconfig.package.json",

As per coding guidelines, "파일과 컴포넌트 책임이 과도하면 응집도와 결합도 기준으로 분리안을 제시."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/shared-axios/tsconfig.json` around lines 1 - 10, The package
tsconfig.json duplicates common settings (compilerOptions, include, exclude);
extract these shared settings into a root tsconfig.package.json and have the
package tsconfig.json simply extend that preset. Concretely, create a root
tsconfig.package.json containing the common compilerOptions, include and
exclude, then replace the package's full options by leaving only "extends":
"<root preset name>" in packages/shared-axios/tsconfig.json (preserve any
package-specific overrides by adding them alongside extends if needed); ensure
the package still compiles by running tsc -p after the change and update any
other packages to use the same tsconfig.package.json to eliminate drift.
turbo.json (1)

7-13: build/lint task에 로컬 typecheck도 선행 의존으로 추가 권장합니다.

현재 turbo.json에서 ^typecheck만 지정되어 있어 의존 패키지의 타입체크만 선행되도록 설정되어 있습니다. 그러나 root 패키지는 자신의 typecheck 스크립트를 보유하고 있으므로(apps는 typecheck 스크립트가 없음), 명시적으로 로컬 typecheck 의존성도 선언하여 task 실행 순서를 일관되게 구성하는 것이 좋습니다.

🔧 제안 변경
   "build": {
-    "dependsOn": ["^typecheck"],
+    "dependsOn": ["typecheck", "^typecheck"],
     "outputs": [".next/**", "!.next/cache/**"]
   },
   "lint": {
-    "dependsOn": ["^typecheck"],
+    "dependsOn": ["typecheck", "^typecheck"],
     "outputs": []
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@turbo.json` around lines 7 - 13, Update turbo.json's task dependencies so
build and lint depend on the local typecheck as well as dependent packages'
typecheck: in the "build" and "lint" tasks, add "typecheck" to the dependsOn
arrays alongside the existing "^typecheck" entry (so dependsOn becomes
["typecheck", "^typecheck"]) to ensure the root/local typecheck runs before
build and lint; modify the entries for the "build" and "lint" tasks accordingly.
packages/shared-auth/src/signup.ts (1)

19-32: getValidationErrorMessage 구현이 적절합니다.

Zod 검증 에러 구조(issues 배열)를 안전하게 처리하는 방어적 코드입니다. 다만 타입 안전성을 높이고 싶다면 Zod의 ZodError 타입을 활용하는 방법도 고려해 볼 수 있습니다.

♻️ (선택) Zod 타입을 활용한 타입 가드 패턴
+import { ZodError } from "zod";
+
 export function getValidationErrorMessage(error: unknown): string | null {
-  if (!error || typeof error !== "object") return null;
-
-  const issues = (error as { issues?: { message?: unknown }[] }).issues;
-  if (
-    Array.isArray(issues) &&
-    issues.length > 0 &&
-    typeof issues[0]?.message === "string"
-  ) {
-    return issues[0].message;
+  if (error instanceof ZodError && error.issues.length > 0) {
+    return error.issues[0].message;
   }
 
   return null;
 }

이 리팩토링은 zod를 이 패키지의 의존성으로 추가해야 하므로, 현재 런타임 의존성 없이 유지하려는 의도라면 기존 구현이 더 적합합니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/shared-auth/src/signup.ts` around lines 19 - 32, The current
getValidationErrorMessage implementation is fine; no runtime fix required—keep
the defensive checks as-is, or if you want stronger typing instead add zod as a
dependency and replace the ad-hoc type assertion with a ZodError type guard
(import ZodError from "zod" and check error instanceof ZodError, then read
error.issues[0]?.message as string) inside getValidationErrorMessage to improve
type safety.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@package.json`:
- Around line 9-11: Add a "typecheck" npm script to the three app packages
(OC-RECORD, OC-ADMIN, OC-DASHBOARD) so they run tsc --noEmit like the packages
(dashboard-domain, shared-auth, shared-axios, shared-types, submission-domain);
update each app's package.json to include "typecheck": "tsc --noEmit" (or the
monorepo-equivalent command used elsewhere) so that running pnpm typecheck or
Turbo tasks that depend on ^typecheck will validate app-level TypeScript errors
as well.

---

Nitpick comments:
In `@packages/shared-auth/src/signup.ts`:
- Around line 19-32: The current getValidationErrorMessage implementation is
fine; no runtime fix required—keep the defensive checks as-is, or if you want
stronger typing instead add zod as a dependency and replace the ad-hoc type
assertion with a ZodError type guard (import ZodError from "zod" and check error
instanceof ZodError, then read error.issues[0]?.message as string) inside
getValidationErrorMessage to improve type safety.

In `@packages/shared-axios/tsconfig.json`:
- Around line 1-10: The package tsconfig.json duplicates common settings
(compilerOptions, include, exclude); extract these shared settings into a root
tsconfig.package.json and have the package tsconfig.json simply extend that
preset. Concretely, create a root tsconfig.package.json containing the common
compilerOptions, include and exclude, then replace the package's full options by
leaving only "extends": "<root preset name>" in
packages/shared-axios/tsconfig.json (preserve any package-specific overrides by
adding them alongside extends if needed); ensure the package still compiles by
running tsc -p after the change and update any other packages to use the same
tsconfig.package.json to eliminate drift.

In `@turbo.json`:
- Around line 7-13: Update turbo.json's task dependencies so build and lint
depend on the local typecheck as well as dependent packages' typecheck: in the
"build" and "lint" tasks, add "typecheck" to the dependsOn arrays alongside the
existing "^typecheck" entry (so dependsOn becomes ["typecheck", "^typecheck"])
to ensure the root/local typecheck runs before build and lint; modify the
entries for the "build" and "lint" tasks accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4b3a3aec-ce07-4a36-9a33-994a74850c58

📥 Commits

Reviewing files that changed from the base of the PR and between 2637654 and 953ff76.

⛔ Files ignored due to path filters (3)
  • .DS_Store is excluded by !**/.DS_Store, !**/.DS_Store
  • package-lock.json is excluded by !**/package-lock.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !**/pnpm-lock.yaml
📒 Files selected for processing (27)
  • .gitignore
  • apps/OC-ADMIN/eslint.config.mjs
  • apps/OC-ADMIN/package.json
  • apps/OC-ADMIN/src/app/register/page.tsx
  • apps/OC-ADMIN/tsconfig.json
  • apps/OC-DASHBOARD/next.config.ts
  • apps/OC-DASHBOARD/package.json
  • apps/OC-DASHBOARD/tsconfig.json
  • apps/OC-RECORD/eslint.config.mjs
  • apps/OC-RECORD/package.json
  • apps/OC-RECORD/src/app/home/page.jsx
  • apps/OC-RECORD/src/app/register/page.tsx
  • apps/OC-RECORD/tsconfig.json
  • package.json
  • packages/dashboard-domain/package.json
  • packages/dashboard-domain/tsconfig.json
  • packages/shared-auth/package.json
  • packages/shared-auth/src/signup.ts
  • packages/shared-auth/tsconfig.json
  • packages/shared-axios/package.json
  • packages/shared-axios/tsconfig.json
  • packages/shared-types/package.json
  • packages/shared-types/tsconfig.json
  • packages/submission-domain/package.json
  • packages/submission-domain/tsconfig.json
  • pnpm-workspace.yaml
  • turbo.json

Comment thread package.json Outdated
Comment on lines +9 to +11
"build": "turbo build --filter=@ocean-kit/oc-admin --filter=@ocean-kit/oc-dashboard --filter=@ocean-kit/oc-record",
"lint": "turbo lint --filter=@ocean-kit/oc-admin --filter=@ocean-kit/oc-dashboard --filter=@ocean-kit/oc-record",
"typecheck": "turbo typecheck --filter=@ocean-kit/dashboard-domain --filter=@ocean-kit/shared-auth --filter=@ocean-kit/shared-axios --filter=@ocean-kit/shared-types --filter=@ocean-kit/submission-domain"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: 앱들의 package.json에 typecheck 스크립트가 있는지 확인

echo "=== Checking for typecheck scripts in apps ==="
for app in apps/OC-RECORD apps/OC-ADMIN apps/OC-DASHBOARD; do
  if [ -f "$app/package.json" ]; then
    echo "--- $app/package.json ---"
    jq '.scripts.typecheck // "NOT DEFINED"' "$app/package.json"
  fi
done

Repository: OCEAN-KIT/OC-PROJECT

Length of output: 263


🏁 Script executed:

#!/bin/bash
# Check turbo.json task configuration for typecheck dependencies
echo "=== Checking turbo.json ==="
cat turbo.json | head -100

Repository: OCEAN-KIT/OC-PROJECT

Length of output: 375


🏁 Script executed:

#!/bin/bash
# Verify that the packages being filtered in typecheck have typecheck scripts
echo "=== Checking typecheck scripts in packages ==="
for pkg in packages/dashboard-domain packages/shared-auth packages/shared-axios packages/shared-types packages/submission-domain; do
  if [ -f "$pkg/package.json" ]; then
    echo "--- $pkg ---"
    jq '.scripts.typecheck // "NOT DEFINED"' "$pkg/package.json"
  else
    echo "--- $pkg (NOT FOUND) ---"
  fi
done

Repository: OCEAN-KIT/OC-PROJECT

Length of output: 429


🏁 Script executed:

#!/bin/bash
# Check if there's any root-level or workspace configuration for typecheck
echo "=== Checking pnpm-workspace.yaml ==="
if [ -f "pnpm-workspace.yaml" ]; then
  cat pnpm-workspace.yaml
fi

Repository: OCEAN-KIT/OC-PROJECT

Length of output: 141


앱들에 typecheck 스크립트 추가 필요

확인 결과, 3개 앱(OC-RECORD, OC-ADMIN, OC-DASHBOARD)에는 typecheck 스크립트가 정의되어 있지 않습니다. 하지만 패키지들(dashboard-domain, shared-auth, shared-axios, shared-types, submission-domain)은 모두 tsc --noEmit 스크립트를 가지고 있어 현재 구조에서 불일치가 발생합니다.

turbo.json에서 buildlint^typecheck에 의존하므로 패키지의 타입 검사는 이들 작업 실행 시 자동으로 수행되지만, 앱 자체의 타입 오류는 직접적으로 검증되지 않습니다. 모노레포의 일관성과 개발 경험을 위해 각 앱에도 typecheck 스크립트를 추가하여 pnpm typecheck 실행 시 앱도 함께 타입 검사되도록 하는 것이 권장됩니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` around lines 9 - 11, Add a "typecheck" npm script to the three
app packages (OC-RECORD, OC-ADMIN, OC-DASHBOARD) so they run tsc --noEmit like
the packages (dashboard-domain, shared-auth, shared-axios, shared-types,
submission-domain); update each app's package.json to include "typecheck": "tsc
--noEmit" (or the monorepo-equivalent command used elsewhere) so that running
pnpm typecheck or Turbo tasks that depend on ^typecheck will validate app-level
TypeScript errors as well.

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.

1 participant