diff --git a/BUILD.bazel b/BUILD.bazel index 3708b8935..0216c34c4 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -4,7 +4,6 @@ load("@npm//:defs.bzl", "npm_link_all_packages") load("@aspect_rules_js//js:defs.bzl", "js_library") load("@bazel_gazelle//:def.bzl", "gazelle_binary", "gazelle") load("@rules_swift_package_manager//swiftpkg:defs.bzl", "swift_update_packages") -load("@bazel_tools//tools/jdk:default_java_toolchain.bzl", "default_java_toolchain") package(default_visibility = ["//visibility:public"]) diff --git a/MODULE.bazel b/MODULE.bazel index 5495b9afa..de12c26e6 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -7,9 +7,9 @@ bazel_dep(name = "rules_player") archive_override( module_name = "rules_player", - strip_prefix = "rules_player-1.1.2", - urls = ["https://github.com/player-ui/rules_player/archive/refs/tags/v1.1.2.tar.gz"], - integrity = "sha256-7aroW0aRlDpr5tOKVloMANRaLvt6xOiDVxESrSy0t58=" + strip_prefix = "rules_player-1.1.3", + urls = ["https://github.com/player-ui/rules_player/archive/refs/tags/v1.1.3.tar.gz"], + integrity = "sha256-Fqe4Y9aY5R0Y2yL9k+fsNKDrNPFP5/utyS5DQaoeYBA=" ) #local_path_override(module_name = "rules_player", path = "../rules_player") diff --git a/docs/BUILD b/docs/BUILD index a2ce2e989..eb279f05c 100644 --- a/docs/BUILD +++ b/docs/BUILD @@ -1,4 +1,3 @@ -load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") load("@rules_player//distribution/tar:defs.bzl", "stamp_tar_files") load("@rules_player//gh-pages:defs.bzl","gh_pages") @@ -30,6 +29,7 @@ stamp_tar_files( "DOCS_BASE_PATH": "{STABLE_DOCS_BASE_PATH}", "ALGOLIA_SEARCH_API_KEY": "{STABLE_ALGOLIA_SEARCH_API_KEY}", }, + stable = True ) genrule( diff --git a/docs/site/components/Image.tsx b/docs/site/components/Image.tsx index f6dcb64e1..6bc3c8190 100644 --- a/docs/site/components/Image.tsx +++ b/docs/site/components/Image.tsx @@ -1,13 +1,14 @@ -// import path from "path-browserify"; +import path from "path-browserify"; +import { BASE_PREFIX } from "../config/constants"; export function withBasePrefix(location?: string): string | undefined { if (!location) { return location; } - // if (process.env.NEXT_PUBLIC_BASE_PATH) { - // return path.join(process.env.NEXT_PUBLIC_BASE_PATH, location); - // } + if (BASE_PREFIX) { + return path.join("/", BASE_PREFIX, location); + } return location; } diff --git a/docs/site/components/Navigation.tsx b/docs/site/components/Navigation.tsx index 141331aae..c97a32d20 100644 --- a/docs/site/components/Navigation.tsx +++ b/docs/site/components/Navigation.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { Link, useLocation, useNavigate } from "react-router-dom"; +import { Link, useLocation } from "react-router-dom"; import { Flex, Image, @@ -10,7 +10,6 @@ import { Icon, Link as CLink, IconButton, - chakra, Drawer, Heading, Text, @@ -27,7 +26,7 @@ import { HamburgerIcon } from "@chakra-ui/icons"; import type { Route } from "../config/navigation"; import NAV, { PATH_TO_NAV, Platform } from "../config/navigation"; import { ColorSchemeSwitch } from "./ColorSchemeSwitch"; -import { DOCS_BASE_URL, GITHUB_URL } from "../config/constants"; +import { DOCS_BASE_URL, GITHUB_URL, BASE_PREFIX } from "../config/constants"; import { withBasePrefix } from "./Image"; import { SearchInput } from "./Search"; import { GithubIcon } from "./gh-icon"; @@ -120,7 +119,7 @@ const SideNavigationList = (props: { route: Route }) => { ); }; -export const SideNavigation = () => { +export const SideNavigation = (): React.JSX.Element | null => { const { pathname } = useLocation(); const subRoutes = PATH_TO_NAV.get(pathname); @@ -141,7 +140,7 @@ export const Footer = () => { return null; }; -export const GitHubButton = () => { +export const GitHubButton = (): React.JSX.Element => { return ( { return releasedVersions; }; -export const VersionSelector = () => { +export const VersionSelector = (): React.JSX.Element => { const location = useLocation(); - const navigate = useNavigate(); const released = useGetReleasedVersions(); return ( @@ -206,9 +204,9 @@ export const VersionSelector = () => { display: "flex", flexShrink: "0", }} - value={location.pathname || "/latest"} + value={BASE_PREFIX || "latest"} onChange={(e) => { - navigate(`${DOCS_BASE_URL}/${e.target.value}`); + window.location.href = `${DOCS_BASE_URL}${e.target.value}/#${location.pathname}`; }} > @@ -222,7 +220,7 @@ export const VersionSelector = () => { ); }; -export const TopNavigation = () => { +export const TopNavigation = (): React.JSX.Element => { const { pathname, search } = useLocation(); const subRoutes = PATH_TO_NAV.get(pathname); const mobileNavDisclosure = useDisclosure(); diff --git a/docs/site/config/constants.ts b/docs/site/config/constants.ts index 71b008e2b..39f7bd4cd 100644 --- a/docs/site/config/constants.ts +++ b/docs/site/config/constants.ts @@ -1,2 +1,5 @@ -export const GITHUB_URL = 'https://github.com/player-ui/player'; -export const DOCS_BASE_URL = 'https://player-ui.github.io/'; +export const GITHUB_URL = "https://github.com/player-ui/player"; +export const DOCS_BASE_URL = "https://player-ui.github.io/"; + +export const BASE_PREFIX: string | undefined = + process.env.NODE_ENV === "production" ? "DOCS_BASE_PATH" : undefined; diff --git a/docs/site/next.config.mjs b/docs/site/next.config.mjs deleted file mode 100644 index bac1176c0..000000000 --- a/docs/site/next.config.mjs +++ /dev/null @@ -1,62 +0,0 @@ -import path from 'path'; -import smartypants from 'remark-smartypants'; -import rehypeSlug from 'rehype-slug'; -import rehypeAutolinkHeadings from 'rehype-autolink-headings'; -import { URL } from 'url'; - -const __dirname = new URL('.', import.meta.url).pathname; - -// This will be replaced during the build stamping -export const BASE_PREFIX = - process.env.NODE_ENV === 'production' ? '/DOCS_BASE_PATH' : undefined; - -export default { - reactStrictMode: true, - env: { - NEXT_PUBLIC_BASE_PATH: BASE_PREFIX, - }, - basePath: BASE_PREFIX, - assetPrefix: BASE_PREFIX, - pageExtensions: ['jsx', 'js', 'ts', 'tsx', 'mdx', 'md'], - webpack: (config, { dev, isServer, ...options }) => ({ - ...config, - infrastructureLogging: { - level: 'error', - }, - module: { - ...config.module, - rules: [ - ...config.module.rules, - { - test: /plugin-nav-data.json$/, - use: [path.join(__dirname, './plugins/plugin-nav-generator')], - }, - { - test: /search-index.json$/, - use: [path.join(__dirname, './plugins/search-index-loader')], - }, - { - test: /.mdx?$/, // load both .md and .mdx files - use: [ - options.defaultLoaders.babel, - { - loader: '@mdx-js/loader', - options: { - jsx: true, - remarkPlugins: [ - smartypants, // Formatting (convert -- to em/en dash) - ], - rehypePlugins: [ - rehypeSlug, // Add ids to headings - [rehypeAutolinkHeadings, { behavior: 'wrap' }], // Make headings links - ], - }, - }, - path.join(__dirname, './plugins/md-layout-loader'), - path.join(__dirname, './plugins/mdx-link-append-loader.js'), - ], - }, - ], - }, - }), -}; diff --git a/docs/site/webpack.config.ts b/docs/site/webpack.config.ts index 5e5ff3b6f..40d8855cb 100644 --- a/docs/site/webpack.config.ts +++ b/docs/site/webpack.config.ts @@ -12,10 +12,6 @@ import fs from "fs"; const __dirname = new URL(".", import.meta.url).pathname; -// This will be replaced during the build stamping -export const BASE_PREFIX = - process.env.NODE_ENV === "production" ? "/DOCS_BASE_PATH" : undefined; - const findPageRoutes = (searchPath = "./pages") => { const files = fs.readdirSync(searchPath); const routes: string[] = [];