diff --git a/.gitignore b/.gitignore index 403adbc..5da30dc 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ pnpm-debug.log* *.njsproj *.sln *.sw? + +**/*.json.d.ts diff --git a/package-lock.json b/package-lock.json index 991248b..55325f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,6 +48,7 @@ "jsdom": "^20.0.0", "prettier": "^2.5.1", "typescript": "^4.7.4", + "unplugin-json-dts": "^1.2.0", "vitest": "^0.17.1", "vue-tsc": "^0.38.1" }, @@ -6558,6 +6559,43 @@ "node": ">= 4.0.0" } }, + "node_modules/unplugin": { + "version": "0.2.21", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-0.2.21.tgz", + "integrity": "sha512-IJ15/L5XbhnV7J09Zjk0FT5HEkBjkXucWAXQWRsmEtUxmmxwh23yavrmDbCF6ZPxWiVB28+wnKIHePTRRpQPbQ==", + "dev": true, + "dependencies": { + "webpack-virtual-modules": "^0.4.3" + }, + "peerDependencies": { + "rollup": "^2.50.0", + "vite": "^2.3.0", + "webpack": "4 || 5" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + }, + "vite": { + "optional": true + }, + "webpack": { + "optional": true + } + } + }, + "node_modules/unplugin-json-dts": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/unplugin-json-dts/-/unplugin-json-dts-1.2.0.tgz", + "integrity": "sha512-IDw1l9RV61CCK5khlayGaSUMti1NpPmhmdP2OiyvAZ+XxnJ1xOj8hGQRAJibSOh+emx2j9ahbFdP6KZ5iczwPA==", + "dev": true, + "dependencies": { + "unplugin": "^0.2.19" + }, + "engines": { + "node": ">=14.16" + } + }, "node_modules/upath": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", @@ -6935,6 +6973,12 @@ "node": ">=12" } }, + "node_modules/webpack-virtual-modules": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.4.4.tgz", + "integrity": "sha512-h9atBP/bsZohWpHnr+2sic8Iecb60GxftXsWNLLLSqewgIsGzByd2gcIID4nXcG+3tNe4GQG3dLcff3kXupdRA==", + "dev": true + }, "node_modules/whatwg-encoding": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", @@ -11878,6 +11922,24 @@ "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", "dev": true }, + "unplugin": { + "version": "0.2.21", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-0.2.21.tgz", + "integrity": "sha512-IJ15/L5XbhnV7J09Zjk0FT5HEkBjkXucWAXQWRsmEtUxmmxwh23yavrmDbCF6ZPxWiVB28+wnKIHePTRRpQPbQ==", + "dev": true, + "requires": { + "webpack-virtual-modules": "^0.4.3" + } + }, + "unplugin-json-dts": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/unplugin-json-dts/-/unplugin-json-dts-1.2.0.tgz", + "integrity": "sha512-IDw1l9RV61CCK5khlayGaSUMti1NpPmhmdP2OiyvAZ+XxnJ1xOj8hGQRAJibSOh+emx2j9ahbFdP6KZ5iczwPA==", + "dev": true, + "requires": { + "unplugin": "^0.2.19" + } + }, "upath": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", @@ -12135,6 +12197,12 @@ "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", "dev": true }, + "webpack-virtual-modules": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.4.4.tgz", + "integrity": "sha512-h9atBP/bsZohWpHnr+2sic8Iecb60GxftXsWNLLLSqewgIsGzByd2gcIID4nXcG+3tNe4GQG3dLcff3kXupdRA==", + "dev": true + }, "whatwg-encoding": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", diff --git a/package.json b/package.json index 914c19c..6bb5fc4 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "start": "vite", "dev": "vite", - "build": "vue-tsc --noEmit && vite build", + "build": "vite build", "preview": "vite preview", "test": "vitest run", "testw": "vitest", @@ -52,6 +52,7 @@ "jsdom": "^20.0.0", "prettier": "^2.5.1", "typescript": "^4.7.4", + "unplugin-json-dts": "^1.2.0", "vitest": "^0.17.1", "vue-tsc": "^0.38.1" }, diff --git a/src/alkatest-common b/src/alkatest-common index 5ff958f..5124699 160000 --- a/src/alkatest-common +++ b/src/alkatest-common @@ -1 +1 @@ -Subproject commit 5ff958fd80fbfc486d7fcf82540b364af02a80da +Subproject commit 5124699656d63321b761f074d2024a51f3481f1f diff --git a/src/components/SavesManager.vue b/src/components/SavesManager.vue index d734c59..bdf14c8 100644 --- a/src/components/SavesManager.vue +++ b/src/components/SavesManager.vue @@ -202,7 +202,7 @@ function exportSave(id: string) { } else { saveToExport = JSON.stringify(saves.value[id]); } - switch (projInfo.exportEncoding) { + switch (projInfo.exportEncoding as string) { default: console.warn(`Unknown save encoding: ${projInfo.exportEncoding}. Defaulting to lz`); case "lz": diff --git a/src/main.ts b/src/main.ts index 2d27dcc..5b00382 100644 --- a/src/main.ts +++ b/src/main.ts @@ -25,7 +25,7 @@ declare global { document.title = projInfo.title; window.projInfo = projInfo; -if (projInfo.id === "") { +if ((projInfo.id as string) === "") { throw "Project ID is empty! Please select a unique ID for this project in /src/data/projInfo.json"; } diff --git a/vite.config.ts b/vite.config.ts index 080d8e6..31e2ac5 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,6 +4,7 @@ import { defineConfig } from "vite"; import { VitePWA } from "vite-plugin-pwa"; import tsconfigPaths from "vite-tsconfig-paths"; import projInfo from "./src/data/projInfo.json"; +import jsonDts from "unplugin-json-dts/vite"; // https://vitejs.dev/config/ export default defineConfig({ @@ -29,6 +30,7 @@ export default defineConfig({ vueJsx({ // options are passed on to @vue/babel-plugin-jsx }), + jsonDts(), tsconfigPaths(), VitePWA({ includeAssets: ["Logo.svg", "favicon.ico", "robots.txt", "apple-touch-icon.png"],