diff --git a/website/src/components/InstallOsDetect.astro b/website/src/components/InstallOsDetect.astro new file mode 100644 index 0000000..a6a1719 --- /dev/null +++ b/website/src/components/InstallOsDetect.astro @@ -0,0 +1,39 @@ +--- +// Pre-selects the install-instructions tab that matches the visitor's OS. +// +// This piggybacks on Starlight's synced-tabs mechanism rather than fighting it. +// A `` restores its active tab from +// `localStorage["starlight-synced-tabs__install-os"]` via a script Starlight +// inlines *before* the tabs render (so there is no flash of the wrong tab). All +// we do here is seed that same key with the detected OS — and only when the +// visitor has not already chosen a tab themselves, so a manual choice always wins. +// +// Requirements (mirrors Starlight's own restore script): +// - Must be placed *before* the `` it targets, so this runs first. +// - The stored value must equal one of the TabItem labels exactly +// ("Linux" / "macOS" / "Windows"). +// - Inlined, so it runs during parse before the restore script's +// connectedCallback and paint. +--- + + diff --git a/website/src/content/docs/getting-started/installation.md b/website/src/content/docs/getting-started/installation.mdx similarity index 55% rename from website/src/content/docs/getting-started/installation.md rename to website/src/content/docs/getting-started/installation.mdx index bbe7927..aa48888 100644 --- a/website/src/content/docs/getting-started/installation.md +++ b/website/src/content/docs/getting-started/installation.mdx @@ -5,77 +5,105 @@ sidebar: order: 1 --- +import { Tabs, TabItem } from '@astrojs/starlight/components'; +import InstallOsDetect from '../../../components/InstallOsDetect.astro'; + RDBMS Playground is a single self-contained program. There is nothing to configure and no separate database to install — everything it needs is built in. -Pick whichever method suits your platform. The one-line installers are the -quickest if you just want to get going. +Pick the tab for your platform — we try to select it automatically — then +use whichever method you prefer. The one-line installers are the quickest if +you just want to get going. -## One line + -These download the matching binary for your machine, verify its checksum, -and put it on your `PATH`. + + -### Linux & macOS +**One-line installer** ```sh curl -fsSL https://git.lazyeval.net/oli/rdbms-playground/raw/branch/main/scripts/install.sh | sh ``` -It detects your operating system and CPU, installs to `~/.local/bin`, and -prints a hint if that directory isn't on your `PATH`. Set -`RDBMS_INSTALL_DIR` to install somewhere else, or `RDBMS_VERSION=vX.Y.Z` to -pin a specific version. Prefer to read a script before running it? It lives -at [`scripts/install.sh`](https://git.lazyeval.net/oli/rdbms-playground/raw/branch/main/scripts/install.sh). +It detects your CPU, installs to `~/.local/bin`, and prints a hint if that +directory isn't on your `PATH`. Set `RDBMS_INSTALL_DIR` to install elsewhere, +or `RDBMS_VERSION=vX.Y.Z` to pin a version. Prefer to read a script before +running it? It lives at +[`scripts/install.sh`](https://git.lazyeval.net/oli/rdbms-playground/raw/branch/main/scripts/install.sh). -### Windows (PowerShell) - -```powershell -irm https://git.lazyeval.net/oli/rdbms-playground/raw/branch/main/scripts/install.ps1 | iex -``` - -It downloads the matching `.exe`, verifies its checksum, installs to -`%LOCALAPPDATA%\Programs\rdbms-playground`, and adds that folder to your -user `PATH`. Use `-InstallDir` to choose a different location or `-Version` -to pin a release. - -## Package managers - -### Homebrew (macOS & Linux) +**Homebrew** ```sh brew tap lazyeval/tap https://git.lazyeval.net/lazyeval/homebrew-tap brew install lazyeval/tap/rdbms-playground ``` -### Scoop (Windows) + + + +**One-line installer** + +```sh +curl -fsSL https://git.lazyeval.net/oli/rdbms-playground/raw/branch/main/scripts/install.sh | sh +``` + +It detects your CPU (Apple Silicon or Intel), installs to `~/.local/bin`, and +prints a hint if that directory isn't on your `PATH`. Set `RDBMS_INSTALL_DIR` +to install elsewhere, or `RDBMS_VERSION=vX.Y.Z` to pin a version. Prefer to +read a script before running it? It lives at +[`scripts/install.sh`](https://git.lazyeval.net/oli/rdbms-playground/raw/branch/main/scripts/install.sh). + +**Homebrew** + +```sh +brew tap lazyeval/tap https://git.lazyeval.net/lazyeval/homebrew-tap +brew install lazyeval/tap/rdbms-playground +``` + + + + +**One-line installer (PowerShell)** + +```powershell +irm https://git.lazyeval.net/oli/rdbms-playground/raw/branch/main/scripts/install.ps1 | iex +``` + +It downloads the matching `.exe`, verifies its checksum, installs to +`%LOCALAPPDATA%\Programs\rdbms-playground`, and adds that folder to your user +`PATH`. Use `-InstallDir` to choose a different location or `-Version` to pin +a release. + +**Scoop** ```sh scoop bucket add lazyeval https://git.lazyeval.net/lazyeval/scoop-bucket scoop install rdbms-playground ``` -### winget (Windows) +**winget** -:::note A winget package (`winget install LazyEvaluation.RdbmsPlayground`) is on its way and awaiting review in the public winget catalogue. Until it lands, use Scoop or the PowerShell one-liner above. -::: + + + ## With cargo -If you have a Rust toolchain, you can install from +These work on any platform with a Rust toolchain. Install from [crates.io](https://crates.io/crates/rdbms-playground): ```sh cargo install rdbms-playground ``` -For a faster install that fetches a prebuilt binary instead of compiling, -use [`cargo-binstall`](https://github.com/cargo-bins/cargo-binstall) -(install it first — it is not part of `cargo` itself): +For a faster install that fetches a prebuilt binary instead of compiling, use +[`cargo-binstall`](https://github.com/cargo-bins/cargo-binstall) (install it +first — it is not part of `cargo` itself): ```sh cargo binstall rdbms-playground @@ -83,11 +111,11 @@ cargo binstall rdbms-playground ## Prebuilt binaries -Every release publishes static Linux, standalone Windows, and macOS -binaries (x86_64 and aarch64), each with a `.sha256` checksum, on the +Every release publishes static Linux, standalone Windows, and macOS binaries +(x86_64 and aarch64), each with a `.sha256` checksum, on the [releases page](https://git.lazyeval.net/oli/rdbms-playground/releases). -Download the one for your platform, make it executable if needed, and put -it somewhere on your `PATH`. +Download the one for your platform, make it executable if needed, and put it +somewhere on your `PATH`. ## Run it