diff --git a/README.md b/README.md index bbdea382..5c3c6144 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,41 @@ This monorepo follows a microservices architecture pattern with: └── docs/ # Documentation ``` +## ⚠️ Breaking Changes + +### v1.0.0 - Module Format Migration (2026-01-07) + +**BREAKING**: All shared packages now use ES modules instead of CommonJS. + +**What Changed:** +- TypeScript compilation target changed from `commonjs` to `ES2020` +- All packages (`@goodgo/types`, `@goodgo/http-client`, `@goodgo/logger`, `@goodgo/auth-sdk`, `@goodgo/tracing`) now export ES modules +- `package.json` files already declared `"type": "module"`, now TypeScript output matches + +**Migration Required:** +If you have existing code importing these packages: + +```typescript +// ✅ This still works (no changes needed for most cases) +import { UserResponse } from '@goodgo/types'; +import { createHttpClient } from '@goodgo/http-client'; + +// ⚠️ If you were using require() (CommonJS), you must update: +// ❌ OLD: const { UserResponse } = require('@goodgo/types'); +// ✅ NEW: import { UserResponse } from '@goodgo/types'; +``` + +**Action Required:** +1. Pull latest changes +2. Clean and rebuild: `pnpm -r --filter "./packages/*" run clean && pnpm build` +3. Update any CommonJS `require()` statements to ES `import` + +**Files Changed:** +- `packages/config/tsconfig/node.json` - Changed `"module": "commonjs"` → `"module": "ES2020"` +- `packages/types/tsconfig.json` - Added `"moduleResolution": "node"` + +For detailed information, see [Migration Walkthrough](docs/en/guides/module-format-migration.md). + ## 🚀 Getting Started ### Prerequisites diff --git a/README.vi.md b/README.vi.md index a5f17c0c..a6a85d79 100644 --- a/README.vi.md +++ b/README.vi.md @@ -52,6 +52,41 @@ Monorepo này tuân theo mô hình kiến trúc microservices với: └── docs/ # Tài liệu ``` +## ⚠️ Thay Đổi Quan Trọng (Breaking Changes) + +### v1.0.0 - Di chuyển sang ES Modules (2026-01-07) + +**BREAKING**: Tất cả shared packages hiện sử dụng ES modules thay vì CommonJS. + +**Những gì đã thay đổi:** +- Đích compile của TypeScript đã đổi từ `commonjs` sang `ES2020` +- Tất cả packages (`@goodgo/types`, `@goodgo/http-client`, `@goodgo/logger`, `@goodgo/auth-sdk`, `@goodgo/tracing`) hiện xuất ra ES modules +- File `package.json` đã khai báo `"type": "module"`, giờ output TypeScript đã khớp + +**Cần di chuyển code:** +Nếu bạn có code hiện tại đang import các packages này: + +```typescript +// ✅ Cách này vẫn hoạt động (không cần thay đổi trong hầu hết trường hợp) +import { UserResponse } from '@goodgo/types'; +import { createHttpClient } from '@goodgo/http-client'; + +// ⚠️ Nếu bạn đang dùng require() (CommonJS), bạn phải cập nhật: +// ❌ CŨ: const { UserResponse } = require('@goodgo/types'); +// ✅ MỚI: import { UserResponse } from '@goodgo/types'; +``` + +**Hành động cần thiết:** +1. Pull code mới nhất +2. Clean và rebuild: `pnpm -r --filter "./packages/*" run clean && pnpm build` +3. Cập nhật mọi câu lệnh `require()` (CommonJS) thành `import` (ES) + +**Files đã thay đổi:** +- `packages/config/tsconfig/node.json` - Đổi `"module": "commonjs"` → `"module": "ES2020"` +- `packages/types/tsconfig.json` - Thêm `"moduleResolution": "node"` + +Để biết thông tin chi tiết, xem [Hướng dẫn Di chuyển](docs/vi/guides/module-format-migration.md). + ## 🚀 Bắt đầu ### Yêu cầu tiên quyết