Skip to content

Commit

Permalink
feat: add app version and name define
Browse files Browse the repository at this point in the history
  • Loading branch information
ziteh committed Dec 28, 2024
1 parent eaff738 commit c301e0b
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 4 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="/tabler-plug.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<title>Web Serial Monitor</title>

<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
Expand Down
1 change: 1 addition & 0 deletions public/tabler-plug.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/app-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ConnectionConfig from "@/components/connection-config";
export function AppSidebar() {
return (
<Sidebar>
<SidebarHeader>Web Serial Monitor</SidebarHeader>
<SidebarHeader>{__APP_NAME__} {__APP_VERSION__}</SidebarHeader>
<SidebarContent>
<SidebarGroup />
<ConnectionConfig />
Expand Down
2 changes: 1 addition & 1 deletion src/components/connection-config/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState } from "react";
import { useState } from "react";
import ConfigSelect from "./config-select";
import { Button } from "../ui/button";
import { SerialPortManager } from "@/lib/serialport";
Expand Down
3 changes: 3 additions & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
interface Navigator {
serial?: Serial;
}

declare const __APP_NAME__: string;
declare const __APP_VERSION__: string;
5 changes: 5 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "node:path";
import { version } from "./package.json";

// https://vite.dev/config/
export default defineConfig({
Expand All @@ -10,4 +11,8 @@ export default defineConfig({
"@": path.resolve(__dirname, "./src"),
},
},
define: {
__APP_NAME__: JSON.stringify("Web Serial Monitor"),
__APP_VERSION__: JSON.stringify(version),
},
});

0 comments on commit c301e0b

Please sign in to comment.