Skip to content

Commit 5da17c1

Browse files
committed
chore: version packages
1 parent 7d4cdc8 commit 5da17c1

File tree

23 files changed

+4614
-3308
lines changed

23 files changed

+4614
-3308
lines changed

ANALIZ_RAPORU.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Nuxt Modül vs Next.js Plugin - Detaylı Analiz Raporu
2+
3+
## 🎯 SONUÇ: %100 UYUMLU - Gereksiz Yapılar Tespit Edildi
4+
5+
### ✅ TEMEL UYUMLULUK
6+
- **Query Builder**: İdentik API ✅
7+
- **Server Logic**: Aynı mantık ✅
8+
- **Error Handling**: İdentik sistem ✅
9+
- **TypeScript Types**: %100 uyumlu ✅
10+
11+
### ❌ GEREKSIZ/FAZLA YAPILAR
12+
13+
#### 1. **Server API Dosyaları (GEREKSIZ)**
14+
```
15+
packages/nextjs/src/server/api/
16+
├── models.ts ❌ GEREKSIZ - Re-export only
17+
├── models/[id].ts ❌ GEREKSIZ - Re-export only
18+
└── query.ts ❌ GEREKSIZ - Re-export only
19+
```
20+
21+
**Sebep**: Next.js'te API routes dosyaları direkt `pages/api/` altında olmalı. Ayrı server dosyaları gereksiz komplekslik.
22+
23+
#### 2. **Duplike Hook Implementation (FAZLA)**
24+
```
25+
packages/nextjs/src/hooks/useContentrainQuery.ts ❌ FAZLA KOD
26+
```
27+
28+
**Sebep**: 400+ satır kod, Nuxt versiyonundan %95 aynı. React-specific olmayan kısımlar duplike.
29+
30+
#### 3. **Gereksiz Plugin Complexity**
31+
```
32+
packages/nextjs/src/plugin.ts ❌ FAZLA KARMAŞIK
33+
```
34+
35+
**Sebep**: Webpack hooks, type generation, rewrites - çoğu özellik Next.js'te otomatik.
36+
37+
### 🚀 ÖNERİLEN OPTİMİZE YAPILAR
38+
39+
#### **A. Minimal Hook Yaklaşımı**
40+
```typescript
41+
// Sadece React-specific wrapper
42+
export function useContentrainQuery<T>(modelId: string) {
43+
const [state, setState] = useState<QueryState<T>>();
44+
45+
const queryBuilder = useMemo(() =>
46+
new ContentrainQueryBuilder<T>(modelId), [modelId]
47+
);
48+
49+
return {
50+
...state,
51+
...queryBuilder
52+
};
53+
}
54+
```
55+
56+
#### **B. Sadece Template Files**
57+
```
58+
packages/nextjs/
59+
├── templates/
60+
│ ├── api-models.ts.template
61+
│ ├── api-query.ts.template
62+
│ └── next-config.js.template
63+
├── src/
64+
│ ├── hooks/
65+
│ │ └── index.ts // Minimal React wrappers
66+
│ └── index.ts // Re-exports from @contentrain/query
67+
```
68+
69+
#### **C. Shared Core Usage**
70+
```typescript
71+
// Ana paket kullanımı
72+
import { ContentrainSDK, QueryFactory } from '@contentrain/query';
73+
74+
// React wrapper
75+
export function useContentrainQuery<T>(modelId: string) {
76+
const sdk = useMemo(() => new ContentrainSDK('json', options), []);
77+
return sdk.query<T>(modelId);
78+
}
79+
```
80+
81+
### 📊 KOD AZALTMA POTANSİYELİ
82+
83+
| **Dosya** | **Mevcut** | **Önerilen** | **Azalma** |
84+
|-----------|------------|--------------|------------|
85+
| **Hook Files** | 400+ satır | 50 satır | %87 azalma |
86+
| **Server API** | 200+ satır | 0 satır | %100 azalma |
87+
| **Plugin Logic** | 300+ satır | 100 satır | %66 azalma |
88+
| **TOPLAM** | 900+ satır | 150 satır | **%83 AZALMA** |
89+
90+
### 🎯 SON ÖNERİ
91+
92+
**MEVCUT DURUM**: Next.js plugin fonksiyonel ama %80 gereksiz kod içeriyor.
93+
94+
**OPTİMAL ÇÖZÜM**:
95+
1. `@contentrain/query` paketini base olarak kullan
96+
2. Sadece React-specific hook wrappers yaz
97+
3. Template dosyaları ile kolay kurulum sağla
98+
4. %83 daha az kod, aynı işlevsellik
99+
100+
**SONUÇ**: Mevcut plugin çalışır ama optimize edilmeli. Gereksiz komplekslik mevcut.

packages/nuxt-json/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @contentrain/nuxt-json
22

3+
## 2.0.0
4+
5+
### Major Changes
6+
7+
- feat(nuxt-json): locale metadata, query utils refactor, error codes and removal of deprecated client composable
8+
39
## 1.1.0
410

511
- Add Nuxt 4 compatibility metadata

packages/nuxt-json/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentrain/nuxt-json",
3-
"version": "1.2.0",
3+
"version": "2.0.0",
44
"description": "Contentrain JSON Module for Nuxt",
55
"repository": {
66
"type": "git",

packages/nuxt-json/playground/contentrain/.contentrain-build/metadata.json

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,55 +5,83 @@
55
"localization": true,
66
"type": "JSON",
77
"createdBy": "user",
8-
"isServerless": false
8+
"isServerless": false,
9+
"locales": [
10+
"en",
11+
"tr"
12+
]
913
},
1014
{
1115
"name": "ProcessItems",
1216
"modelId": "processes",
1317
"localization": true,
1418
"type": "JSON",
1519
"createdBy": "user",
16-
"isServerless": false
20+
"isServerless": false,
21+
"locales": [
22+
"en",
23+
"tr"
24+
]
1725
},
1826
{
1927
"name": "TabItems",
2028
"modelId": "tabitems",
2129
"localization": true,
2230
"type": "JSON",
2331
"createdBy": "user",
24-
"isServerless": false
32+
"isServerless": false,
33+
"locales": [
34+
"en",
35+
"tr"
36+
]
2537
},
2638
{
2739
"name": "WorkItems",
2840
"modelId": "workitems",
2941
"localization": true,
3042
"type": "JSON",
3143
"createdBy": "user",
32-
"isServerless": false
44+
"isServerless": false,
45+
"locales": [
46+
"en",
47+
"tr"
48+
]
3349
},
3450
{
3551
"name": "WorkCategories",
3652
"modelId": "workcategories",
3753
"localization": true,
3854
"type": "JSON",
3955
"createdBy": "user",
40-
"isServerless": false
56+
"isServerless": false,
57+
"locales": [
58+
"en",
59+
"tr"
60+
]
4161
},
4262
{
4363
"name": "FaqItems",
4464
"modelId": "faqitems",
4565
"localization": true,
4666
"type": "JSON",
4767
"createdBy": "user",
48-
"isServerless": false
68+
"isServerless": false,
69+
"locales": [
70+
"en",
71+
"tr"
72+
]
4973
},
5074
{
5175
"name": "Sections",
5276
"modelId": "sections",
5377
"localization": true,
5478
"type": "JSON",
5579
"createdBy": "user",
56-
"isServerless": false
80+
"isServerless": false,
81+
"locales": [
82+
"en",
83+
"tr"
84+
]
5785
},
5886
{
5987
"name": "SocialLinks",
@@ -77,23 +105,35 @@
77105
"localization": true,
78106
"type": "JSON",
79107
"createdBy": "user",
80-
"isServerless": false
108+
"isServerless": false,
109+
"locales": [
110+
"en",
111+
"tr"
112+
]
81113
},
82114
{
83115
"name": "Testimonial Items",
84116
"modelId": "testimonial-items",
85117
"localization": true,
86118
"type": "JSON",
87119
"createdBy": "user",
88-
"isServerless": false
120+
"isServerless": false,
121+
"locales": [
122+
"en",
123+
"tr"
124+
]
89125
},
90126
{
91127
"name": "Project Details",
92128
"modelId": "project-details",
93129
"localization": true,
94130
"type": "JSON",
95131
"createdBy": "user",
96-
"isServerless": false
132+
"isServerless": false,
133+
"locales": [
134+
"en",
135+
"tr"
136+
]
97137
},
98138
{
99139
"name": "Project Stats",
@@ -103,4 +143,4 @@
103143
"createdBy": "user",
104144
"isServerless": false
105145
}
106-
]
146+
]

packages/nuxt-json/playground/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"name": "my-module-playground",
44
"type": "module",
55
"scripts": {
6-
"dev": "nuxi dev",
6+
"dev": "nuxi dev --port 3003",
77
"build": "nuxi build",
88
"generate": "nuxi generate"
99
},
1010
"dependencies": {
11-
"nuxt": "^3.15.4"
11+
"nuxt": "^4.2.1"
1212
},
1313
"devDependencies": {
1414
"@nuxtjs/tailwindcss": "^6.13.1",

packages/nuxt-json/src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export interface ModelMetadata {
66
type: 'JSON'
77
createdBy: string
88
isServerless: boolean
9+
locales?: string[]
910
}
1011

1112
// Field Types

packages/nuxt/.npmrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/nuxt/CHANGELOG.md

Lines changed: 0 additions & 89 deletions
This file was deleted.

0 commit comments

Comments
 (0)