Skip to content

Commit 8c1a4a8

Browse files
authored
Fix Algolia env vars (#1106)
1 parent 585b1a6 commit 8c1a4a8

File tree

4 files changed

+65
-71
lines changed

4 files changed

+65
-71
lines changed

docs/astro.config.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,11 @@ import react from "@astrojs/react";
66
export default defineConfig({
77
integrations: [preact(), react()],
88
site: `https://openapi-typescript.pages.dev`,
9-
vite: {},
9+
vite: {
10+
define: {
11+
"import.meta.env.VITE_ALGOLIA_APP_ID": JSON.stringify(process.env.ALGOLIA_APP_ID ?? ""),
12+
"import.meta.env.VITE_ALGOLIA_INDEX_NAME": JSON.stringify(process.env.ALGOLIA_INDEX_NAME ?? ""),
13+
"import.meta.env.VITE_ALGOLIA_SEARCH_KEY": JSON.stringify(process.env.ALGOLIA_SEARCH_KEY ?? ""),
14+
},
15+
},
1016
});

docs/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
"@astrojs/react": "^2.1.3",
1313
"@docsearch/css": "^3.3.4",
1414
"@docsearch/react": "^3.3.4",
15-
"@types/node": "^18.16.3",
16-
"@types/react": "^18.2.5",
17-
"@types/react-dom": "^18.2.3",
18-
"astro": "^2.4.1",
15+
"@types/react": "^18.2.6",
16+
"@types/react-dom": "^18.2.4",
17+
"astro": "^2.4.3",
1918
"preact": "^10.13.2",
2019
"react": "^18.2.0",
2120
"react-dom": "^18.2.0",
2221
"sass": "^1.62.1"
2322
},
2423
"devDependencies": {
24+
"@types/node": "^20.1.1",
2525
"html-escaper": "^3.0.3",
2626
"typescript": "^5.0.4"
2727
}

docs/src/components/Header/Search.tsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import * as docSearchReact from "@docsearch/react";
88

99
/** FIXME: This is still kinda nasty, but DocSearch is not ESM ready. */
1010
const DocSearchModal = docSearchReact.DocSearchModal || (docSearchReact as any).default.DocSearchModal;
11-
const useDocSearchKeyboardEvents =
12-
docSearchReact.useDocSearchKeyboardEvents || (docSearchReact as any).default.useDocSearchKeyboardEvents;
11+
const useDocSearchKeyboardEvents = docSearchReact.useDocSearchKeyboardEvents || (docSearchReact as any).default.useDocSearchKeyboardEvents;
1312

1413
export default function Search() {
1514
const [isOpen, setIsOpen] = useState(false);
@@ -44,13 +43,7 @@ export default function Search() {
4443
<>
4544
<button type="button" ref={searchButtonRef} onClick={onOpen} className="search-input">
4645
<svg className="search-icon" viewBox="0 0 24 24" fill="none">
47-
<path
48-
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
49-
stroke="currentColor"
50-
strokeWidth="2"
51-
strokeLinecap="round"
52-
strokeLinejoin="round"
53-
/>
46+
<path d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
5447
</svg>
5548

5649
<span>Search</span>
@@ -70,9 +63,9 @@ export default function Search() {
7063
initialQuery={initialQuery}
7164
initialScrollY={window.scrollY}
7265
onClose={onClose}
73-
indexName={import.meta.env.ALGOLIA_INDEX_NAME}
74-
appId={import.meta.env.ALGOLIA_APP_ID}
75-
apiKey={import.meta.env.ALGOLIA_SEARCH_KEY}
66+
indexName={import.meta.env.VITE_ALGOLIA_INDEX_NAME}
67+
appId={import.meta.env.VITE_ALGOLIA_APP_ID}
68+
apiKey={import.meta.env.VITE_ALGOLIA_SEARCH_KEY}
7669
transformItems={(items) => {
7770
return items.map((item) => {
7871
// We transform the absolute URL into a relative URL to

pnpm-lock.yaml

Lines changed: 49 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)