Files
driver.js/apps/docs/astro.config.mjs
Kamran Ahmed 572811582d Document hints and add the changelog entry
A Hints guide in the docs Introduction section with a live sample
component (self-contained mock UI the beacons attach to), covering the
close-vs-dismiss semantics, the localStorage persistence recipe, beacon
placement/styling and the full options and methods reference. The docs
app gains driver.js/hints and hints.css source aliases for HMR, same as
the playground.

The Unreleased changelog section lists the hints entry, the new CSS
variables, the sideEffects field, the shared popover layer and the
tsdown build migration — which also makes the release flow green: the
release aborts on an empty Unreleased section.
2026-07-16 19:58:55 +01:00

64 lines
2.0 KiB
JavaScript

import { defineConfig } from "astro/config";
import { fileURLToPath } from "node:url";
import { unified } from "@astrojs/markdown-remark";
import tailwindcss from "@tailwindcss/vite";
import react from "@astrojs/react";
import mdx from "@astrojs/mdx";
import sitemap from "@astrojs/sitemap";
import compress from "astro-compress";
// Import the library straight from source (../src) so changes to driver.js are
// reflected instantly with HMR — no build step in between. The CSS subpath is
// aliased separately, and listed first so it matches before the bare specifier.
const driverSource = fileURLToPath(new URL("../../packages/driver/src/driver.ts", import.meta.url));
const driverCss = fileURLToPath(new URL("../../packages/driver/src/driver.css", import.meta.url));
const hintsSource = fileURLToPath(new URL("../../packages/driver/src/hints.ts", import.meta.url));
const hintsCss = fileURLToPath(new URL("../../packages/driver/src/hints.css", import.meta.url));
// https://astro.build/config
export default defineConfig({
site: "https://driverjs.com",
build: {
format: "file",
},
markdown: {
// Use the pure-JS unified/remark processor instead of Astro 7's default
// native Sätteri engine, whose prebuilt binary needs a newer glibc than
// some build hosts provide. With this processor the native binary is never
// loaded, so the build runs anywhere.
processor: unified(),
shikiConfig: {
theme: "monokai",
},
},
integrations: [
react(),
mdx(),
sitemap(),
compress({
CSS: false,
JS: false,
}),
],
vite: {
plugins: [tailwindcss()],
resolve: {
alias: [
{ find: "driver.js/dist/driver.css", replacement: driverCss },
{ find: "driver.js/dist/hints.css", replacement: hintsCss },
{ find: "driver.js/hints", replacement: hintsSource },
{ find: "driver.js", replacement: driverSource },
],
},
server: {
fs: {
// Allow importing the library source that lives outside this project.
allow: ["../.."],
},
},
},
});