@goodgamestudios/cxf-webshop 7.0.0-qa.1 → 7.0.0-qa.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/webshop-cxf.js +1 -1
- package/dist/webshop-cxf.js.map +4 -4
- package/package.json +7 -7
- package/.eslintrc.js +0 -25
- package/.prettierignore +0 -6
- package/.prettierrc.js +0 -10
- package/REFACTORING_README.md +0 -265
- package/TEST_MIGRATION.md +0 -441
- package/TYPES_REFACTORING.md +0 -308
- package/esbuild.build.js +0 -14
- package/esbuild.serve.js +0 -25
- package/src_old/@types/global.d.ts +0 -2
- package/src_old/ArgumentNullError.ts +0 -6
- package/src_old/app.ts +0 -30
- package/src_old/combineReaders.ts +0 -8
- package/src_old/common.ts +0 -35
- package/src_old/config.ts +0 -42
- package/src_old/cxf.ts +0 -32
- package/src_old/dialog.ts +0 -25
- package/src_old/env.ts +0 -127
- package/src_old/fetch.ts +0 -46
- package/src_old/handlers/eventHandlers.ts +0 -43
- package/src_old/handlers/postMessageHandlers.ts +0 -43
- package/src_old/handlers/pushHandlers.ts +0 -95
- package/src_old/handlers/reducers.ts +0 -207
- package/src_old/helpers.ts +0 -143
- package/src_old/index.ts +0 -35
- package/src_old/messages/IShopMessageBus.ts +0 -3
- package/src_old/messages/ShopMessageBus.ts +0 -10
- package/src_old/messages/TestShopMessageBus.ts +0 -8
- package/src_old/ping.ts +0 -15
- package/src_old/preFetch.ts +0 -43
- package/src_old/storage.ts +0 -32
- package/src_old/store.ts +0 -82
- package/src_old/track.ts +0 -59
- package/src_old/url.ts +0 -95
- package/src_old/utils.ts +0 -64
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodgamestudios/cxf-webshop",
|
|
3
3
|
"description": "WebShop CXF Module",
|
|
4
|
-
"version": "7.0.0-qa.
|
|
4
|
+
"version": "7.0.0-qa.10",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": {
|
|
@@ -39,9 +39,8 @@
|
|
|
39
39
|
"@goodgamestudios/cxf-ready": "^1.0.7",
|
|
40
40
|
"@goodgamestudios/cxf-runtime": "^1.3.0",
|
|
41
41
|
"@goodgamestudios/game-alias": "^0.2.11",
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"uuid": "^11.1.0"
|
|
42
|
+
"@lukeed/uuid": "^2.0.1",
|
|
43
|
+
"debug": "^4.4.3"
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
47
46
|
"@commitlint/cli": "^19.8.0",
|
|
@@ -73,8 +72,8 @@
|
|
|
73
72
|
"jest-environment-jsdom": "^28.1.3",
|
|
74
73
|
"lint-staged": "^15.5.0",
|
|
75
74
|
"npm-run-all": "^4.1.5",
|
|
76
|
-
"prettier": "^3.
|
|
77
|
-
"puppeteer": "^24.
|
|
75
|
+
"prettier": "^3.6.2",
|
|
76
|
+
"puppeteer": "^24.30.0",
|
|
78
77
|
"semantic-release": "^24.2.3",
|
|
79
78
|
"simple-git-hooks": "^2.12.1",
|
|
80
79
|
"ts-jest": "^29.3.0",
|
|
@@ -126,5 +125,6 @@
|
|
|
126
125
|
},
|
|
127
126
|
"engines": {
|
|
128
127
|
"node": "22"
|
|
129
|
-
}
|
|
128
|
+
},
|
|
129
|
+
"packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
|
|
130
130
|
}
|
package/.eslintrc.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
parser: '@typescript-eslint/parser',
|
|
4
|
-
env: {
|
|
5
|
-
browser: true,
|
|
6
|
-
es6: true,
|
|
7
|
-
node: true,
|
|
8
|
-
es2022: false
|
|
9
|
-
},
|
|
10
|
-
ignorePatterns: ['dist/*', '.eslintrc.js', '.prettierrc.js', '*.config.js', 'esbuild*'],
|
|
11
|
-
plugins: ['@typescript-eslint', 'prettier'],
|
|
12
|
-
extends: [
|
|
13
|
-
'eslint:recommended',
|
|
14
|
-
'standard',
|
|
15
|
-
'plugin:prettier/recommended',
|
|
16
|
-
'plugin:unicorn/all',
|
|
17
|
-
'plugin:@typescript-eslint/recommended'
|
|
18
|
-
],
|
|
19
|
-
rules: {
|
|
20
|
-
'unicorn/filename-case': 'off',
|
|
21
|
-
'unicorn/prevent-abbreviations': 'off',
|
|
22
|
-
'unicorn/prefer-module': 'off',
|
|
23
|
-
'@typescript-eslint/ban-ts-comment': 'warn',
|
|
24
|
-
}
|
|
25
|
-
}
|
package/.prettierignore
DELETED
package/.prettierrc.js
DELETED
package/REFACTORING_README.md
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
# CXF Webshop - Refactoring Documentation
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
This project contains two versions of the CXF Webshop codebase:
|
|
6
|
-
|
|
7
|
-
1. **`src/`** - Refactored code **WITHOUT** dependency injection (✨ **ACTIVE**)
|
|
8
|
-
2. **`src_old/`** - Original code **WITH** dependency injection (📚 **REFERENCE**)
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## What Happened?
|
|
13
|
-
|
|
14
|
-
The entire codebase was refactored to **remove dependency injection patterns** while maintaining 100% of functionality.
|
|
15
|
-
|
|
16
|
-
### Before (src_old/)
|
|
17
|
-
```typescript
|
|
18
|
-
// Complex DI with readuz library
|
|
19
|
-
export const trackAction: DIReader<TrackAction> = inject(
|
|
20
|
-
(env) => env.config,
|
|
21
|
-
(env) => env.cxfProvider,
|
|
22
|
-
(config, cxfProvider) => (payload) => {
|
|
23
|
-
const cxf = getCxf(cxfProvider)
|
|
24
|
-
cxf.emit(config.CXF_TRACK_MSG, payload)
|
|
25
|
-
}
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
// Usage
|
|
29
|
-
const action = trackAction(environment)
|
|
30
|
-
action(payload)
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### After (src/)
|
|
34
|
-
```typescript
|
|
35
|
-
// Direct implementation with global state
|
|
36
|
-
export const trackAction = (payload: ITrackPayload): void => {
|
|
37
|
-
const config = globalState.getConfig()
|
|
38
|
-
const cxf = globalState.getCxf()
|
|
39
|
-
cxf.emit(config.CXF_TRACK_MSG, payload)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Usage
|
|
43
|
-
trackAction(payload)
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Quick Comparison
|
|
49
|
-
|
|
50
|
-
| Aspect | src_old/ (DI) | src/ (Direct) |
|
|
51
|
-
|--------|---------------|---------------|
|
|
52
|
-
| **Pattern** | Reader monad + inject() | Direct functions |
|
|
53
|
-
| **Dependencies** | readuz library | None |
|
|
54
|
-
| **Complexity** | High | Low |
|
|
55
|
-
| **Code Lines** | ~2000 | ~1600 |
|
|
56
|
-
| **Testability** | Excellent | Good |
|
|
57
|
-
| **Learning Curve** | Steep | Gentle |
|
|
58
|
-
| **Status** | Reference | **Active** |
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## Directory Structure
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
cxf-webshop/
|
|
66
|
-
├── src/ ← ✨ ACTIVE: Refactored without DI
|
|
67
|
-
│ ├── globalState.ts ← NEW: Central state management
|
|
68
|
-
│ ├── index.ts ← Simplified entry point
|
|
69
|
-
│ ├── app.ts ← Direct implementation
|
|
70
|
-
│ ├── handlers/ ← Simplified handlers
|
|
71
|
-
│ ├── messages/ ← Unchanged
|
|
72
|
-
│ └── ... (all other files)
|
|
73
|
-
│
|
|
74
|
-
├── src_old/ ← 📚 REFERENCE: Original with DI
|
|
75
|
-
│ ├── env.ts ← Complex environment DI
|
|
76
|
-
│ ├── combineReaders.ts ← Reader utilities
|
|
77
|
-
│ ├── index.ts ← DI-based entry point
|
|
78
|
-
│ └── ... (original files)
|
|
79
|
-
│
|
|
80
|
-
├── REFACTORING_README.md ← This file
|
|
81
|
-
└── ... (other project files)
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## Key Changes
|
|
87
|
-
|
|
88
|
-
### 1. Removed Dependency Injection
|
|
89
|
-
- ❌ Removed `readuz` library dependency
|
|
90
|
-
- ❌ Removed `DIReader<T>` type wrappers
|
|
91
|
-
- ❌ Removed `inject()` function calls (~50+ sites)
|
|
92
|
-
- ❌ Deleted `env.ts` and `combineReaders.ts`
|
|
93
|
-
|
|
94
|
-
### 2. Added Global State
|
|
95
|
-
- ✨ New `globalState.ts` - centralized state singleton
|
|
96
|
-
- Direct access via `globalState.getConfig()`, `getCxf()`, `getStore()`
|
|
97
|
-
- Simple initialization in `index.ts`
|
|
98
|
-
|
|
99
|
-
### 3. Simplified Everything
|
|
100
|
-
- All functions now have direct implementations
|
|
101
|
-
- No more nested inject() calls
|
|
102
|
-
- Clear, straightforward execution flow
|
|
103
|
-
- 40% reduction in complexity
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
## Documentation
|
|
108
|
-
|
|
109
|
-
The **`src/`** folder contains comprehensive documentation:
|
|
110
|
-
|
|
111
|
-
### Quick Start
|
|
112
|
-
📄 **[src/QUICK_REFERENCE.md](./src/QUICK_REFERENCE.md)** - 5-minute overview
|
|
113
|
-
|
|
114
|
-
### Essential Reading
|
|
115
|
-
📖 **[src/README.md](./src/README.md)** - Complete architecture guide
|
|
116
|
-
📊 **[src/SUMMARY.md](./src/SUMMARY.md)** - Refactoring summary
|
|
117
|
-
🔄 **[src/MIGRATION_GUIDE.md](./src/MIGRATION_GUIDE.md)** - Migration details
|
|
118
|
-
|
|
119
|
-
### Reference
|
|
120
|
-
📋 **[src/FILE_LIST.md](./src/FILE_LIST.md)** - All files inventory
|
|
121
|
-
📑 **[src/INDEX.md](./src/INDEX.md)** - Documentation navigation
|
|
122
|
-
|
|
123
|
-
**Total Documentation**: 6 files, ~1200 lines of detailed guides
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
## Using the Code
|
|
128
|
-
|
|
129
|
-
### Current Setup (src/)
|
|
130
|
-
|
|
131
|
-
```typescript
|
|
132
|
-
import { globalState } from './src/globalState'
|
|
133
|
-
import { createConfig } from './src/config'
|
|
134
|
-
import { defaultStore } from './src/store'
|
|
135
|
-
import { app } from './src/app'
|
|
136
|
-
|
|
137
|
-
// Initialize
|
|
138
|
-
const cxf = await loadCxf()
|
|
139
|
-
globalState.setConfig(createConfig(cxf.gameId))
|
|
140
|
-
globalState.setCxf(cxf)
|
|
141
|
-
globalState.setStore(defaultStore(cxf))
|
|
142
|
-
|
|
143
|
-
// Start
|
|
144
|
-
app()
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### Reverting to DI (src_old/)
|
|
148
|
-
|
|
149
|
-
If you need the original DI version:
|
|
150
|
-
1. Swap folder names (src ↔ src_old)
|
|
151
|
-
2. Restore `readuz` dependency in package.json
|
|
152
|
-
3. Update build configuration
|
|
153
|
-
|
|
154
|
-
---
|
|
155
|
-
|
|
156
|
-
## Why This Change?
|
|
157
|
-
|
|
158
|
-
### Benefits ✅
|
|
159
|
-
- **Simpler Code**: 40% less complexity
|
|
160
|
-
- **Less Boilerplate**: 87% reduction in DI scaffolding
|
|
161
|
-
- **Easier Onboarding**: Standard JavaScript patterns
|
|
162
|
-
- **Smaller Bundle**: One less dependency
|
|
163
|
-
- **Faster Development**: Direct function calls
|
|
164
|
-
- **Better Performance**: No Reader resolution overhead
|
|
165
|
-
|
|
166
|
-
### Trade-offs ⚠️
|
|
167
|
-
- **Testability**: Requires global state setup in tests
|
|
168
|
-
- **Coupling**: Functions depend on global state
|
|
169
|
-
- **Flexibility**: Less swappable implementations
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
## Testing
|
|
174
|
-
|
|
175
|
-
### Old Way (src_old/)
|
|
176
|
-
```typescript
|
|
177
|
-
const mockEnv = {
|
|
178
|
-
config: just(mockConfig),
|
|
179
|
-
cxfProvider: just(mockCxf)
|
|
180
|
-
}
|
|
181
|
-
const fn = myFunction(mockEnv)
|
|
182
|
-
fn(args)
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### New Way (src/)
|
|
186
|
-
```typescript
|
|
187
|
-
beforeEach(() => {
|
|
188
|
-
globalState.setConfig(mockConfig)
|
|
189
|
-
globalState.setCxf(mockCxf)
|
|
190
|
-
globalState.setStore(mockStore)
|
|
191
|
-
})
|
|
192
|
-
myFunction(args)
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
---
|
|
196
|
-
|
|
197
|
-
## When to Use Which?
|
|
198
|
-
|
|
199
|
-
### Use src/ (Direct Pattern) 👍
|
|
200
|
-
- ✅ Smaller to medium applications
|
|
201
|
-
- ✅ Team prefers imperative programming
|
|
202
|
-
- ✅ Simplicity is priority
|
|
203
|
-
- ✅ Rapid development needed
|
|
204
|
-
- ✅ Standard testing approach
|
|
205
|
-
|
|
206
|
-
### Use src_old/ (DI Pattern) 👍
|
|
207
|
-
- ✅ Large enterprise applications
|
|
208
|
-
- ✅ Maximum test coverage required
|
|
209
|
-
- ✅ Team experienced with functional patterns
|
|
210
|
-
- ✅ Multiple implementations needed
|
|
211
|
-
- ✅ Highest flexibility required
|
|
212
|
-
|
|
213
|
-
---
|
|
214
|
-
|
|
215
|
-
## Statistics
|
|
216
|
-
|
|
217
|
-
| Metric | Count |
|
|
218
|
-
|--------|-------|
|
|
219
|
-
| Total TypeScript files | 27 |
|
|
220
|
-
| Documentation files | 6 |
|
|
221
|
-
| Lines of code reduced | ~400 |
|
|
222
|
-
| Complexity reduction | ~40% |
|
|
223
|
-
| inject() calls removed | ~50+ |
|
|
224
|
-
| External deps removed | 1 (readuz) |
|
|
225
|
-
| New files added | 1 (globalState.ts) |
|
|
226
|
-
| Files deleted | 2 (env.ts, combineReaders.ts) |
|
|
227
|
-
|
|
228
|
-
---
|
|
229
|
-
|
|
230
|
-
## Quick Links
|
|
231
|
-
|
|
232
|
-
- 📖 [Main Documentation](./src/README.md)
|
|
233
|
-
- ⚡ [Quick Reference](./src/QUICK_REFERENCE.md)
|
|
234
|
-
- 🔄 [Migration Guide](./src/MIGRATION_GUIDE.md)
|
|
235
|
-
- 📊 [Summary](./src/SUMMARY.md)
|
|
236
|
-
- 📋 [File List](./src/FILE_LIST.md)
|
|
237
|
-
- 📑 [Documentation Index](./src/INDEX.md)
|
|
238
|
-
|
|
239
|
-
---
|
|
240
|
-
|
|
241
|
-
## Status
|
|
242
|
-
|
|
243
|
-
✅ **Refactoring Complete**
|
|
244
|
-
- All functionality preserved
|
|
245
|
-
- All files refactored (27 files)
|
|
246
|
-
- Documentation complete (6 files, 1200+ lines)
|
|
247
|
-
- Both versions available for reference
|
|
248
|
-
|
|
249
|
-
**Active Version**: `src/` (without DI)
|
|
250
|
-
**Reference Version**: `src_old/` (with DI)
|
|
251
|
-
|
|
252
|
-
---
|
|
253
|
-
|
|
254
|
-
## Need Help?
|
|
255
|
-
|
|
256
|
-
1. **Quick overview** → Read [QUICK_REFERENCE.md](./src/QUICK_REFERENCE.md)
|
|
257
|
-
2. **Architecture details** → Read [README.md](./src/README.md)
|
|
258
|
-
3. **Migration questions** → Read [MIGRATION_GUIDE.md](./src/MIGRATION_GUIDE.md)
|
|
259
|
-
4. **Code examples** → Read [SUMMARY.md](./src/SUMMARY.md)
|
|
260
|
-
|
|
261
|
-
---
|
|
262
|
-
|
|
263
|
-
*Last Updated: 2024*
|
|
264
|
-
*Refactoring: Complete ✅*
|
|
265
|
-
*Status: Production Ready 🚀*
|