diff --git a/package.json b/package.json
index 9e3856cdb..a7a497b5d 100644
--- a/package.json
+++ b/package.json
@@ -138,6 +138,7 @@
"tailwindcss": "^3.3.6",
"vite": "^4.5.2",
"vite-plugin-eslint": "^1.8.1",
+ "vite-plugin-package-version": "^1.1.0",
"vite-tsconfig-paths": "^4.2.1",
"wait-on": "^7.2.0",
"yarn": "^1.22.19"
diff --git a/playwright.config.ts b/playwright.config.ts
index 3458f75f3..ad16f97aa 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -1,4 +1,4 @@
-import { defineConfig, devices } from '@playwright/test';
+import { defineConfig, devices } from '@playwright/test'
/**
* Read environment variables from file.
@@ -78,5 +78,4 @@ export default defineConfig({
// url: 'http://127.0.0.1:3000',
reuseExistingServer: !process.env.CI,
},
-});
-
+})
\ No newline at end of file
diff --git a/src/routes/Settings.tsx b/src/routes/Settings.tsx
index 9f524858f..ac999cb15 100644
--- a/src/routes/Settings.tsx
+++ b/src/routes/Settings.tsx
@@ -31,6 +31,7 @@ import { sep } from '@tauri-apps/api/path'
import { bracket } from 'lib/exampleKcl'
export const Settings = () => {
+ const APP_VERSION = import.meta.env.PACKAGE_VERSION || 'unknown'
const loaderData =
(useRouteLoaderData(paths.FILE) as IndexLoaderData) || undefined
const navigate = useNavigate()
@@ -118,7 +119,7 @@ export const Settings = () => {
Close
-
+
User Settings
Don't see the feature you want? Check to see if it's on{' '}
@@ -304,6 +305,18 @@ export const Settings = () => {
Replay Onboarding
+
+ {/* This uses a Vite plugin, set in vite.config.ts
+ to inject the version from package.json */}
+ App version {APP_VERSION}.{' '}
+
+ View release on GitHub
+
+
)
diff --git a/tsconfig.json b/tsconfig.json
index 008bd16ce..56b80659c 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -27,7 +27,8 @@
},
"include": [
"src",
- "e2e"
+ "e2e",
+ "./*.ts"
],
"references": [{ "path": "./tsconfig.node.json" }]
}
diff --git a/vite-env.d.ts b/vite-env.d.ts
index 11f02fe2a..54eaa0722 100644
--- a/vite-env.d.ts
+++ b/vite-env.d.ts
@@ -1 +1,3 @@
///
+
+declare const __APP_VERSION__: string
diff --git a/vite.config.ts b/vite.config.ts
index 82bfbf355..9ed032653 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -2,7 +2,8 @@ import react from '@vitejs/plugin-react'
import viteTsconfigPaths from 'vite-tsconfig-paths'
import eslint from 'vite-plugin-eslint'
import dns from 'dns'
-import { defineConfig, configDefaults } from 'vitest/config';
+import { defineConfig, configDefaults } from 'vitest/config'
+import version from 'vite-plugin-package-version'
// Only needed because we run Node < 17
// and we want to open `localhost` not `127.0.0.1` on server start
@@ -30,7 +31,8 @@ const config = defineConfig({
react(),
viteTsconfigPaths(),
eslint(),
- ],
+ version(),
+ ]
})
export default config
\ No newline at end of file
diff --git a/yarn.lock b/yarn.lock
index 1837bafa5..88728edf1 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -8174,6 +8174,11 @@ vite-plugin-eslint@^1.8.1:
"@types/eslint" "^8.4.5"
rollup "^2.77.2"
+vite-plugin-package-version@^1.1.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/vite-plugin-package-version/-/vite-plugin-package-version-1.1.0.tgz#7d8088955aa21e4ec93353c98992b3f58c4bf13c"
+ integrity sha512-TPoFZXNanzcaKCIrC3e2L/TVRkkRLB6l4RPN/S7KbG7rWfyLcCEGsnXvxn6qR7fyZwXalnnSN/I9d6pSFjHpEA==
+
vite-tsconfig-paths@^4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/vite-tsconfig-paths/-/vite-tsconfig-paths-4.2.1.tgz#e53b89096b91d31a6d1e26f75999ea8c336a89ed"