feat(nx-dev): Add canary index (#25982)

This PR updates the Algolia search feature to now point to a canary
index for the master branch.

Adding a `.env.local` file allows local development off master.

I also added env vars to Vercel for both `master` and `website-19` to
point to `nx-canary-production` and `nx-production` respectively.
This commit is contained in:
Nicholas Cunningham 2024-05-24 11:49:29 -06:00 committed by GitHub
parent 9d6e5ad48c
commit af463c4833
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View File

@ -83,15 +83,15 @@ export function AlgoliaSearch({
type="button" type="button"
ref={searchButtonRef} ref={searchButtonRef}
onClick={handleOpen} onClick={handleOpen}
className="flex w-full items-center rounded-md bg-white py-1.5 px-2 text-sm leading-4 ring-1 ring-slate-300 transition dark:bg-slate-700 dark:ring-slate-900" className="flex w-full items-center rounded-md bg-white px-2 py-1.5 text-sm leading-4 ring-1 ring-slate-300 transition dark:bg-slate-700 dark:ring-slate-900"
> >
<MagnifyingGlassIcon className="h-4 w-4 flex-none" /> <MagnifyingGlassIcon className="h-4 w-4 flex-none" />
<span className="mx-3 inline-flex text-xs text-slate-300 dark:text-slate-400 md:text-sm"> <span className="mx-3 inline-flex text-xs text-slate-300 md:text-sm dark:text-slate-400">
Search Search
</span> </span>
<span <span
style={{ opacity: browserDetected ? '1' : '0' }} style={{ opacity: browserDetected ? '1' : '0' }}
className="ml-auto hidden flex-none rounded-md border border-slate-200 bg-slate-50 px-1 py-0.5 text-xs font-semibold text-slate-500 dark:border-slate-700 dark:bg-slate-800/60 md:block" className="ml-auto hidden flex-none rounded-md border border-slate-200 bg-slate-50 px-1 py-0.5 text-xs font-semibold text-slate-500 md:block dark:border-slate-700 dark:bg-slate-800/60"
> >
<span className="sr-only">Press </span> <span className="sr-only">Press </span>
<kbd className="font-sans"> <kbd className="font-sans">
@ -140,9 +140,9 @@ export function AlgoliaSearch({
placeholder="Search the docs" placeholder="Search the docs"
initialScrollY={window.scrollY} initialScrollY={window.scrollY}
onClose={handleClose} onClose={handleClose}
indexName="nx-production" indexName={`${process.env.NEXT_PUBLIC_SEARCH_INDEX}`}
apiKey="f49a1eb671385f0472a7285556168930" apiKey={`${process.env.NEXT_PUBLIC_SEARCH_API_KEY}`}
appId="PCTGM1JTQL" appId={`${process.env.NEXT_PUBLIC_SEARCH_APP_ID}`}
navigator={{ navigator={{
navigate({ itemUrl }) { navigate({ itemUrl }) {
setIsOpen(false); setIsOpen(false);

3
nx-dev/nx-dev/.env.local Normal file
View File

@ -0,0 +1,3 @@
NEXT_PUBLIC_SEARCH_INDEX=nx-canary-production
NEXT_PUBLIC_SEARCH_API_KEY=07340b85db83fd49c1f904f883cc3ef8
NEXT_PUBLIC_SEARCH_APP_ID=PCTGM1JTQL