Files
driver.js/packages/driver/tsdown.config.ts
Kamran Ahmed 75edd1b4bc Restructure as a Turborepo monorepo
packages/driver is the library (still published as driver.js, with
repository.directory set); playground and docs move to apps/. One root
pnpm workspace and lockfile replace the three standalone projects, with
turbo orchestrating build/test/lint:package (apps depend on the library
build; local + CI caching via .turbo).

Apps keep importing the library from source for HMR — the aliases now
point at ../../packages/driver/src and each app gains a workspace:*
dependency so the task graph knows the edge. The dev-server fs scope
widens to the repo root accordingly.

Releases run from packages/driver (root `pnpm release` delegates). The
changelog still lives in the docs app, so the release scripts reach it
via ../../../apps/docs and the after:bump hook stages it explicitly —
release-it no longer sits above both directories.

The merged workspace settings keep sharp unbuilt on purpose (prebuilt
binaries; building from source needs node-gyp and fails) — the docs app
had this right and the playground setting was the accident. postcss and
postcss-scss were unreferenced devDependencies and are dropped; prettier
moves to the root as the only shared tool.
2026-07-16 19:45:23 +01:00

43 lines
1.3 KiB
TypeScript

import { defineConfig } from "tsdown";
// Two isolated builds rather than one multi-entry build, for the same reason
// the vite setup used two configs: with both entries in one build the shared
// popover primitive gets split into a common chunk, which would make the tour
// bundle depend on a second file and merge both stylesheets. Standing alone,
// each entry ships self-contained (the primitive is duplicated, ~2KB gzip).
const shared = {
target: "es2020",
platform: "browser",
dts: true,
minify: true,
// Keep the exact filenames the package has always shipped. The iife format
// appends its own ".iife" infix, so plain ".js" yields "<entry>.iife.js".
outExtensions: (ctx: { format: string }) =>
ctx.format === "es" ? { js: ".mjs" } : ctx.format === "cjs" ? { js: ".cjs" } : { js: ".js" },
} as const;
export default defineConfig([
{
...shared,
entry: { "driver.js": "src/driver.ts" },
format: ["es", "cjs", "iife"],
// The documented CDN global is window["driver"]["js"].driver — rollup-style
// expansion of the dotted name.
globalName: "driver.js",
css: {
fileName: "driver.css",
minify: true,
},
},
{
...shared,
entry: { hints: "src/hints.ts" },
format: ["es", "cjs", "iife"],
globalName: "driverHints",
css: {
fileName: "hints.css",
minify: true,
},
},
]);