Skip to content

refactor: Node.js Subpath Importsでモジュール境界を明確化#63

Merged
KinjiKawaguchi merged 3 commits intodevelopfrom
refactor/module-boundaries
Jan 30, 2026
Merged

refactor: Node.js Subpath Importsでモジュール境界を明確化#63
KinjiKawaguchi merged 3 commits intodevelopfrom
refactor/module-boundaries

Conversation

@KinjiKawaguchi
Copy link
Copy Markdown
Member

@KinjiKawaguchi KinjiKawaguchi commented Jan 30, 2026

Why

  • モジュール境界が曖昧で、内部実装詳細が公開されていた
  • 相対パス (../../../domain) が可読性を下げていた

What

  • Node.js Subpath Imports (#domain, #application, #infrastructure) を導入
  • 全68ファイルのインポートをサブパスインポートに変更
  • infrastructure/drizzle: schema.ts, client.ts の公開を停止(内部詳細として隠蔽)
  • moduleResolutionnode16 に変更

Before

import { Member } from "../../../domain";
import { EventNotFoundException } from "../../exceptions";

After

import { Member } from "#domain";
import { EventNotFoundException } from "#application/exceptions";

🤖 Generated with Claude Code

- infrastructure/drizzle: schema, client の公開を停止(内部詳細)
- domain: 境界を超えるインポートを index.ts 経由に統一
- tsconfig: 未使用の @/* パスエイリアスを削除

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 30, 2026 19:27
Copy link
Copy Markdown
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 refactors the module structure to clarify boundaries and hide internal implementation details, making the codebase more maintainable and better encapsulated.

Changes:

  • Removed unused @/* path alias from TypeScript configuration
  • Hid internal database implementation details (schema and client) from the infrastructure/drizzle module's public API
  • Unified domain module imports to consistently use index.ts barrel exports

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
tsconfig.json Removed unused @/* path alias configuration including baseUrl and paths
src/infrastructure/drizzle/index.ts Changed from wildcard exports to explicit repository-only exports, hiding schema.ts and client.ts
src/domain/aggregates/member/Member.ts Updated imports to use barrel exports from index.ts for exceptions and value-objects modules

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

- #domain, #application, #infrastructure のサブパスインポートを設定
- 全68ファイルのインポートを相対パスからサブパスインポートに変更
- moduleResolution を node16 に変更

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@KinjiKawaguchi KinjiKawaguchi changed the title refactor: モジュール境界を明確化しインポートパターンを統一 refactor: Node.js Subpath Importsでモジュール境界を明確化 Jan 30, 2026
- Node16 → NodeNext(将来のNode.js変更に自動対応)
- exportsフィールド追加(self-referencing対応)
- example用tsconfig追加

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@KinjiKawaguchi KinjiKawaguchi merged commit b8a3bd8 into develop Jan 30, 2026
@KinjiKawaguchi KinjiKawaguchi deleted the refactor/module-boundaries branch January 30, 2026 19:50
@KinjiKawaguchi KinjiKawaguchi mentioned this pull request Feb 1, 2026
KinjiKawaguchi added a commit that referenced this pull request Mar 23, 2026
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
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