diff --git a/.env.example b/.env.example index 046f296..51aac93 100644 --- a/.env.example +++ b/.env.example @@ -13,3 +13,9 @@ VITE_OWNER_NPUB= # wss://relay.damus.io,wss://nos.lol,wss://relay.nostr.band # The submission succeeds if at least one relay accepts the event. VITE_NOSTR_RELAYS= + +# Optional. Set to "true" to expose in-progress preview tooling on a +# production build — the palette picker today, future debug overlays +# or unfinished pages tomorrow. Gated through useDevTools(); unset +# (or anything other than "true") strips them. +VITE_DEV_TOOLS= diff --git a/env.d.ts b/env.d.ts index ad3afc1..d834bab 100644 --- a/env.d.ts +++ b/env.d.ts @@ -5,6 +5,10 @@ interface ImportMetaEnv { readonly VITE_OWNER_NPUB?: string /** Comma-separated wss:// relay list; falls back to a default set if unset. */ readonly VITE_NOSTR_RELAYS?: string + /** When set to 'true', in-progress preview tooling (the palette + * picker today, future debug overlays / unfinished pages) renders + * in any build. Gated via useDevTools(). */ + readonly VITE_DEV_TOOLS?: string } interface ImportMeta { diff --git a/src/components/layout/AppLayout.vue b/src/components/layout/AppLayout.vue index d32127c..540f8ec 100644 --- a/src/components/layout/AppLayout.vue +++ b/src/components/layout/AppLayout.vue @@ -4,8 +4,9 @@ import { Toaster } from '@/components/ui/sonner' import SiteHeader from './SiteHeader.vue' import SiteFooter from './SiteFooter.vue' import PaletteSwitcher from './PaletteSwitcher.vue' +import { useDevTools } from '@/composables/useDevTools' -const isDev = import.meta.env.DEV +const { enabled: devTools } = useDevTools() diff --git a/src/composables/useDevTools.ts b/src/composables/useDevTools.ts new file mode 100644 index 0000000..1dae8d7 --- /dev/null +++ b/src/composables/useDevTools.ts @@ -0,0 +1,14 @@ +/** + * True when the build should expose in-progress / preview tooling + * (the palette picker, future debug overlays, unfinished pages, etc.). + * + * Always true in local `pnpm dev` (Vite sets `import.meta.env.DEV`). + * Otherwise opted-in by setting `VITE_DEV_TOOLS=true` at build time — + * useful for a deployed preview the client uses to evaluate + * in-progress work. + */ +export function useDevTools() { + const enabled = + import.meta.env.DEV || import.meta.env.VITE_DEV_TOOLS === 'true' + return { enabled } +}