From 23e5707e9869178a33ace4cdc025efda9e21cf65 Mon Sep 17 00:00:00 2001 From: Frank Tovar Date: Sat, 17 May 2025 15:55:08 +0200 Subject: [PATCH] game data schema --- .vscode/extensions.json | 4 - .vscode/launch.json | 39 +-- .vscode/settings.json | 8 + .vscode/tasks.json | 42 ---- package-lock.json | 420 +++++++++++++++++++++++++++++++++ package.json | 5 +- schemas/gdRoot.json | 255 ++++++++++++++++++++ src/assets/data/gdRoot.json | 70 ++++++ src/assets/manifest.json | 10 +- tools/generateAssetManifest.js | 1 + tsconfig.json | 5 +- 11 files changed, 787 insertions(+), 72 deletions(-) delete mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json delete mode 100644 .vscode/tasks.json create mode 100644 schemas/gdRoot.json create mode 100644 src/assets/data/gdRoot.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index 77b3745..0000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846 - "recommendations": ["angular.ng-template"] -} diff --git a/.vscode/launch.json b/.vscode/launch.json index a5fdd85..64562ca 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,20 +1,21 @@ { - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "ng serve", - "type": "firefox", - "request": "launch", - "preLaunchTask": "npm: start", - "url": "http://localhost:4200/" - }, - { - "name": "ng test", - "type": "firefox", - "request": "launch", - "preLaunchTask": "npm: test", - "url": "http://localhost:9876/debug.html" - } - ] -} + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "firefox", + "request": "launch", + "name": "Launch in Firefox", + "url": "http://localhost:4200", + "preLaunchTask": "npm: start", + "sourceMaps": true, + "trace": true, + "webRoot": "${workspaceFolder}", + "outFiles": [ + "${workspaceFolder}/dist/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..3e83928 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "json.schemas": [ + { + "fileMatch": [ "src/assets/data/*.json" ], + "url": "./schemas/gdRoot.json" + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index a298b5b..0000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558 - "version": "2.0.0", - "tasks": [ - { - "type": "npm", - "script": "start", - "isBackground": true, - "problemMatcher": { - "owner": "typescript", - "pattern": "$tsc", - "background": { - "activeOnStart": true, - "beginsPattern": { - "regexp": "(.*?)" - }, - "endsPattern": { - "regexp": "bundle generation complete" - } - } - } - }, - { - "type": "npm", - "script": "test", - "isBackground": true, - "problemMatcher": { - "owner": "typescript", - "pattern": "$tsc", - "background": { - "activeOnStart": true, - "beginsPattern": { - "regexp": "(.*?)" - }, - "endsPattern": { - "regexp": "bundle generation complete" - } - } - } - } - ] -} diff --git a/package-lock.json b/package-lock.json index 2e3cbc9..e8e6518 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,6 +31,8 @@ "karma-coverage": "~2.2.0", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.1.0", + "ts-auto-guard": "^5.0.1", + "ts-json-schema-generator": "^2.4.0", "typescript": "~5.7.2" } }, @@ -4993,6 +4995,61 @@ "dev": true, "license": "MIT" }, + "node_modules/@ts-morph/common": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.24.0.tgz", + "integrity": "sha512-c1xMmNHWpNselmpIqursHeOHHBTIsJLbB+NuovbTTRCNiTLEr/U9dbJ8qy0jd/O2x5pc3seWuOUN5R2IoOTp8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-glob": "^3.3.2", + "minimatch": "^9.0.4", + "mkdirp": "^3.0.1", + "path-browserify": "^1.0.1" + } + }, + "node_modules/@ts-morph/common/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@ts-morph/common/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@ts-morph/common/node_modules/mkdirp": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz", + "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==", + "dev": true, + "license": "MIT", + "bin": { + "mkdirp": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@tufjs/canonical-json": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-2.0.0.tgz", @@ -5285,6 +5342,20 @@ "@types/node": "*" } }, + "node_modules/@types/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-xevGOReSYGM7g/kUBZzPqCrR/KYAo+F0yiPc85WFTJa0MSLtyFTVTU6cJu/aV4mid7IffDIWqo69THF2o4JiEQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/strip-json-comments": { + "version": "0.0.30", + "resolved": "https://registry.npmjs.org/@types/strip-json-comments/-/strip-json-comments-0.0.30.tgz", + "integrity": "sha512-7NQmHra/JILCd1QqpSzl8+mJRc8ZHz3uDm8YV1Ks9IhK0epEiTw8aIErbvH9PI+6XbqhyIQy3462nEsn7UVzjQ==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/ws": { "version": "8.18.1", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", @@ -5726,6 +5797,16 @@ "dev": true, "license": "Python-2.0" }, + "node_modules/array-back": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-6.2.2.tgz", + "integrity": "sha512-gUAZ7HPyb4SJczXAMUXMGAvI976JoK3qEx9v1FTmeYuJj0IBiaKttG1ydtGKdkfqWkIkouke7nG8ufGy77+Cvw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.17" + } + }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -6327,6 +6408,22 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/chalk-template": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/chalk-template/-/chalk-template-0.4.0.tgz", + "integrity": "sha512-/ghrgmhfY8RaSdeo43hNXxpoHAtxdbskUHjPpfqUWGttFgycUhYPGx3YZBCnUCvOa7Doivn1IZec3DEGFoMgLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.1.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/chalk-template?sponsor=1" + } + }, "node_modules/chardet": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", @@ -6552,6 +6649,13 @@ "node": ">=0.10.0" } }, + "node_modules/code-block-writer": { + "version": "13.0.3", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-13.0.3.tgz", + "integrity": "sha512-Oofo0pq3IKnsFtuHqSF7TqBfr71aeyZDVJ0HpmqB7FBM2qEigL0iPONSCZSO9pE9dZTAxANe5XHG9Uy0YMv8cg==", + "dev": true, + "license": "MIT" + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -6579,6 +6683,46 @@ "dev": true, "license": "MIT" }, + "node_modules/command-line-args": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-6.0.1.tgz", + "integrity": "sha512-Jr3eByUjqyK0qd8W0SGFW1nZwqCaNCtbXjRo2cRJC1OYxWl3MZ5t1US3jq+cO4sPavqgw4l9BMGX0CBe+trepg==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-back": "^6.2.2", + "find-replace": "^5.0.2", + "lodash.camelcase": "^4.3.0", + "typical": "^7.2.0" + }, + "engines": { + "node": ">=12.20" + }, + "peerDependencies": { + "@75lb/nature": "latest" + }, + "peerDependenciesMeta": { + "@75lb/nature": { + "optional": true + } + } + }, + "node_modules/command-line-usage": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-7.0.3.tgz", + "integrity": "sha512-PqMLy5+YGwhMh1wS04mVG44oqDsgyLRSKJBdOo1bnYhMKBW65gZF1dRp2OZRhiTjgUHljy99qkO7bsctLaw35Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-back": "^6.2.2", + "chalk-template": "^0.4.0", + "table-layout": "^4.1.0", + "typical": "^7.1.1" + }, + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -7923,6 +8067,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/find-replace": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-5.0.2.tgz", + "integrity": "sha512-Y45BAiE3mz2QsrN2fb5QEtO4qb44NcS7en/0y9PEVsg351HsLeVclP8QPMH79Le9sH3rs5RSwJu99W0WPZO43Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@75lb/nature": "latest" + }, + "peerDependenciesMeta": { + "@75lb/nature": { + "optional": true + } + } + }, "node_modules/find-up": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", @@ -9846,6 +10008,13 @@ "dev": true, "license": "MIT" }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", + "dev": true, + "license": "MIT" + }, "node_modules/lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", @@ -11303,6 +11472,13 @@ "node": ">= 0.8" } }, + "node_modules/path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", + "dev": true, + "license": "MIT" + }, "node_modules/path-exists": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", @@ -12153,6 +12329,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/safe-stable-stringify": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", + "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -13148,6 +13334,26 @@ "node": ">=8" } }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -13184,6 +13390,20 @@ "node": ">=0.10" } }, + "node_modules/table-layout": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-4.1.1.tgz", + "integrity": "sha512-iK5/YhZxq5GO5z8wb0bY1317uDF3Zjpha0QFFLA8/trAoiLbQD0HUbMesEaxyzUgDxi2QlcbM8IvqOlEjgoXBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-back": "^6.2.2", + "wordwrapjs": "^5.1.0" + }, + "engines": { + "node": ">=12.17" + } + }, "node_modules/tapable": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", @@ -13449,6 +13669,186 @@ "tree-kill": "cli.js" } }, + "node_modules/ts-auto-guard": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ts-auto-guard/-/ts-auto-guard-5.0.1.tgz", + "integrity": "sha512-0s4zJfYJK2eko8VF2YFbL6zncaMwSwfI94n+FM+zrQXMjbvw1DovChVCNIJwGTGnl6RhQG2x1Q8bx/sMrTo0Pg==", + "dev": true, + "license": "MIT", + "dependencies": { + "command-line-args": "^6.0.0", + "command-line-usage": "^7.0.2", + "ts-morph": "^23.0.0", + "tsconfig": "^7.0.0" + }, + "bin": { + "ts-auto-guard": "lib/cli.js" + } + }, + "node_modules/ts-json-schema-generator": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/ts-json-schema-generator/-/ts-json-schema-generator-2.4.0.tgz", + "integrity": "sha512-HbmNsgs58CfdJq0gpteRTxPXG26zumezOs+SB9tgky6MpqiFgQwieCn2MW70+sxpHouZ/w9LW0V6L4ZQO4y1Ug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.15", + "commander": "^13.1.0", + "glob": "^11.0.1", + "json5": "^2.2.3", + "normalize-path": "^3.0.0", + "safe-stable-stringify": "^2.5.0", + "tslib": "^2.8.1", + "typescript": "^5.8.2" + }, + "bin": { + "ts-json-schema-generator": "bin/ts-json-schema-generator.js" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/ts-json-schema-generator/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/ts-json-schema-generator/node_modules/commander": { + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz", + "integrity": "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/ts-json-schema-generator/node_modules/glob": { + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.2.tgz", + "integrity": "sha512-YT7U7Vye+t5fZ/QMkBFrTJ7ZQxInIUjwyAjVj84CYXqgBdv30MFUPGnBR6sQaVq6Is15wYJUsnzTuWaGRBhBAQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^4.0.1", + "minimatch": "^10.0.0", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^2.0.0" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ts-json-schema-generator/node_modules/jackspeak": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.0.tgz", + "integrity": "sha512-9DDdhb5j6cpeitCbvLO7n7J4IxnbM6hoF6O1g4HQ5TfhvvKN8ywDM7668ZhMHRqVmxqhps/F6syWK2KcPxYlkw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ts-json-schema-generator/node_modules/lru-cache": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.1.0.tgz", + "integrity": "sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A==", + "dev": true, + "license": "ISC", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/ts-json-schema-generator/node_modules/minimatch": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", + "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ts-json-schema-generator/node_modules/path-scurry": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", + "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ts-json-schema-generator/node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/ts-morph": { + "version": "23.0.0", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-23.0.0.tgz", + "integrity": "sha512-FcvFx7a9E8TUe6T3ShihXJLiJOiqyafzFKUO4aqIHDUCIvADdGNShcbc2W5PMr3LerXRv7mafvFZ9lRENxJmug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ts-morph/common": "~0.24.0", + "code-block-writer": "^13.0.1" + } + }, + "node_modules/tsconfig": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-7.0.0.tgz", + "integrity": "sha512-vZXmzPrL+EmC4T/4rVlT2jNVMWCi/O4DIiSj3UHg1OE5kCKbk4mfrXc6dZksLgRM/TZlKnousKH9bbTazUWRRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/strip-bom": "^3.0.0", + "@types/strip-json-comments": "0.0.30", + "strip-bom": "^3.0.0", + "strip-json-comments": "^2.0.0" + } + }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -13518,6 +13918,16 @@ "node": ">=14.17" } }, + "node_modules/typical": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-7.3.0.tgz", + "integrity": "sha512-ya4mg/30vm+DOWfBg4YK3j2WD6TWtRkCbasOJr40CseYENzCUby/7rIvXA99JGsQHeNxLbnXdyLLxKSv3tauFw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.17" + } + }, "node_modules/ua-parser-js": { "version": "0.7.40", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.40.tgz", @@ -14580,6 +14990,16 @@ "dev": true, "license": "MIT" }, + "node_modules/wordwrapjs": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-5.1.0.tgz", + "integrity": "sha512-JNjcULU2e4KJwUNv6CHgI46UvDGitb6dGryHajXTDiLgg1/RiGoPSDw4kZfYnwGtEXf2ZMeIewDQgFGzkCB2Sg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.17" + } + }, "node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", diff --git a/package.json b/package.json index 808f1b2..d104056 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "start": "npm run prebuild && ng serve", "build": "npm run prebuild && ng build", "watch": "npm run prebuild && ng build --watch --configuration development", - "test": "npm run prebuild && ng test" + "test": "npm run prebuild && ng test", + "generate:schemas": "ts-json-schema-generator --path 'src/app/components/game/data/GdRoot.ts' --tsconfig tsconfig.json --type GdRoot --out schemas/gdRoot.json" }, "private": true, "dependencies": { @@ -34,6 +35,8 @@ "karma-coverage": "~2.2.0", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.1.0", + "ts-auto-guard": "^5.0.1", + "ts-json-schema-generator": "^2.4.0", "typescript": "~5.7.2" } } diff --git a/schemas/gdRoot.json b/schemas/gdRoot.json new file mode 100644 index 0000000..c9a6a47 --- /dev/null +++ b/schemas/gdRoot.json @@ -0,0 +1,255 @@ +{ + "$ref": "#/definitions/GdRoot", + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "EEnemySize": { + "enum": [ + 0, + 1, + 2 + ], + "type": "number" + }, + "EProjectileEffectType": { + "const": 0, + "type": "number" + }, + "GdEnemy": { + "additionalProperties": false, + "properties": { + "speed": { + "type": "number" + } + }, + "required": [ + "speed" + ], + "type": "object" + }, + "GdLevel": { + "additionalProperties": false, + "properties": { + "currency": { + "type": "number" + }, + "enemyRoutes": { + "items": { + "items": { + "type": "number" + }, + "type": "array" + }, + "type": "array" + }, + "enemySpawns": { + "items": { + "$ref": "#/definitions/Hex" + }, + "type": "array" + }, + "enemyTargets": { + "items": { + "$ref": "#/definitions/Hex" + }, + "type": "array" + }, + "radius": { + "type": "number" + }, + "walls": { + "items": { + "$ref": "#/definitions/Hex" + }, + "type": "array" + }, + "waves": { + "items": { + "$ref": "#/definitions/GdWave" + }, + "type": "array" + } + }, + "required": [ + "radius", + "currency", + "walls", + "enemySpawns", + "enemyTargets", + "enemyRoutes", + "waves" + ], + "type": "object" + }, + "GdProjectileEffect": { + "additionalProperties": false, + "properties": { + "amount": { + "type": "number" + }, + "speed": { + "type": "number" + }, + "type": { + "$ref": "#/definitions/EProjectileEffectType" + } + }, + "required": [ + "type", + "amount", + "speed" + ], + "type": "object" + }, + "GdRoot": { + "additionalProperties": false, + "properties": { + "enemies": { + "items": { + "$ref": "#/definitions/GdEnemy" + }, + "type": "array" + }, + "levels": { + "items": { + "$ref": "#/definitions/GdLevel" + }, + "type": "array" + }, + "simulation": { + "$ref": "#/definitions/GdSimulation" + }, + "towers": { + "items": { + "$ref": "#/definitions/GdTower" + }, + "type": "array" + } + }, + "required": [ + "enemies", + "towers", + "levels", + "simulation" + ], + "type": "object" + }, + "GdSimulation": { + "additionalProperties": false, + "properties": { + "spawnDelay": { + "type": "number" + }, + "stepsPerSecond": { + "type": "number" + }, + "waveDuration": { + "type": "number" + } + }, + "required": [ + "stepsPerSecond", + "waveDuration", + "spawnDelay" + ], + "type": "object" + }, + "GdTower": { + "additionalProperties": false, + "properties": { + "aoeEffect": { + "anyOf": [ + { + "$ref": "#/definitions/GdProjectileEffect" + }, + { + "type": "null" + } + ] + }, + "aoeRange": { + "type": "number" + }, + "aoeRate": { + "type": "number" + }, + "cost": { + "type": "number" + }, + "projectileEffect": { + "anyOf": [ + { + "$ref": "#/definitions/GdProjectileEffect" + }, + { + "type": "null" + } + ] + }, + "projectileRange": { + "type": "number" + }, + "projectileRate": { + "type": "number" + }, + "projectileSize": { + "type": "number" + } + }, + "required": [ + "cost", + "projectileEffect", + "projectileRange", + "projectileRate", + "projectileSize", + "aoeEffect", + "aoeRange", + "aoeRate" + ], + "type": "object" + }, + "GdWave": { + "additionalProperties": false, + "properties": { + "amount": { + "type": "number" + }, + "enemy": { + "type": "number" + }, + "gain": { + "type": "number" + }, + "hitpoints": { + "type": "number" + }, + "size": { + "$ref": "#/definitions/EEnemySize" + } + }, + "required": [ + "enemy", + "size", + "amount", + "gain", + "hitpoints" + ], + "type": "object" + }, + "Hex": { + "additionalProperties": false, + "properties": { + "col": { + "type": "number" + }, + "row": { + "type": "number" + } + }, + "required": [ + "col", + "row" + ], + "type": "object" + } + } +} \ No newline at end of file diff --git a/src/assets/data/gdRoot.json b/src/assets/data/gdRoot.json new file mode 100644 index 0000000..5229745 --- /dev/null +++ b/src/assets/data/gdRoot.json @@ -0,0 +1,70 @@ +{ + "enemies": [ + { + "speed": 1 + } + ], + "towers": [ + { + "cost": 75, + "projectileEffect": { + "type": 0, + "amount": 2, + "speed": 10 + }, + "projectileRange": 2, + "projectileRate": 5, + "projectileSize": 0.2, + "aoeEffect": null, + "aoeRange": 0, + "aoeRate": 0 + } + ], + "levels": [ + { + "radius": 9, + "currency": 1500, + "walls": [ + { "col": 0, "row": 0 } + ], + "enemySpawns": [ + { "col": -9, "row": -1}, + { "col": -9, "row": 0}, + { "col": -9, "row": 1} + ], + "enemyTargets": [ + { "col": 8, "row": -1}, + { "col": 9, "row": 0}, + { "col": 8, "row": 1} + ], + "enemyRoutes": [ + [0, 0], + [0, 1], + [0, 2], + [1, 0], + [1, 1], + [1, 2], + [2, 0], + [2, 1], + [2, 2] + ], + "waves": [ + { "enemy": 0, "size": 1, "amount": 10, "gain": 3, "hitpoints": 10 }, + { "enemy": 0, "size": 1, "amount": 10, "gain": 5, "hitpoints": 20 }, + { "enemy": 0, "size": 0, "amount": 50, "gain": 7, "hitpoints": 5 }, + { "enemy": 0, "size": 1, "amount": 15, "gain": 10, "hitpoints": 30 }, + { "enemy": 0, "size": 2, "amount": 3, "gain": 50, "hitpoints": 200 }, + { "enemy": 0, "size": 1, "amount": 10, "gain": 10, "hitpoints": 60 }, + { "enemy": 0, "size": 1, "amount": 10, "gain": 15, "hitpoints": 70 }, + { "enemy": 0, "size": 1, "amount": 15, "gain": 20, "hitpoints": 80 }, + { "enemy": 0, "size": 1, "amount": 15, "gain": 25, "hitpoints": 90 }, + { "enemy": 0, "size": 2, "amount": 3, "gain": 100, "hitpoints": 500 } + ] + } + ], + "simulation": { + "stepsPerSecond": 30, + "waveDuration": 5, + "spawnDelay": 0.5 + } +} diff --git a/src/assets/manifest.json b/src/assets/manifest.json index 1a304f9..96e6a9b 100644 --- a/src/assets/manifest.json +++ b/src/assets/manifest.json @@ -19,6 +19,11 @@ "type": "audio", "size": 5622381 }, + { + "path": "data/gdRoot.json", + "type": "other", + "size": 1723 + }, { "path": "gameData.json", "type": "other", @@ -433,10 +438,5 @@ "path": "images/wall.png", "type": "image", "size": 310712 - }, - { - "path": "manifest.json", - "type": "other", - "size": 7722 } ] \ No newline at end of file diff --git a/tools/generateAssetManifest.js b/tools/generateAssetManifest.js index 2033658..b9f0cfd 100644 --- a/tools/generateAssetManifest.js +++ b/tools/generateAssetManifest.js @@ -13,6 +13,7 @@ function detectType(filepath) { function walk(dir, acc = []) { const entries = fs.readdirSync(dir); for (const entry of entries) { + if (entry == "manifest.json") continue; const fullPath = path.join(dir, entry); const relPath = path.relative(basePath, fullPath).replace(/\\/g, "/"); const stat = fs.statSync(fullPath); diff --git a/tsconfig.json b/tsconfig.json index 5525117..9242f7f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,10 @@ "moduleResolution": "bundler", "importHelpers": true, "target": "ES2022", - "module": "ES2022" + "module": "ES2022", + "plugins": [ + { "transform": "ts-auto-guard/transformer" } + ] }, "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false,