@goodgamestudios/cxf-webshop 7.0.0-qa.2 → 7.0.0-qa.22

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/package.json CHANGED
@@ -1,129 +1,130 @@
1
1
  {
2
- "name": "@goodgamestudios/cxf-webshop",
3
- "description": "WebShop CXF Module",
4
- "version": "7.0.0-qa.2",
5
- "keywords": [],
6
- "license": "UNLICENSED",
7
- "repository": {
8
- "type": "git",
9
- "url": "git@gitlab.goodgamestudios.com:cxf/webshop-cxf.git"
10
- },
11
- "publishConfig": {
12
- "access": "public"
13
- },
14
- "scripts": {
15
- "start": "node esbuild.serve.js",
16
- "build": "node esbuild.build.js",
17
- "build:qa": "cross-env STAGE=qa npm run build",
18
- "build:live": "cross-env STAGE=live npm run build",
19
- "lint": "eslint './src/**/*.ts'",
20
- "lint:fix": "npm run lint -- --fix",
21
- "test:unit": "jest test/* --env=jsdom",
22
- "test": "npm run test:unit && npm run test:e2e",
23
- "commit": "git-cz",
24
- "------------------BDD-----------------": "",
25
- "test:e2e": "npm-run-all --parallel start bdd:test-stop",
26
- "bdd:test": "jest bdd/*",
27
- "bdd:test-stop": "npm run bdd:test && pkill -f esbuild-serve",
28
- "------------------DEPLOY--------------": "",
29
- "release": "semantic-release",
30
- "deploy:dev": "npm run build:qa && npm publish --tag qa --access public",
31
- "deploy:qa": "npm run build:qa && npm run release",
32
- "deploy:live": "npm run build:live && npm run release",
33
- "prepare": ""
34
- },
35
- "main": "dist/webshop-cxf.js",
36
- "author": "Igor Babkin <ibabkin@goodgamestudios.com>",
37
- "dependencies": {
38
- "@goodgamestudios/cxf-events": "^1.24.0",
39
- "@goodgamestudios/cxf-ready": "^1.0.7",
40
- "@goodgamestudios/cxf-runtime": "^1.3.0",
41
- "@goodgamestudios/game-alias": "^0.2.11",
42
- "debug": "^4.4.3",
43
- "uuid": "^11.1.0"
44
- },
45
- "devDependencies": {
46
- "@commitlint/cli": "^19.8.0",
47
- "@commitlint/config-conventional": "^19.8.0",
48
- "@semantic-release/changelog": "^6.0.3",
49
- "@semantic-release/commit-analyzer": "^13.0.1",
50
- "@semantic-release/git": "^10.0.1",
51
- "@semantic-release/npm": "^12.0.1",
52
- "@semantic-release/release-notes-generator": "^14.0.3",
53
- "@types/debug": "^4.1.12",
54
- "@types/jest": "^29.5.14",
55
- "@types/node": "^22.13.14",
56
- "@types/uuid": "^10.0.0",
57
- "@typescript-eslint/eslint-plugin": "^5.62.0",
58
- "@typescript-eslint/parser": "^5.62.0",
59
- "cross-env": "^7.0.3",
60
- "cz-conventional-changelog": "3.3.0",
61
- "esbuild": "^0.25.1",
62
- "eslint": "^8.57.1",
63
- "eslint-config-prettier": "^8.10.0",
64
- "eslint-config-standard": "^17.1.0",
65
- "eslint-plugin-import": "^2.31.0",
66
- "eslint-plugin-n": "^15.7.0",
67
- "eslint-plugin-prettier": "^5.0.1",
68
- "eslint-plugin-promise": "^6.6.0",
69
- "eslint-plugin-unicorn": "52.0.0",
70
- "eventemitter3": "^4.0.7",
71
- "jest": "^29.7.0",
72
- "jest-environment-jsdom": "^28.1.3",
73
- "lint-staged": "^15.5.0",
74
- "npm-run-all": "^4.1.5",
75
- "prettier": "^3.5.3",
76
- "puppeteer": "^24.4.0",
77
- "semantic-release": "^24.2.3",
78
- "simple-git-hooks": "^2.12.1",
79
- "ts-jest": "^29.3.0",
80
- "ts-loader": "^9.5.2",
81
- "typescript": "^4.9.5"
82
- },
83
- "commitlint": {
84
- "extends": [
85
- "@commitlint/config-conventional"
86
- ],
87
- "rules": {
88
- "body-max-line-length": [
89
- 1,
90
- "always",
91
- 100
92
- ]
93
- }
94
- },
95
- "release": {
96
- "branches": [
97
- {
98
- "name": "master"
99
- },
100
- {
101
- "name": "develop",
102
- "channel": "qa",
103
- "prerelease": "qa"
104
- }
105
- ],
106
- "plugins": [
107
- "@semantic-release/commit-analyzer",
108
- "@semantic-release/release-notes-generator",
109
- "@semantic-release/changelog",
110
- "@semantic-release/npm",
111
- "@semantic-release/git"
112
- ]
113
- },
114
- "lint-staged": {
115
- "*.ts": "npm run lint:fix"
116
- },
117
- "config": {
118
- "commitizen": {
119
- "path": "./node_modules/cz-conventional-changelog"
120
- }
121
- },
122
- "simple-git-hooks": {
123
- "pre-commit": "npx lint-staged",
124
- "commit-msg": "npx commitlint --edit $1"
125
- },
126
- "engines": {
127
- "node": "22"
128
- }
2
+ "name": "@goodgamestudios/cxf-webshop",
3
+ "description": "WebShop CXF Module",
4
+ "version": "7.0.0-qa.22",
5
+ "keywords": [],
6
+ "license": "UNLICENSED",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git@gitlab.goodgamestudios.com:cxf/webshop-cxf.git"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "scripts": {
15
+ "start:bddsite": "node esbuild.serve.js",
16
+ "start:webshop": "node esbuild.serve.webshop.js",
17
+ "build": "node esbuild.build.js",
18
+ "build:qa": "cross-env STAGE=qa npm run build",
19
+ "build:live": "cross-env STAGE=live npm run build",
20
+ "lint": "eslint './src/**/*.ts'",
21
+ "lint:fix": "npm run lint -- --fix",
22
+ "test:unit": "jest test/* --env=jsdom",
23
+ "test": "npm run test:unit && npm run test:e2e",
24
+ "commit": "git-cz",
25
+ "------------------BDD-----------------": "",
26
+ "test:e2e": "npm-run-all --parallel start:bddsite bdd:test-stop",
27
+ "bdd:test": "jest bdd/*",
28
+ "bdd:test-stop": "npm run bdd:test && pkill -f esbuild-serve",
29
+ "------------------DEPLOY--------------": "",
30
+ "release": "semantic-release",
31
+ "deploy:dev": "npm run build:qa && npm publish --tag qa --access public",
32
+ "deploy:qa": "npm run build:qa && npm run release",
33
+ "deploy:live": "npm run build:live && npm run release",
34
+ "prepare": ""
35
+ },
36
+ "main": "dist/webshop-cxf.js",
37
+ "author": "Igor Babkin <ibabkin@goodgamestudios.com>",
38
+ "dependencies": {
39
+ "@goodgamestudios/cxf-events": "^1.24.0",
40
+ "@goodgamestudios/cxf-ready": "^1.0.7",
41
+ "@goodgamestudios/cxf-runtime": "^1.3.0",
42
+ "@goodgamestudios/game-alias": "^0.2.11",
43
+ "@lukeed/uuid": "^2.0.1",
44
+ "debug": "^4.4.3"
45
+ },
46
+ "devDependencies": {
47
+ "@commitlint/cli": "^19.8.0",
48
+ "@commitlint/config-conventional": "^19.8.0",
49
+ "@semantic-release/changelog": "^6.0.3",
50
+ "@semantic-release/commit-analyzer": "^13.0.1",
51
+ "@semantic-release/git": "^10.0.1",
52
+ "@semantic-release/npm": "^12.0.1",
53
+ "@semantic-release/release-notes-generator": "^14.0.3",
54
+ "@types/debug": "^4.1.12",
55
+ "@types/jest": "^29.5.14",
56
+ "@types/node": "^22.13.14",
57
+ "@typescript-eslint/eslint-plugin": "^5.62.0",
58
+ "@typescript-eslint/parser": "^5.62.0",
59
+ "cross-env": "^7.0.3",
60
+ "cz-conventional-changelog": "3.3.0",
61
+ "esbuild": "^0.25.1",
62
+ "eslint": "^8.57.1",
63
+ "eslint-config-prettier": "^8.10.0",
64
+ "eslint-config-standard": "^17.1.0",
65
+ "eslint-plugin-import": "^2.31.0",
66
+ "eslint-plugin-n": "^15.7.0",
67
+ "eslint-plugin-prettier": "^5.0.1",
68
+ "eslint-plugin-promise": "^6.6.0",
69
+ "eslint-plugin-unicorn": "52.0.0",
70
+ "eventemitter3": "^4.0.7",
71
+ "jest": "^29.7.0",
72
+ "jest-environment-jsdom": "^28.1.3",
73
+ "lint-staged": "^15.5.0",
74
+ "npm-run-all": "^4.1.5",
75
+ "prettier": "^3.6.2",
76
+ "puppeteer": "^24.30.0",
77
+ "semantic-release": "^24.2.3",
78
+ "simple-git-hooks": "^2.12.1",
79
+ "ts-jest": "^29.3.0",
80
+ "ts-loader": "^9.5.2",
81
+ "typescript": "^4.9.5"
82
+ },
83
+ "commitlint": {
84
+ "extends": [
85
+ "@commitlint/config-conventional"
86
+ ],
87
+ "rules": {
88
+ "body-max-line-length": [
89
+ 1,
90
+ "always",
91
+ 100
92
+ ]
93
+ }
94
+ },
95
+ "release": {
96
+ "branches": [
97
+ {
98
+ "name": "master"
99
+ },
100
+ {
101
+ "name": "develop",
102
+ "channel": "qa",
103
+ "prerelease": "qa"
104
+ }
105
+ ],
106
+ "plugins": [
107
+ "@semantic-release/commit-analyzer",
108
+ "@semantic-release/release-notes-generator",
109
+ "@semantic-release/changelog",
110
+ "@semantic-release/npm",
111
+ "@semantic-release/git"
112
+ ]
113
+ },
114
+ "lint-staged": {
115
+ "*.ts": "npm run lint:fix"
116
+ },
117
+ "config": {
118
+ "commitizen": {
119
+ "path": "./node_modules/cz-conventional-changelog"
120
+ }
121
+ },
122
+ "simple-git-hooks": {
123
+ "pre-commit": "npx lint-staged",
124
+ "commit-msg": "npx commitlint --edit $1"
125
+ },
126
+ "engines": {
127
+ "node": "22"
128
+ },
129
+ "packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
129
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
@@ -1,6 +0,0 @@
1
- dist
2
- build
3
- coverage
4
- public
5
-
6
- *.html
package/.prettierrc.js DELETED
@@ -1,10 +0,0 @@
1
- module.exports = {
2
- trailingComma: 'es5',
3
- tabWidth: 4,
4
- semi: false,
5
- singleQuote: true,
6
- printWidth: 120,
7
- useTabs: false,
8
- bracketSpacing: true,
9
- proseWrap: 'preserve',
10
- }
@@ -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 🚀*