From 21658ac658062953ea44c638e14e8e229558c31a Mon Sep 17 00:00:00 2001 From: Antoine BERNIER Date: Fri, 16 Aug 2024 14:57:07 +0200 Subject: [PATCH] feat: libname_short --- .github/workflows/build.yml | 4 ++++ README.md | 31 ++++++++++++++++++------------- src/app/[...slug]/layout.tsx | 8 +++++++- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c448b8c6..042ac4a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,8 @@ on: libname: required: true type: string + libname_short: + type: string home_redirect: required: true type: string @@ -42,6 +44,7 @@ jobs: -e DIST_DIR="$MDX/out$BASE_PATH" \ -e MDX \ -e NEXT_PUBLIC_LIBNAME \ + -e NEXT_PUBLIC_LIBNAME_SHORT \ -e OUTPUT=export \ -e HOME_REDIRECT \ -e MDX_BASEURL \ @@ -54,6 +57,7 @@ jobs: BASE_PATH: ${{ steps.set-base-path.outputs.BASE_PATH }} MDX: ${{ inputs.mdx }} NEXT_PUBLIC_LIBNAME: ${{ inputs.libname }} + NEXT_PUBLIC_LIBNAME_SHORT: ${{ inputs.libname_short }} HOME_REDIRECT: ${{ inputs.home_redirect }} MDX_BASEURL: 'https://github.com/${{ github.repository }}/raw/${{ github.ref_name }}/${{ inputs.mdx }}' EDIT_BASEURL: 'https://github.com/${{ github.repository }}/edit/${{ github.ref_name }}/${{ inputs.mdx }}' diff --git a/README.md b/README.md index 25b03d26..22eb33e0 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,19 @@ # Configuration -| var | description | example | -| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | -| `MDX`\* | Path to `*.mdx` folder
NB: can be relative or absolute | `docs` or `~/code/myproject/documentation` | -| `NEXT_PUBLIC_LIBNAME`\* | Library name | `React Three Fiber` | -| `BASE_PATH` | Base path for the final URL | `/react-three-fiber` | -| `DIST_DIR` | Path to the output folder ([within project](https://nextjs.org/docs/app/api-reference/next-config-js/distDir#:~:text=should%20not%20leave%20your%20project%20directory)) | `out` or `docs/out/react-three-fiber` | -| `OUTPUT` | Set to `export` for static output | `export` | -| `HOME_REDIRECT` | Where the home should redirect | `/getting-started/introduction` | -| `MDX_BASEURL` | Base URL for inlining relative images | `http://localhost:60141`or `https://github.com/pmndrs/react-three-fiber/raw/master/docs` | -| `EDIT_BASEURL` | Base URL for displaying "Edit this page" URLs | `https://github.com/pmndrs/react-three-fiber/edit/master/docs` | -| `NEXT_PUBLIC_URL` | Final URL of the published website | `https://pmndrs.github.io/react-three-fiber` | -| `ICON` | Emoji or image to use as (fav)icon (path local to `MDX`) | `🇨🇭` or `/icon.png` or `/favicon.ico` | -| `LOGO` | Logo src/path (either FQURL or local to `MDX` path) | `/logo.png` or `https://worldvectorlogo.com/r3f.png` | +| var | description | example | +| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | +| `MDX`\* | Path to `*.mdx` folder
NB: can be relative or absolute | `docs` or `~/code/myproject/documentation` | +| `NEXT_PUBLIC_LIBNAME`\* | Library name | `React Three Fiber` | +| `NEXT_PUBLIC_LIBNAME_SHORT` | Library short name | `r3f` | +| `BASE_PATH` | Base path for the final URL | `/react-three-fiber` | +| `DIST_DIR` | Path to the output folder ([within project](https://nextjs.org/docs/app/api-reference/next-config-js/distDir#:~:text=should%20not%20leave%20your%20project%20directory)) | `out` or `docs/out/react-three-fiber` | +| `OUTPUT` | Set to `export` for static output | `export` | +| `HOME_REDIRECT` | Where the home should redirect | `/getting-started/introduction` | +| `MDX_BASEURL` | Base URL for inlining relative images | `http://localhost:60141`or `https://github.com/pmndrs/react-three-fiber/raw/master/docs` | +| `EDIT_BASEURL` | Base URL for displaying "Edit this page" URLs | `https://github.com/pmndrs/react-three-fiber/edit/master/docs` | +| `NEXT_PUBLIC_URL` | Final URL of the published website | `https://pmndrs.github.io/react-three-fiber` | +| `ICON` | Emoji or image to use as (fav)icon (path local to `MDX`) | `🇨🇭` or `/icon.png` or `/favicon.ico` | +| `LOGO` | Logo src/path (either FQURL or local to `MDX` path) | `/logo.png` or `https://worldvectorlogo.com/r3f.png` | \* Required @@ -49,6 +50,7 @@ $ ( # [Config](https://github.com/pmndrs/docs#configuration) export MDX=~/code/pmndrs/react-three-fiber/docs export NEXT_PUBLIC_LIBNAME="React Three Fiber" + export NEXT_PUBLIC_LIBNAME_SHORT="r3f" export BASE_PATH= export DIST_DIR= export OUTPUT=export @@ -85,6 +87,7 @@ $ ( # [Config](https://github.com/pmndrs/docs#configuration) export MDX=~/code/pmndrs/react-three-fiber/docs export NEXT_PUBLIC_LIBNAME="React Three Fiber" + export NEXT_PUBLIC_LIBNAME_SHORT="r3f" export BASE_PATH= export DIST_DIR= export OUTPUT=export @@ -123,6 +126,7 @@ $ ( # [Config](https://github.com/pmndrs/docs#configuration) export MDX=./docs export NEXT_PUBLIC_LIBNAME="React Three Fiber" + export NEXT_PUBLIC_LIBNAME_SHORT="r3f" export BASE_PATH= export OUTPUT=export export HOME_REDIRECT=/getting-started/introduction @@ -168,6 +172,7 @@ uses: pmndrs/docs/.github/workflows/build.yml@main with: mdx: './docs' libname: 'React Three Fiber' + libname_short: 'r3f' home_redirect: '/getting-started/introduction' icon: '🇨🇭' logo: '/logo.png' diff --git a/src/app/[...slug]/layout.tsx b/src/app/[...slug]/layout.tsx index 6e5d5157..dbda6878 100644 --- a/src/app/[...slug]/layout.tsx +++ b/src/app/[...slug]/layout.tsx @@ -27,6 +27,7 @@ export default async function Layout({ params, children }: Props) { const nextPage = currentPageIndex < docs.length - 1 && docs[currentPageIndex + 1] const NEXT_PUBLIC_LIBNAME = process.env.NEXT_PUBLIC_LIBNAME + const NEXT_PUBLIC_LIBNAME_SHORT = process.env.NEXT_PUBLIC_LIBNAME_SHORT return ( <> @@ -37,7 +38,12 @@ export default async function Layout({ params, children }: Props) { <>
- {NEXT_PUBLIC_LIBNAME} + + {NEXT_PUBLIC_LIBNAME_SHORT && ( + {NEXT_PUBLIC_LIBNAME_SHORT} + )} + {NEXT_PUBLIC_LIBNAME} + .docs