From 65334916a10940524629263b3a53466c1447ffb9 Mon Sep 17 00:00:00 2001 From: incognitotgt Date: Sun, 14 Apr 2024 16:58:06 -0400 Subject: [PATCH] get ready for production --- ephemeral | 2 -- index.ts | 14 -------------- package.json | 2 +- src/components/loading-suspense.tsx | 10 ++++++++++ src/components/theme-provider.tsx | 11 ++++------- src/main.tsx | 12 +++--------- src/routes.tsx | 3 +-- tailwind.config.ts | 4 ++-- 8 files changed, 21 insertions(+), 37 deletions(-) delete mode 100755 ephemeral create mode 100644 src/components/loading-suspense.tsx diff --git a/ephemeral b/ephemeral deleted file mode 100755 index 3dc7cb2..0000000 --- a/ephemeral +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env tsx -await import("./index.ts") diff --git a/index.ts b/index.ts index 021b522..76c6559 100755 --- a/index.ts +++ b/index.ts @@ -13,19 +13,6 @@ const port = process.env.PORT || (argv.includes("--port") && argv[argv.indexOf("--port") + 1]) || 8080; -process.chdir(import.meta.url.replace("file://", "").replace("index.ts", "")); -if (argv.includes("-h") || argv.includes("--help")) { - console.log(` -\x1b[34;49mEphemeral -\x1b[37;49m -default: Run in production mode ---port : Specify the port to run on ---dev: Run in development mode ---help, -h: Display this help message ---masqr: Enable masqr - `); - process.exit(0); -} const vite = await createViteServer({ server: { middlewareMode: true }, }); @@ -42,7 +29,6 @@ app.use(express.static("dist")); app.get("*", (_, response) => { response.sendFile(path.resolve("dist", "index.html")); }); -vite.bindCLIShortcuts({ print: true }); const server = createServer(); server.on("request", devMode ? vite.middlewares : app); server.on("upgrade", (req, socket: Socket, head) => { diff --git a/package.json b/package.json index d4bd740..9587d67 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ephemeral", "private": true, - "version": "0.9.5", + "version": "1.0.0", "type": "module", "scripts": { "preinstall": "npx only-allow pnpm", diff --git a/src/components/loading-suspense.tsx b/src/components/loading-suspense.tsx new file mode 100644 index 0000000..0fc5b59 --- /dev/null +++ b/src/components/loading-suspense.tsx @@ -0,0 +1,10 @@ +import { Loader2 } from "lucide-react"; + +export default function LoadSuspense() { + return ( +
+ +

Ephemeral is loading

+
+ ); +} diff --git a/src/components/theme-provider.tsx b/src/components/theme-provider.tsx index 696ee3d..8fcf8ec 100644 --- a/src/components/theme-provider.tsx +++ b/src/components/theme-provider.tsx @@ -1,6 +1,6 @@ import { createContext, useContext, useEffect, useState } from "react"; -export type Theme = +type Theme = | "light" | "dark" | "zinc" @@ -10,8 +10,7 @@ export type Theme = | "frappe" | "latte" | "system"; -// eslint-disable-next-line -export const themes: Theme[] = [ +const themes: Theme[] = [ "light", "dark", "zinc", @@ -44,7 +43,7 @@ const ThemeProviderContext = createContext(initialState); export function ThemeProvider({ children, defaultTheme = "system", - storageKey = "vite-ui-theme", + storageKey = "ephemeral-ui-theme", ...props }: ThemeProviderProps) { const [theme, setTheme] = useState( @@ -54,9 +53,7 @@ export function ThemeProvider({ useEffect(() => { const root = window.document.documentElement; - themes.forEach((theme) => { - root.classList.remove(theme); - }); + themes.forEach((theme) => root.classList.remove(theme)); if (theme === "system") { const systemTheme = window.matchMedia("(prefers-color-scheme: dark)") diff --git a/src/main.tsx b/src/main.tsx index eee9822..dbd10f2 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -5,22 +5,16 @@ import ReactDOM from "react-dom/client"; import "@/index.css"; // routes const AppRoutes = lazy(() => import("@/routes")); +// components +import LoadSuspense from "@/components/loading-suspense"; // providers import { ThemeProvider } from "@/components/theme-provider"; import { HelmetProvider } from "react-helmet-async"; -import { Loader2 } from "lucide-react"; export default function App() { return ( - - -

Ephemeral is loading

- - } - > + }>
diff --git a/src/routes.tsx b/src/routes.tsx index bc2b612..51c92a8 100644 --- a/src/routes.tsx +++ b/src/routes.tsx @@ -55,8 +55,7 @@ export default function AppRoutes() { const [config] = useConfig("proxy"); useEffect(() => { if ("serviceWorker" in navigator) { - navigator.serviceWorker.ready.then((registration) => { - BareMux.registerRemoteListener(registration.active); + navigator.serviceWorker.ready.then(() => { BareMux.SetTransport(transports[config.transport], { wisp: config.wispServer, }); diff --git a/tailwind.config.ts b/tailwind.config.ts index 6ea8808..f025b77 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -1,6 +1,6 @@ import type { Config } from "tailwindcss"; -const config = { +const config: Config = { darkMode: ["class"], content: [ "./pages/**/*.{ts,tsx}", @@ -78,6 +78,6 @@ const config = { }, }, plugins: [require("tailwindcss-animate")], -} satisfies Config; +}; export default config;