diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..b7c356a --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +# Allows us to upgrade to React 19 -- remove when @docsearch/react updates +legacy-peer-deps=true \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 52c350b..89c8a02 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ FROM base as deps WORKDIR /myapp -ADD package.json package-lock.json ./ +ADD package.json package-lock.json .npmrc ./ RUN npm install --production=false # Setup production node_modules @@ -18,7 +18,7 @@ FROM base as production-deps WORKDIR /myapp COPY --from=deps /myapp/node_modules /myapp/node_modules -ADD package.json package-lock.json ./ +ADD package.json package-lock.json .npmrc ./ RUN npm prune --production # Build the app diff --git a/app/components/doc-layout.tsx b/app/components/doc-layout.tsx index e5cab98..3a3ac40 100644 --- a/app/components/doc-layout.tsx +++ b/app/components/doc-layout.tsx @@ -5,6 +5,7 @@ import { LargeOnThisPage, SmallOnThisPage } from "./on-this-page"; export function DocLayout({ doc }: { doc: Doc }) { let ref = useRef(null); + useDelegatedReactRouterLinks(ref); return ( diff --git a/app/components/on-this-page.tsx b/app/components/on-this-page.tsx index ce39a06..9f12e66 100644 --- a/app/components/on-this-page.tsx +++ b/app/components/on-this-page.tsx @@ -9,7 +9,7 @@ export function LargeOnThisPage({ mdRef, }: { doc: Doc; - mdRef: React.RefObject; + mdRef: React.RefObject; }) { const navRef = useRef(null); const [activeHeading, setActiveHeading] = useState(""); diff --git a/app/modules/docsearch.tsx b/app/modules/docsearch.tsx index 6654d61..0ef4311 100644 --- a/app/modules/docsearch.tsx +++ b/app/modules/docsearch.tsx @@ -32,7 +32,7 @@ let docSearchProps = { const DocSearchContext = createContext<{ onOpen: () => void; - searchButtonRef: React.RefObject; + searchButtonRef: React.RefObject; } | null>(null); /** @@ -63,6 +63,7 @@ export function DocSearch({ children }: { children: React.ReactNode }) { onOpen, onClose, onInput, + // @ts-expect-error docsearch types are not updated for react 19 searchButtonRef, }); diff --git a/app/root.tsx b/app/root.tsx index 832565b..747ac4d 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -83,9 +83,7 @@ export function Layout({ children }: { children: React.ReactNode }) { hidden // this img tag simply forces the icons to be loaded at a higher // priority than the scripts (chrome only for now) - // @ts-expect-error React forces you to set fetchpriority to lowercase - // eslint-disable-next-line react/no-unknown-property - fetchpriority="high" + fetchPriority="high" /> {children} diff --git a/app/ui/delegate-markdown-links.ts b/app/ui/delegate-markdown-links.ts index 6e5e911..811ec95 100644 --- a/app/ui/delegate-markdown-links.ts +++ b/app/ui/delegate-markdown-links.ts @@ -1,7 +1,9 @@ import * as React from "react"; import { useNavigate } from "react-router"; -function useDelegatedReactRouterLinks(nodeRef: React.RefObject) { +function useDelegatedReactRouterLinks( + nodeRef: React.RefObject +) { let navigate = useNavigate(); React.useEffect(() => { diff --git a/app/ui/utils.ts b/app/ui/utils.ts index 9bfeced..7f50eaa 100644 --- a/app/ui/utils.ts +++ b/app/ui/utils.ts @@ -12,7 +12,9 @@ export function useHydrated() { return hydrated; } -export function useCodeBlockCopyButton(ref: React.RefObject) { +export function useCodeBlockCopyButton( + ref: React.RefObject +) { let location = useLocation(); useEffect(() => { let container = ref.current; diff --git a/package-lock.json b/package-lock.json index 8cf0fcf..1507ee0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,8 +24,8 @@ "octokit": "^2.0.14", "parse-link-header": "^2.0.0", "parse-numeric-range": "^1.3.0", - "react": "^18.3.1", - "react-dom": "^18.3.1", + "react": "^19.0.0", + "react-dom": "^19.0.0", "react-router": "7.0.1", "rehype-autolink-headings": "^7.1.0", "rehype-slug": "^6.0.0", @@ -53,8 +53,8 @@ "@types/lodash.merge": "^4.6.7", "@types/node": "^18.16.3", "@types/parse-link-header": "^2.0.1", - "@types/react": "^18.2.5", - "@types/react-dom": "^18.2.3", + "@types/react": "^19.0.1", + "@types/react-dom": "^19.0.2", "@types/semver": "^7.3.13", "@types/tar": "^6.1.4", "@types/tar-stream": "^2.2.2", @@ -2523,32 +2523,24 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/prop-types": { - "version": "15.7.13", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.13.tgz", - "integrity": "sha512-hCZTSvwbzWGvhqxp/RqVqwU999pBf2vp7hzIjiYOsl8wqOmUxkQ6ddw1cV3l8811+kdUFus/q4d1Y3E3SyEifA==", - "devOptional": true, - "license": "MIT" - }, "node_modules/@types/react": { - "version": "18.3.9", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.9.tgz", - "integrity": "sha512-+BpAVyTpJkNWWSSnaLBk6ePpHLOGJKnEQNbINNovPWzvEUyAe3e+/d494QdEh71RekM/qV7lw6jzf1HGrJyAtQ==", - "devOptional": true, + "version": "19.0.1", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.0.1.tgz", + "integrity": "sha512-YW6614BDhqbpR5KtUYzTA+zlA7nayzJRA9ljz9CQoxthR0sDisYZLuvSMsil36t4EH/uAt8T52Xb4sVw17G+SQ==", + "dev": true, "license": "MIT", "dependencies": { - "@types/prop-types": "*", "csstype": "^3.0.2" } }, "node_modules/@types/react-dom": { - "version": "18.3.0", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.0.tgz", - "integrity": "sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==", + "version": "19.0.2", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.0.2.tgz", + "integrity": "sha512-c1s+7TKFaDRRxr1TxccIX2u7sfCnc3RxkVyBIUA2lCpyqCF+QoAwQ/CBg7bsMdVwP120HEH143VQezKtef5nCg==", "dev": true, "license": "MIT", - "dependencies": { - "@types/react": "*" + "peerDependencies": { + "@types/react": "^19.0.0" } }, "node_modules/@types/semver": { @@ -4498,7 +4490,7 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "devOptional": true, + "dev": true, "license": "MIT" }, "node_modules/damerau-levenshtein": { @@ -7834,6 +7826,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, "license": "MIT" }, "node_modules/js-yaml": { @@ -8192,6 +8185,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, "license": "MIT", "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" @@ -14281,28 +14275,24 @@ } }, "node_modules/react": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", - "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/react/-/react-19.0.0.tgz", + "integrity": "sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==", "license": "MIT", - "dependencies": { - "loose-envify": "^1.1.0" - }, "engines": { "node": ">=0.10.0" } }, "node_modules/react-dom": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", - "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.0.0.tgz", + "integrity": "sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ==", "license": "MIT", "dependencies": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.2" + "scheduler": "^0.25.0" }, "peerDependencies": { - "react": "^18.3.1" + "react": "^19.0.0" } }, "node_modules/react-is": { @@ -15589,20 +15579,10 @@ "license": "MIT" }, "node_modules/scheduler": { - "version": "0.23.2", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", - "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", - "license": "MIT", - "dependencies": { - "loose-envify": "^1.1.0" - } - }, - "node_modules/search-insights": { - "version": "2.17.3", - "resolved": "https://registry.npmjs.org/search-insights/-/search-insights-2.17.3.tgz", - "integrity": "sha512-RQPdCYTa8A68uM2jwxoY842xDhvx3E5LFL1LxvxCNMev4o5mLuokczhzjAgGwUZBAmOKZknArSxLKmXtIi2AxQ==", - "license": "MIT", - "peer": true + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.25.0.tgz", + "integrity": "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==", + "license": "MIT" }, "node_modules/section-matter": { "version": "1.0.0", @@ -17025,6 +17005,7 @@ "version": "5.7.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", + "dev": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", diff --git a/package.json b/package.json index a082da9..1364fca 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,8 @@ "octokit": "^2.0.14", "parse-link-header": "^2.0.0", "parse-numeric-range": "^1.3.0", - "react": "^18.3.1", - "react-dom": "^18.3.1", + "react": "^19.0.0", + "react-dom": "^19.0.0", "react-router": "7.0.1", "rehype-autolink-headings": "^7.1.0", "rehype-slug": "^6.0.0", @@ -67,8 +67,8 @@ "@types/lodash.merge": "^4.6.7", "@types/node": "^18.16.3", "@types/parse-link-header": "^2.0.1", - "@types/react": "^18.2.5", - "@types/react-dom": "^18.2.3", + "@types/react": "^19.0.1", + "@types/react-dom": "^19.0.2", "@types/semver": "^7.3.13", "@types/tar": "^6.1.4", "@types/tar-stream": "^2.2.2",