Skip to content

Commit

Permalink
clean up env for extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
acekyd committed Jan 23, 2025
1 parent 67783fa commit ae13849
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy-docs-and-extensions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
- name: Install dependencies and build extensions-site
working-directory: ./extensions-site
env:
REACT_APP_BASENAME: "/goose/v1/extensions" # Set the base URL here for the extensions site
run: |
npm install
npm run build
Expand Down
3 changes: 2 additions & 1 deletion extensions-site/app/mcp-servers.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import type { MCPServer } from '../types/server';

export async function fetchMCPServers(): Promise<MCPServer[]> {
const baseUrl = import.meta.env.REACT_APP_BASENAME || "";
try {
// Fetch all servers from the unified JSON file
const response = await fetch('./servers.json');
const response = await fetch(`${baseUrl}/servers.json`);
if (!response.ok) {
throw new Error('Failed to fetch servers');
}
Expand Down
3 changes: 2 additions & 1 deletion extensions-site/app/routes/detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ export default function DetailPage() {
const { id } = useParams();
const [server, setServer] = useState<Server | null>(null);
const [isCommandVisible, setIsCommandVisible] = useState(true);
const baseUrl = import.meta.env.REACT_APP_BASENAME || "";

useEffect(() => {
fetch("./servers.json")
fetch(`${baseUrl}/servers.json`)
.then((res) => res.json())
.then((servers) => {
const matchingServer = servers.find((s: Server) => s.id === id);
Expand Down
4 changes: 3 additions & 1 deletion extensions-site/react-router.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { Config } from "@react-router/dev/config";

const basename = process.env.REACT_APP_BASENAME || "";

export default {
basename: "/goose/v1/extensions",
basename,
ssr: false,
} satisfies Config;
4 changes: 3 additions & 1 deletion extensions-site/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import tailwindcss from "tailwindcss";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";

const basename = process.env.REACT_APP_BASENAME || "";

export default defineConfig({
base: '/goose/v1/extensions/',
base: basename,
css: {
postcss: {
plugins: [tailwindcss, autoprefixer],
Expand Down

0 comments on commit ae13849

Please sign in to comment.