diff --git a/build.mjs b/build.mjs index 8521d2b..1ed67b9 100644 --- a/build.mjs +++ b/build.mjs @@ -1,5 +1,6 @@ import * as esbuild from 'esbuild'; import { copy } from 'esbuild-plugin-copy'; +import { replace } from 'esbuild-plugin-replace'; const options = { entryPoints: ['src/index.tsx', 'src/index.html'], @@ -31,6 +32,9 @@ const options = { }, watch: true, }), + replace({ + __MATOMO_TRACKING_HOST: process.env.MATOMO_TRACKING_HOST || 'localhost', + }), ], }; diff --git a/package-lock.json b/package-lock.json index 26c3b4a..f457e4e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "@trivago/prettier-plugin-sort-imports": "^4.3.0", "esbuild": "0.19.10", "esbuild-plugin-copy": "^2.1.1", + "esbuild-plugin-replace": "^1.4.0", "prettier": "^3.1.1", "typescript": "5.0.4" } @@ -1517,6 +1518,15 @@ "node": ">=8" } }, + "node_modules/esbuild-plugin-replace": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esbuild-plugin-replace/-/esbuild-plugin-replace-1.4.0.tgz", + "integrity": "sha512-lP3ZAyzyRa5JXoOd59lJbRKNObtK8pJ/RO7o6vdjwLi71GfbL32NR22ZuS7/cLZkr10/L1lutoLma8E4DLngYg==", + "dev": true, + "dependencies": { + "magic-string": "^0.25.7" + } + }, "node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -1901,6 +1911,15 @@ "three": ">=0.144.0" } }, + "node_modules/magic-string": { + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "dev": true, + "dependencies": { + "sourcemap-codec": "^1.4.8" + } + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -2320,6 +2339,13 @@ "node": ">=0.10.0" } }, + "node_modules/sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "deprecated": "Please use @jridgewell/sourcemap-codec instead", + "dev": true + }, "node_modules/stats-gl": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/stats-gl/-/stats-gl-2.0.1.tgz", @@ -3574,6 +3600,15 @@ } } }, + "esbuild-plugin-replace": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esbuild-plugin-replace/-/esbuild-plugin-replace-1.4.0.tgz", + "integrity": "sha512-lP3ZAyzyRa5JXoOd59lJbRKNObtK8pJ/RO7o6vdjwLi71GfbL32NR22ZuS7/cLZkr10/L1lutoLma8E4DLngYg==", + "dev": true, + "requires": { + "magic-string": "^0.25.7" + } + }, "escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -3864,6 +3899,15 @@ "integrity": "sha512-zQ2xd7dNOIVTjAS+hj22fyj1EFYmOJX6tzKjZ92r6WDoq8hyFxjuGA2q950tmR4iC/EKXoMQdSipkaJVuUHDTg==", "requires": {} }, + "magic-string": { + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "dev": true, + "requires": { + "sourcemap-codec": "^1.4.8" + } + }, "merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -4144,6 +4188,12 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==" }, + "sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "dev": true + }, "stats-gl": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/stats-gl/-/stats-gl-2.0.1.tgz", diff --git a/package.json b/package.json index 05f7930..e515299 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "@trivago/prettier-plugin-sort-imports": "^4.3.0", "esbuild": "0.19.10", "esbuild-plugin-copy": "^2.1.1", + "esbuild-plugin-replace": "^1.4.0", "prettier": "^3.1.1", "typescript": "5.0.4" }, diff --git a/src/index.html b/src/index.html index 10617c3..c2fea2c 100644 --- a/src/index.html +++ b/src/index.html @@ -12,5 +12,34 @@
+ + + + + +