diff --git a/apps/docs/components/Search.tsx b/apps/docs/components/Search.tsx index 6ad42b869..968d9eb09 100644 --- a/apps/docs/components/Search.tsx +++ b/apps/docs/components/Search.tsx @@ -7,10 +7,7 @@ import { useEffect, useRef, useState } from 'react' import { useHotkeys } from 'react-hotkeys-hook' import { Autocomplete, DropdownOption } from './Autocomplete' -const HOST_URL = - process.env.NODE_ENV === 'development' - ? 'http://localhost:3001' - : process.env.NEXT_PUBLIC_SITE_URL ?? 'https://tldraw.dev' +const HOST_URL = typeof location !== 'undefined' ? location.origin : 'https://tldraw.dev' export function Search() { const [searchType, setSearchType] = useState(SEARCH_TYPE.NORMAL) diff --git a/apps/docs/scripts/functions/fetchApiSource.ts b/apps/docs/scripts/functions/fetchApiSource.ts index 91b62601c..a75faa5d4 100644 --- a/apps/docs/scripts/functions/fetchApiSource.ts +++ b/apps/docs/scripts/functions/fetchApiSource.ts @@ -1,17 +1,13 @@ import fs from 'fs' -import { Octokit } from 'octokit' import path from 'path' import { TLDRAW_PACKAGES_TO_INCLUDE_IN_DOCS } from './package-list' -const octokit = new Octokit({ - auth: process.env.ACCESS_TOKEN, -}) - const { log: nicelog } = console export async function fetchApiSource() { try { const API_DIRECTORY = path.join(process.cwd(), 'api') + const REPO_ROOT = path.normalize(path.join(process.cwd(), '../../')) if (fs.existsSync(API_DIRECTORY)) { fs.rmSync(API_DIRECTORY, { recursive: true }) @@ -20,27 +16,9 @@ export async function fetchApiSource() { fs.mkdirSync(API_DIRECTORY) for (const folderName of TLDRAW_PACKAGES_TO_INCLUDE_IN_DOCS) { - const filePath = path.join(API_DIRECTORY, folderName + '.api.json') - - nicelog(`• Fetching API for ${folderName}...`) - - const res = await octokit.request('GET /repos/{owner}/{repo}/contents/{path}', { - owner: 'tldraw', - repo: 'tldraw', - path: `packages/${folderName}/api/api.json`, - branch: process.env.SOURCE_SHA || 'main', - headers: { - 'X-GitHub-Api-Version': '2022-11-28', - accept: 'application/vnd.github.VERSION.raw', - }, - }) - - if (res.status === 200) { - nicelog(`• Writing ${filePath}...`) - fs.writeFileSync(filePath, (res as any).data) - } else { - throw Error(`x Could not get API for ${folderName}.`) - } + const fromPath = path.join(REPO_ROOT, 'packages', folderName, 'api', 'api.json') + const toPath = path.join(API_DIRECTORY, folderName + '.api.json') + fs.copyFileSync(fromPath, toPath) } nicelog('✔ Complete!') diff --git a/apps/docs/scripts/functions/fetchReleases.ts b/apps/docs/scripts/functions/fetchReleases.ts index e61e3a8bd..b8bf59dc7 100644 --- a/apps/docs/scripts/functions/fetchReleases.ts +++ b/apps/docs/scripts/functions/fetchReleases.ts @@ -2,9 +2,7 @@ import fs from 'fs' import { Octokit } from 'octokit' import path from 'path' -const octokit = new Octokit({ - auth: process.env.ACCESS_TOKEN, -}) +const octokit = new Octokit({}) const { log: nicelog } = console diff --git a/scripts/vercel/build-docs.sh b/scripts/vercel/build-docs.sh index 5223be3ce..43dc3c4a2 100755 --- a/scripts/vercel/build-docs.sh +++ b/scripts/vercel/build-docs.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash set -eux +yarn run -T lazy refresh-everything --filter=apps/docs yarn run -T lazy build --filter=apps/docs \ No newline at end of file