brick-engine-js 1.0.1 → 1.0.3

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.
Files changed (131) hide show
  1. package/dist/docs/GAME_DEVELOPER_GUIDE.html +1 -1
  2. package/dist/docs/brick-engine-guide.html +1 -1
  3. package/dist/docs/getting-started.html +1 -1
  4. package/dist/docs/jsdoc_standard.html +1 -1
  5. package/dist/docs/publishing.html +1 -1
  6. package/dist/docs/reference/interfaces/modules/Session.html +1 -1
  7. package/dist/docs/reference/modules/GameMenu.html +1 -1
  8. package/dist/docs/reference/modules/GameSession.html +1 -1
  9. package/dist/docs/reference/modules/InitialStateSnapshot.html +1 -1
  10. package/dist/docs/reference/modules/SessionModal.html +1 -1
  11. package/dist/docs/testing_best_practices.html +1 -1
  12. package/package.json +8 -1
  13. package/public/docs/GAME_DEVELOPER_GUIDE.html +1 -1
  14. package/public/docs/brick-engine-guide.html +1 -1
  15. package/public/docs/getting-started.html +1 -1
  16. package/public/docs/jsdoc_standard.html +1 -1
  17. package/public/docs/publishing.html +1 -1
  18. package/public/docs/reference/interfaces/modules/Session.html +1 -1
  19. package/public/docs/reference/modules/GameMenu.html +1 -1
  20. package/public/docs/reference/modules/GameSession.html +1 -1
  21. package/public/docs/reference/modules/InitialStateSnapshot.html +1 -1
  22. package/public/docs/reference/modules/SessionModal.html +1 -1
  23. package/public/docs/testing_best_practices.html +1 -1
  24. package/.env.local.example +0 -2
  25. package/.github/workflows/publish.yml +0 -73
  26. package/.prettierignore +0 -2
  27. package/.prettierrc.json +0 -8
  28. package/eslint.config.mjs +0 -29
  29. package/scripts/generate-diagrams.sh +0 -20
  30. package/scripts/generate-docs.js +0 -111
  31. package/src/client-game.d.ts +0 -1
  32. package/src/config/configs.test.ts +0 -20
  33. package/src/config/configs.ts +0 -197
  34. package/src/config/env.test.ts +0 -59
  35. package/src/config/env.ts +0 -7
  36. package/src/config/styles.ts +0 -5
  37. package/src/core/Game.test.ts +0 -167
  38. package/src/core/Game.ts +0 -307
  39. package/src/core/InitialStateSnapshot.test.ts +0 -51
  40. package/src/core/InitialStateSnapshot.ts +0 -46
  41. package/src/core/helpers/CellHelper.test.ts +0 -33
  42. package/src/core/helpers/CellHelper.ts +0 -21
  43. package/src/core/helpers/ControlInputHandlerHelper.test.ts +0 -116
  44. package/src/core/helpers/ControlInputHandlerHelper.ts +0 -68
  45. package/src/core/helpers/CoordinateHelper.test.ts +0 -113
  46. package/src/core/helpers/CoordinateHelper.ts +0 -82
  47. package/src/core/helpers/InterfaceIdentifierHelper.test.ts +0 -122
  48. package/src/core/helpers/InterfaceIdentifierHelper.ts +0 -43
  49. package/src/core/helpers/RelativeValuesHelper.test.ts +0 -47
  50. package/src/core/helpers/RelativeValuesHelper.ts +0 -29
  51. package/src/core/module/control/GameControl.test.ts +0 -82
  52. package/src/core/module/control/GameControl.ts +0 -142
  53. package/src/core/module/control/GameControlKeyBinding.test.ts +0 -59
  54. package/src/core/module/control/GameControlKeyBinding.ts +0 -92
  55. package/src/core/module/grid/GameGrid.test.ts +0 -83
  56. package/src/core/module/grid/GameGrid.ts +0 -610
  57. package/src/core/module/grid/GameHudGrid.test.ts +0 -22
  58. package/src/core/module/grid/GameHudGrid.ts +0 -40
  59. package/src/core/module/grid/engines/GridAnalysisEngine.test.ts +0 -157
  60. package/src/core/module/grid/engines/GridAnalysisEngine.ts +0 -124
  61. package/src/core/module/grid/engines/GridLineEngine.test.ts +0 -132
  62. package/src/core/module/grid/engines/GridLineEngine.ts +0 -165
  63. package/src/core/module/grid/engines/GridMovementEngine.test.ts +0 -125
  64. package/src/core/module/grid/engines/GridMovementEngine.ts +0 -113
  65. package/src/core/module/grid/engines/GridRegionEngine.test.ts +0 -136
  66. package/src/core/module/grid/engines/GridRegionEngine.ts +0 -52
  67. package/src/core/module/grid/engines/GridTransformEngine.test.ts +0 -98
  68. package/src/core/module/grid/engines/GridTransformEngine.ts +0 -70
  69. package/src/core/module/renderer/DisplayRenderer.test.ts +0 -86
  70. package/src/core/module/renderer/DisplayRenderer.ts +0 -152
  71. package/src/core/module/renderer/GameRenderer.test.ts +0 -103
  72. package/src/core/module/renderer/GameRenderer.ts +0 -144
  73. package/src/core/module/renderer/HudRenderer.test.ts +0 -108
  74. package/src/core/module/renderer/HudRenderer.ts +0 -203
  75. package/src/core/module/score/GameScore.test.ts +0 -71
  76. package/src/core/module/score/GameScore.ts +0 -188
  77. package/src/core/module/session/GameSession.test.ts +0 -176
  78. package/src/core/module/session/GameSession.ts +0 -103
  79. package/src/core/module/sound/GameSound.test.ts +0 -117
  80. package/src/core/module/sound/GameSound.ts +0 -229
  81. package/src/core/module/state/GameState.test.ts +0 -101
  82. package/src/core/module/state/GameState.ts +0 -339
  83. package/src/core/module/text/GameText.test.ts +0 -87
  84. package/src/core/module/text/GameText.ts +0 -150
  85. package/src/core/module/time/GameTime.test.ts +0 -86
  86. package/src/core/module/time/GameTime.ts +0 -144
  87. package/src/core/types/Interfaces.ts +0 -59
  88. package/src/core/types/Types.ts +0 -124
  89. package/src/core/types/enums.ts +0 -113
  90. package/src/core/types/modules.ts +0 -841
  91. package/src/index.test.ts +0 -15
  92. package/src/index.ts +0 -9
  93. package/src/main.test.ts +0 -137
  94. package/src/main.ts +0 -77
  95. package/src/menu/GameMenu.test.ts +0 -157
  96. package/src/menu/GameMenu.ts +0 -124
  97. package/src/menu/GameMenuSingleton.test.ts +0 -26
  98. package/src/menu/GameMenuSingleton.ts +0 -13
  99. package/src/menu/GameRepository.test.ts +0 -46
  100. package/src/menu/GameRepository.ts +0 -47
  101. package/src/menu/manager/GameManager.test.ts +0 -68
  102. package/src/menu/manager/GameManager.ts +0 -50
  103. package/src/types/global.d.ts +0 -8
  104. package/src/types/interfaces.ts +0 -5
  105. package/src/view/Debugger.test.ts +0 -152
  106. package/src/view/Debugger.ts +0 -124
  107. package/src/view/GameView.test.ts +0 -95
  108. package/src/view/GameView.ts +0 -244
  109. package/src/view/SessionModal.test.ts +0 -141
  110. package/src/view/SessionModal.ts +0 -73
  111. package/src/view/components/layout/ButtonLayout.test.ts +0 -28
  112. package/src/view/components/layout/ButtonLayout.ts +0 -63
  113. package/src/view/components/layout/ContainerLayout.test.ts +0 -48
  114. package/src/view/components/layout/ContainerLayout.ts +0 -50
  115. package/src/view/components/layout/FrameLayout.test.ts +0 -24
  116. package/src/view/components/layout/FrameLayout.ts +0 -25
  117. package/src/view/components/ui/BigButton.test.ts +0 -28
  118. package/src/view/components/ui/BigButton.ts +0 -31
  119. package/src/view/components/ui/Button.test.ts +0 -30
  120. package/src/view/components/ui/Button.ts +0 -30
  121. package/src/view/components/ui/Canvas.test.ts +0 -32
  122. package/src/view/components/ui/Canvas.ts +0 -34
  123. package/src/view/components/ui/SmallButton.test.ts +0 -48
  124. package/src/view/components/ui/SmallButton.ts +0 -32
  125. package/src/view/theme/applyColors.test.ts +0 -47
  126. package/src/view/theme/applyColors.ts +0 -38
  127. package/src/view/theme/dimensions.test.ts +0 -34
  128. package/src/view/theme/dimensions.ts +0 -53
  129. package/tsconfig.json +0 -16
  130. package/vitest.config.ts +0 -14
  131. package/webpack.config.js +0 -133
@@ -720,7 +720,7 @@ module.exports = {
720
720
  </div>
721
721
  <div id="footer">
722
722
  <div id="footer-text">
723
- Last updated 2026-02-23 19:45:09 UTC
723
+ Last updated 2026-02-23 20:45:02 UTC
724
724
  </div>
725
725
  </div>
726
726
  </body>
@@ -603,7 +603,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
603
603
  </div>
604
604
  <div id="footer">
605
605
  <div id="footer-text">
606
- Last updated 2026-02-23 19:45:09 UTC
606
+ Last updated 2026-02-23 20:45:02 UTC
607
607
  </div>
608
608
  </div>
609
609
  </body>
@@ -634,7 +634,7 @@ export default class MyGame extends Game {
634
634
  </div>
635
635
  <div id="footer">
636
636
  <div id="footer-text">
637
- Last updated 2026-02-23 19:45:09 UTC
637
+ Last updated 2026-02-23 20:45:02 UTC
638
638
  </div>
639
639
  </div>
640
640
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/highlight.min.js"></script>
@@ -642,7 +642,7 @@ interface ButtonLayoutResponse {
642
642
  </div>
643
643
  <div id="footer">
644
644
  <div id="footer-text">
645
- Last updated 2026-02-23 19:45:09 UTC
645
+ Last updated 2026-02-23 20:45:02 UTC
646
646
  </div>
647
647
  </div>
648
648
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/highlight.min.js"></script>
@@ -559,7 +559,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
559
559
  </div>
560
560
  <div id="footer">
561
561
  <div id="footer-text">
562
- Last updated 2026-02-23 19:45:09 UTC
562
+ Last updated 2026-02-23 20:45:02 UTC
563
563
  </div>
564
564
  </div>
565
565
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/highlight.min.js"></script>
@@ -578,7 +578,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
578
578
  </div>
579
579
  <div id="footer">
580
580
  <div id="footer-text">
581
- Last updated 2026-02-23 19:45:09 UTC
581
+ Last updated 2026-02-23 20:45:02 UTC
582
582
  </div>
583
583
  </div>
584
584
  </body>
@@ -531,7 +531,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
531
531
  </div>
532
532
  <div id="footer">
533
533
  <div id="footer-text">
534
- Last updated 2026-02-23 19:45:09 UTC
534
+ Last updated 2026-02-23 20:45:02 UTC
535
535
  </div>
536
536
  </div>
537
537
  </body>
@@ -526,7 +526,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
526
526
  </div>
527
527
  <div id="footer">
528
528
  <div id="footer-text">
529
- Last updated 2026-02-23 19:45:09 UTC
529
+ Last updated 2026-02-23 20:45:02 UTC
530
530
  </div>
531
531
  </div>
532
532
  </body>
@@ -550,7 +550,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
550
550
  </div>
551
551
  <div id="footer">
552
552
  <div id="footer-text">
553
- Last updated 2026-02-23 19:45:09 UTC
553
+ Last updated 2026-02-23 20:45:02 UTC
554
554
  </div>
555
555
  </div>
556
556
  </body>
@@ -513,7 +513,7 @@ Constructs the background container wrapper, title frames, dialogue text, and co
513
513
  </div>
514
514
  <div id="footer">
515
515
  <div id="footer-text">
516
- Last updated 2026-02-23 19:45:09 UTC
516
+ Last updated 2026-02-23 20:45:02 UTC
517
517
  </div>
518
518
  </div>
519
519
  </body>
@@ -763,7 +763,7 @@ describe('GridAnalysisEngine', () =&gt; {
763
763
  </div>
764
764
  <div id="footer">
765
765
  <div id="footer-text">
766
- Last updated 2026-02-23 19:45:09 UTC
766
+ Last updated 2026-02-23 20:45:02 UTC
767
767
  </div>
768
768
  </div>
769
769
  </body>
package/package.json CHANGED
@@ -1,10 +1,17 @@
1
1
  {
2
2
  "name": "brick-engine-js",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "A lightweight brick engine built with p5.js and TypeScript",
5
5
  "type": "commonjs",
6
6
  "main": "dist/brick-engine.js",
7
7
  "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "docs",
11
+ "public",
12
+ "README.adoc",
13
+ "LICENSE"
14
+ ],
8
15
  "license": "ISC",
9
16
  "author": "LeonardoPinheiroLacerda",
10
17
  "scripts": {
@@ -720,7 +720,7 @@ module.exports = {
720
720
  </div>
721
721
  <div id="footer">
722
722
  <div id="footer-text">
723
- Last updated 2026-02-23 19:45:09 UTC
723
+ Last updated 2026-02-23 20:45:02 UTC
724
724
  </div>
725
725
  </div>
726
726
  </body>
@@ -603,7 +603,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
603
603
  </div>
604
604
  <div id="footer">
605
605
  <div id="footer-text">
606
- Last updated 2026-02-23 19:45:09 UTC
606
+ Last updated 2026-02-23 20:45:02 UTC
607
607
  </div>
608
608
  </div>
609
609
  </body>
@@ -634,7 +634,7 @@ export default class MyGame extends Game {
634
634
  </div>
635
635
  <div id="footer">
636
636
  <div id="footer-text">
637
- Last updated 2026-02-23 19:45:09 UTC
637
+ Last updated 2026-02-23 20:45:02 UTC
638
638
  </div>
639
639
  </div>
640
640
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/highlight.min.js"></script>
@@ -642,7 +642,7 @@ interface ButtonLayoutResponse {
642
642
  </div>
643
643
  <div id="footer">
644
644
  <div id="footer-text">
645
- Last updated 2026-02-23 19:45:09 UTC
645
+ Last updated 2026-02-23 20:45:02 UTC
646
646
  </div>
647
647
  </div>
648
648
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/highlight.min.js"></script>
@@ -559,7 +559,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
559
559
  </div>
560
560
  <div id="footer">
561
561
  <div id="footer-text">
562
- Last updated 2026-02-23 19:45:09 UTC
562
+ Last updated 2026-02-23 20:45:02 UTC
563
563
  </div>
564
564
  </div>
565
565
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/highlight.min.js"></script>
@@ -578,7 +578,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
578
578
  </div>
579
579
  <div id="footer">
580
580
  <div id="footer-text">
581
- Last updated 2026-02-23 19:45:09 UTC
581
+ Last updated 2026-02-23 20:45:02 UTC
582
582
  </div>
583
583
  </div>
584
584
  </body>
@@ -531,7 +531,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
531
531
  </div>
532
532
  <div id="footer">
533
533
  <div id="footer-text">
534
- Last updated 2026-02-23 19:45:09 UTC
534
+ Last updated 2026-02-23 20:45:02 UTC
535
535
  </div>
536
536
  </div>
537
537
  </body>
@@ -526,7 +526,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
526
526
  </div>
527
527
  <div id="footer">
528
528
  <div id="footer-text">
529
- Last updated 2026-02-23 19:45:09 UTC
529
+ Last updated 2026-02-23 20:45:02 UTC
530
530
  </div>
531
531
  </div>
532
532
  </body>
@@ -550,7 +550,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
550
550
  </div>
551
551
  <div id="footer">
552
552
  <div id="footer-text">
553
- Last updated 2026-02-23 19:45:09 UTC
553
+ Last updated 2026-02-23 20:45:02 UTC
554
554
  </div>
555
555
  </div>
556
556
  </body>
@@ -513,7 +513,7 @@ Constructs the background container wrapper, title frames, dialogue text, and co
513
513
  </div>
514
514
  <div id="footer">
515
515
  <div id="footer-text">
516
- Last updated 2026-02-23 19:45:09 UTC
516
+ Last updated 2026-02-23 20:45:02 UTC
517
517
  </div>
518
518
  </div>
519
519
  </body>
@@ -763,7 +763,7 @@ describe('GridAnalysisEngine', () =&gt; {
763
763
  </div>
764
764
  <div id="footer">
765
765
  <div id="footer-text">
766
- Last updated 2026-02-23 19:45:09 UTC
766
+ Last updated 2026-02-23 20:45:02 UTC
767
767
  </div>
768
768
  </div>
769
769
  </body>
@@ -1,2 +0,0 @@
1
- SUPABASE_URL="http://127.0.0.1:54321"
2
- SUPABASE_ANON_KEY=""
@@ -1,73 +0,0 @@
1
- name: Publish and Deploy
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- - master
8
-
9
- jobs:
10
- publish:
11
- runs-on: ubuntu-latest
12
- permissions:
13
- contents: write
14
- packages: write
15
-
16
- steps:
17
- - name: Checkout repository
18
- uses: actions/checkout@v4
19
- with:
20
- fetch-depth: 0 # ensures history is available for tag and push
21
- token: ${{ secrets.GITHUB_TOKEN }} # Needed to push back to the repository
22
-
23
- - name: Setup Node.js
24
- uses: actions/setup-node@v4
25
- with:
26
- node-version: '22'
27
- registry-url: 'https://registry.npmjs.org/'
28
-
29
- - name: Validate NPM Token
30
- run: npm whoami
31
- env:
32
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
33
-
34
- - name: Install dependencies
35
- run: npm ci
36
-
37
- - name: Build project
38
- run: npm run build
39
- env:
40
- SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
41
- SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }}
42
-
43
- - name: Configure Git
44
- run: |
45
- git config --global user.name 'LeonardoPinheiroLacerda'
46
- git config --global user.email 'leon.lacerda2015@gmail.com'
47
-
48
- - name: Bump Version
49
- run: |
50
- npm version patch --no-git-tag-version
51
- VERSION=$(node -p "require('./package.json').version")
52
- echo "VERSION=$VERSION" >> $GITHUB_ENV
53
- git add package.json package-lock.json
54
- git commit -m "chore: bump version to v${VERSION} [skip ci]"
55
- git tag -a "v${VERSION}" -m "Version ${VERSION}"
56
-
57
- - name: Push adjustments
58
- run: |
59
- git push origin HEAD:${{ github.ref }}
60
- git push origin --tags
61
-
62
- - name: Publish to NPM
63
- run: npm publish --access public
64
- env:
65
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
66
-
67
- - name: Create GitHub Release
68
- env:
69
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70
- run: |
71
- gh release create "v${{ env.VERSION }}" \
72
- --title "Release v${{ env.VERSION }}" \
73
- --generate-notes
package/.prettierignore DELETED
@@ -1,2 +0,0 @@
1
- package.json
2
- package-lock.json
package/.prettierrc.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "trailingComma": "all",
3
- "singleQuote": true,
4
- "endOfLine": "lf",
5
- "tabWidth": 4,
6
- "arrowParens": "avoid",
7
- "printWidth": 160
8
- }
package/eslint.config.mjs DELETED
@@ -1,29 +0,0 @@
1
- import globals from 'globals';
2
- import pluginJs from '@eslint/js';
3
- import tseslint from 'typescript-eslint';
4
-
5
- export default [
6
- {
7
- ignores: ['dist/', 'node_modules/', 'docs/', 'public/docs/', 'scripts/'],
8
- },
9
- // Base config for all files
10
- pluginJs.configs.recommended,
11
- ...tseslint.configs.recommended,
12
-
13
- // Browser globals for most files
14
- {
15
- files: ['**/*.{js,mjs,cjs,ts}'],
16
- languageOptions: { globals: globals.browser },
17
- },
18
-
19
- // Node globals for config files
20
- {
21
- files: ['**/webpack.config.js', 'eslint.config.mjs'],
22
- languageOptions: { globals: globals.node },
23
- rules: {
24
- '@typescript-eslint/no-require-imports': 'off',
25
- '@typescript-eslint/no-var-requires': 'off',
26
- 'no-undef': 'off', // globals.node should handle this, but just in case
27
- },
28
- },
29
- ];
@@ -1,20 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Create output directory if it doesn't exist
4
- mkdir -p docs/images
5
-
6
- # Loop through all .mmd files in docs/diagrams
7
- for file in docs/diagrams/*.mmd; do
8
- # Check if file exists (in case of no matches)
9
- [ -e "$file" ] || continue
10
-
11
- # Extract filename without extension
12
- filename=$(basename "$file" .mmd)
13
-
14
- echo "Generating ${filename}.svg..."
15
-
16
- # Run mermaid-cli to generate SVG
17
- npx -y @mermaid-js/mermaid-cli -i "$file" -o "docs/images/${filename}.svg"
18
- done
19
-
20
- echo "All diagrams generated successfully."
@@ -1,111 +0,0 @@
1
- const asciidoctor = require('asciidoctor')();
2
- const fs = require('fs');
3
- const path = require('path');
4
-
5
- const DOCS_DIR = path.join(__dirname, '../docs');
6
- const PUBLIC_DOCS_DIR = path.join(__dirname, '../public/docs');
7
- const README_FILE = path.join(__dirname, '../README.adoc');
8
-
9
- function getAllFiles(dirPath, arrayOfFiles) {
10
- if (!fs.existsSync(dirPath)) return [];
11
-
12
- const files = fs.readdirSync(dirPath);
13
- arrayOfFiles = arrayOfFiles || [];
14
-
15
- files.forEach(function (file) {
16
- const fullPath = path.join(dirPath, file);
17
- if (fs.statSync(fullPath).isDirectory()) {
18
- arrayOfFiles = getAllFiles(fullPath, arrayOfFiles);
19
- } else {
20
- if (file.endsWith('.adoc')) {
21
- arrayOfFiles.push(fullPath);
22
- }
23
- }
24
- });
25
-
26
- return arrayOfFiles;
27
- }
28
-
29
- /**
30
- * Copies a directory recursively.
31
- */
32
- function copyDir(src, dest) {
33
- if (!fs.existsSync(src)) return;
34
- fs.mkdirSync(dest, { recursive: true });
35
- const entries = fs.readdirSync(src, { withFileTypes: true });
36
-
37
- for (let entry of entries) {
38
- const srcPath = path.join(src, entry.name);
39
- const destPath = path.join(dest, entry.name);
40
-
41
- if (entry.isDirectory()) {
42
- copyDir(srcPath, destPath);
43
- } else {
44
- fs.copyFileSync(srcPath, destPath);
45
- }
46
- }
47
- }
48
-
49
- // Ensure public/docs exists and is clean
50
- if (fs.existsSync(PUBLIC_DOCS_DIR)) {
51
- fs.rmSync(PUBLIC_DOCS_DIR, { recursive: true, force: true });
52
- }
53
- fs.mkdirSync(PUBLIC_DOCS_DIR, { recursive: true });
54
-
55
- // 1. Convert README.adoc to index.html
56
- if (fs.existsSync(README_FILE)) {
57
- console.log(`Converting README.adoc -> index.html`);
58
- const indexPath = path.join(PUBLIC_DOCS_DIR, 'index.html');
59
- asciidoctor.convertFile(README_FILE, {
60
- to_file: indexPath,
61
- safe: 'safe',
62
- makedirs: true,
63
- });
64
-
65
- // Fix links in index.html:
66
- // - Replace 'href="docs/' with 'href="' (since index.html is in /public/docs)
67
- // - Ensure .adoc links are changed to .html
68
- let content = fs.readFileSync(indexPath, 'utf8');
69
- content = content.replace(/href="docs\//g, 'href="');
70
- content = content.replace(/\.adoc/g, '.html');
71
-
72
- fs.writeFileSync(indexPath, content);
73
- console.log('Fixed links in index.html');
74
- } else {
75
- console.warn('README.adoc not found at root.');
76
- }
77
-
78
- // 2. Convert files in docs/
79
- if (fs.existsSync(DOCS_DIR)) {
80
- const files = getAllFiles(DOCS_DIR).filter(f => !f.startsWith(path.join(DOCS_DIR, 'images')) && !f.startsWith(path.join(DOCS_DIR, 'diagrams')));
81
- console.log(`Found ${files.length} .adoc files in docs/ to process.`);
82
-
83
- files.forEach(file => {
84
- const relativePath = path.relative(DOCS_DIR, file);
85
- const destPath = path.join(PUBLIC_DOCS_DIR, relativePath.replace(/\.adoc$/, '.html'));
86
-
87
- const destDir = path.dirname(destPath);
88
- if (!fs.existsSync(destDir)) {
89
- fs.mkdirSync(destDir, { recursive: true });
90
- }
91
-
92
- console.log(`Converting: ${relativePath} -> ${path.relative(process.cwd(), destPath)}`);
93
- asciidoctor.convertFile(file, { to_file: destPath, safe: 'safe', makedirs: true });
94
-
95
- // Fix internal links in reference files that might use docs/ prefix
96
- let content = fs.readFileSync(destPath, 'utf8');
97
- // If a file in reference/modules/ links to docs/reference/enums/
98
- // Asciidoctor might have kept 'docs/reference/' if it wasn't a proper xref.
99
- content = content.replace(/href="docs\//g, 'href="../../'); // Roughly 2 levels up
100
- // Note: This is a bit naive but should solve the reported issue if it occurs in modules.
101
-
102
- fs.writeFileSync(destPath, content);
103
- });
104
- }
105
-
106
- // 3. Copy images and diagrams for full documentation support
107
- console.log('Copying images and diagrams...');
108
- copyDir(path.join(DOCS_DIR, 'images'), path.join(PUBLIC_DOCS_DIR, 'images'));
109
- copyDir(path.join(DOCS_DIR, 'diagrams'), path.join(PUBLIC_DOCS_DIR, 'diagrams'));
110
-
111
- console.log('Documentation generation complete.');
@@ -1 +0,0 @@
1
- declare module '@client-game';
@@ -1,20 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import configs from './configs';
3
-
4
- describe('configs', () => {
5
- it('should export an object containing configuration values', () => {
6
- // [ARRANGE & ACT]
7
- const configSnapshot = configs;
8
-
9
- // [ASSERT]
10
- expect(configSnapshot).toBeDefined();
11
- expect(configSnapshot.game).toBeDefined();
12
- expect(configSnapshot.screenLayout).toBeDefined();
13
- expect(configSnapshot.colors).toBeDefined();
14
- });
15
-
16
- it('should have read-only immutable structure based on as const declaration', () => {
17
- // [ASSERT]
18
- expect(configs.colors.background).toBe('rgb(172, 189, 173)');
19
- });
20
- });