feat: display current version

This commit is contained in:
kunish 2023-09-03 18:16:09 +08:00
parent 0a8312d87c
commit 1765adacda
No known key found for this signature in database
GPG Key ID: 647A12B4F782C430
7 changed files with 17 additions and 3 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "metacubexd", "name": "metacubexd",
"version": "1.58.0", "version": "1.58.0",
"description": "Clash-Meta Dashboard", "description": "Clash.Meta Dashboard, The Official One, XD",
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
"scripts": { "scripts": {

View File

@ -156,11 +156,11 @@ export const Header = () => {
</div> </div>
<a <a
class="text-xl font-bold normal-case" class="whitespace-nowrap text-xl font-bold uppercase"
href="https://github.com/metacubex/metacubexd" href="https://github.com/metacubex/metacubexd"
target="_blank" target="_blank"
> >
metacubexd metacube, xd
</a> </a>
</div> </div>

View File

@ -340,6 +340,8 @@ export default () => {
<DNSQueryForm /> <DNSQueryForm />
<ConfigForm /> <ConfigForm />
<ConfigForXd /> <ConfigForXd />
{import.meta.env.version}
</div> </div>
) )
} }

7
src/vite-env.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
interface ImportMetaEnv {
readonly version: string
}
interface ImportMeta {
readonly env: ImportMetaEnv
}

View File

@ -4,6 +4,7 @@
"target": "ESNext", "target": "ESNext",
"module": "ESNext", "module": "ESNext",
"moduleResolution": "node", "moduleResolution": "node",
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"esModuleInterop": true, "esModuleInterop": true,
"jsx": "preserve", "jsx": "preserve",

View File

@ -1,11 +1,15 @@
import { defineConfig, splitVendorChunkPlugin } from 'vite' import { defineConfig, splitVendorChunkPlugin } from 'vite'
import { VitePWA } from 'vite-plugin-pwa' import { VitePWA } from 'vite-plugin-pwa'
import solidPlugin from 'vite-plugin-solid' import solidPlugin from 'vite-plugin-solid'
import pkgJSON from './package.json'
export default defineConfig({ export default defineConfig({
base: './', base: './',
build: { chunkSizeWarningLimit: 1000 }, build: { chunkSizeWarningLimit: 1000 },
resolve: { alias: { '~': '/src' } }, resolve: { alias: { '~': '/src' } },
define: {
'import.meta.env.version': JSON.stringify(pkgJSON.version),
},
plugins: [ plugins: [
solidPlugin(), solidPlugin(),
splitVendorChunkPlugin(), splitVendorChunkPlugin(),