atmosphere explorer pds.ls
tool typescript atproto
427
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 69 lines 2.0 kB view raw
1import tailwindcss from "@tailwindcss/vite"; 2import { execSync } from "child_process"; 3import { defineConfig } from "vite"; 4import solidPlugin from "vite-plugin-solid"; 5import metadata from "./public/oauth-client-metadata.json"; 6 7const SERVER_HOST = "127.0.0.1"; 8const SERVER_PORT = 13213; 9 10const getVersion = (): string => { 11 try { 12 const describe = execSync("git describe --tags --long --dirty --always").toString().trim(); 13 14 const match = describe.match(/^v?(.+?)-(\d+)-g([a-f0-9]+)(-dirty)?$/); 15 16 if (match) { 17 const [, version, commits, hash, dirty] = match; 18 if (commits === "0") { 19 return `v${version}${dirty ? "-dirty" : ""}`; 20 } 21 return `v${version}.dev${commits}+g${hash}${dirty ? "-dirty" : ""}`; 22 } 23 24 return `v0.0.0.dev+g${describe}`; 25 } catch { 26 return "v0.0.0-unknown"; 27 } 28}; 29 30export default defineConfig({ 31 plugins: [ 32 tailwindcss(), 33 solidPlugin(), 34 { 35 name: "oauth", 36 config(_conf, { command }) { 37 if (command === "build") { 38 process.env.VITE_OAUTH_CLIENT_ID = metadata.client_id; 39 process.env.VITE_OAUTH_REDIRECT_URL = metadata.redirect_uris[0]; 40 } else { 41 const redirectUri = ((): string => { 42 const url = new URL(metadata.redirect_uris[0]); 43 return `http://${SERVER_HOST}:${SERVER_PORT}${url.pathname}`; 44 })(); 45 46 const clientId = 47 `http://localhost` + 48 `?redirect_uri=${encodeURIComponent(redirectUri)}` + 49 `&scope=${encodeURIComponent(metadata.scope)}`; 50 51 process.env.VITE_DEV_SERVER_PORT = "" + SERVER_PORT; 52 process.env.VITE_OAUTH_CLIENT_ID = clientId; 53 process.env.VITE_OAUTH_REDIRECT_URL = redirectUri; 54 } 55 56 process.env.VITE_CLIENT_URI = metadata.client_uri; 57 process.env.VITE_OAUTH_SCOPE = metadata.scope; 58 process.env.VITE_APP_VERSION = getVersion(); 59 }, 60 }, 61 ], 62 server: { 63 host: SERVER_HOST, 64 port: SERVER_PORT, 65 }, 66 build: { 67 target: "esnext", 68 }, 69});