Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/npm-cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@pmndrs/docs': minor
---

Publish the generator to npm, as `npx @pmndrs/docs build`.

`--format website` statically exports the documentation site, as the Docker image does.
`--format fragment` — the default — compiles MDX to plain HTML with no layout, stylesheet or
script, either from a folder or from stdin, and needs nothing but node.

`bin/build.mjs` is gone: it predated the Docker image, was never published, and built a server
bundle rather than a static export.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,17 @@ jobs:
# ██████ ██ ██ ██ ██ ██ ████ ██████ ███████ ███████ ███████ ██
#

# npm auth is trusted publishing (OIDC), so there is no `NPM_TOKEN` — the `id-token:
# write` permission above is what signs the publish. The trusted publisher declared on
# npmjs.com names *this* workflow file, so renaming or moving it breaks publishing with
# ENEEDAUTH. Setting an `NPM_TOKEN` secret would break it too: `changesets/action` then
# writes an `.npmrc` and skips OIDC entirely.
- name: Create Release Pull Request or Publish
id: changesets
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: changesets/action@v1
with:
publish: pnpm run release # dummy release
publish: pnpm run release
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@ chromatic-archives/
*storybook.log
*archive.log
storybook-static
src/stories
src/stories

# the CLI's scratch copy of the app, removed after a build unless one crashes
.pmndrs-docs/
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@

# Usage

```sh
$ cat foo.mdx | npx @pmndrs/docs build # one HTML fragment, on stdout
$ npx @pmndrs/docs build docs out # one .html per .mdx, assets alongside
$ npx @pmndrs/docs build docs out --format website # the whole website, statically exported
```

`--format fragment` (the default) needs nothing but node — no Docker, no `next build`. A
fragment is the compiled MDX and nothing else: no layout, no stylesheet, no script. Mermaid
diagrams stay fenced blocks, and Sandpack shows its code without the editor.

`build --help` lists every website option — `--libname`, `--base-path`, `--icon`, `--theme-*`… Each
one falls back to the environment variable it maps to, the same ones
[configuration](docs/getting-started/introduction.mdx#Configuration) documents.

<details>
<summary>Docker</summary>

```sh
$ curl -sL https://raw.githubusercontent.com/pmndrs/docs/refs/heads/main/preview.sh | \
MDX="docs" \
Expand All @@ -18,6 +35,8 @@ $ curl -sL https://raw.githubusercontent.com/pmndrs/docs/refs/heads/main/preview
- you can pass any option from [configuration](docs/getting-started/introduction.mdx#Configuration)
- in `DOCKER_IMAGE`, you can specify any `:tag` value from [docs packages](https://github.com/pmndrs/docs/pkgs/container/docs) container registry

</details>

# Releasing

Every push to `main` redeploys [docs.pmnd.rs](https://docs.pmnd.rs) via [ci.yml](.github/workflows/ci.yml) — no [changeset](.changeset/) needed for that.
Expand Down
91 changes: 0 additions & 91 deletions bin/build.mjs

This file was deleted.

8 changes: 8 additions & 0 deletions bin/pmndrs-docs.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env node

import { main } from '../dist/cli.mjs'

main(process.argv.slice(2)).catch((error) => {
console.error(error instanceof Error ? error.message : error)
process.exit(1)
})
2 changes: 1 addition & 1 deletion components.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"config": "",
"css": "src/app/globals.css",
"baseColor": "neutral",
"cssVariables": true,
Expand Down
3 changes: 3 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const eslintConfig = [
'react/jsx-no-target-blank': 0,
'import/no-anonymous-default-export': 0,
'react-hooks/set-state-in-effect': 0,
// `next/image` buys nothing here: `images.unoptimized` is set in next.config.mjs,
// and the CLI renders these components outside Next, where next/image throws.
'@next/next/no-img-element': 0,
},
},
...storybook.configs['flat/recommended'],
Expand Down
67 changes: 47 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"name": "@pmndrs/docs",
"private": true,
"version": "3.5.0",
"type": "module",
"bin": {
"build": "bin/build.mjs"
"pmndrs-docs": "bin/pmndrs-docs.mjs"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.2",
Expand All @@ -15,35 +14,21 @@
"@storybook/addon-docs": "^10.2.0",
"@storybook/addon-themes": "^10.2.0",
"@storybook/nextjs-vite": "^10.2.0",
"@tailwindcss/postcss": "^4.1.18",
"@tailwindcss/typography": "^0.5.19",
"@types/hast": "^3.0.4",
"@types/lodash-es": "^4.17.12",
"@types/minimist": "^1.2.5",
"@types/node": "^25.0.9",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@types/sanitize-html": "^2.16.0",
"autoprefixer": "^10.4.23",
"chromatic": "^13.3.5",
"esbuild": "^0.28.2",
"eslint": "^9.0.0",
"eslint-config-next": "^16.0.0",
"eslint-plugin-storybook": "^10.2.0",
"husky": "^9.1.7",
"lint-staged": "^15.2.10",
"minimist": "^1.2.8",
"msw": "^2.12.8",
"postcss": "^8.4.45",
"prettier": "^3.3.3",
"prettier-plugin-organize-imports": "^4.0.0",
"prettier-plugin-tailwindcss": "^0.7.2",
"rehype-parse": "^9.0.1",
"rehype-stringify": "^10.0.1",
"storybook": "^10.2.0",
"tailwindcss": "^4.1.18",
"tailwindcss-animate": "^1.0.7",
"tw-animate-css": "^1.4.0",
"typescript": "^5.6.2",
"unified": "^11.0.5",
"vite": "^7.3.1",
"vitest": "^4.0.18"
Expand All @@ -57,11 +42,18 @@
"@radix-ui/react-collapsible": "^1.1.0",
"@radix-ui/react-dialog": "^1.1.1",
"@radix-ui/react-visually-hidden": "^1.2.4",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/postcss": "^4.1.18",
"@types/hast": "^3.0.4",
"@types/lodash-es": "^4.17.12",
"@types/node": "^25.0.9",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@types/sanitize-html": "^2.16.0",
"cheerio": "^1.0.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"commander": "^15.0.0",
"gray-matter": "^4.0.3",
"image-size": "^1.1.1",
"lodash-es": "^4.17.21",
Expand All @@ -73,6 +65,7 @@
"next": "^16.1.3",
"next-mdx-remote": "^6.0.0",
"next-themes": "^0.4.6",
"postcss": "^8.4.45",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-icons": "^5.5.0",
Expand All @@ -81,6 +74,10 @@
"remark-gfm": "^4.0.1",
"sanitize-html": "^2.17.0",
"tailwind-merge": "^3.4.0",
"tailwindcss": "^4.1.18",
"tailwindcss-animate": "^1.0.7",
"tw-animate-css": "^1.4.0",
"typescript": "^5.6.2",
"unist-util-visit": "^5.0.0",
"xmlbuilder2": "^3.1.1",
"zod": "^3.24.1"
Expand All @@ -97,10 +94,40 @@
"test": "vitest && playwright test",
"chromatic": "chromatic --project-token $CHROMATIC_PROJECT_TOKEN",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
"build-storybook": "storybook build",
"build:cli": "node scripts/build-cli.mjs",
"prepack": "node scripts/build-cli.mjs"
},
"engines": {
"node": ">=20.9.0"
},
"packageManager": "pnpm@10.28.1"
"packageManager": "pnpm@10.28.1",
"description": "Generate pmndrs-standardized documentation — HTML fragments, or the whole website — from a folder of MDX.",
"homepage": "https://docs.pmnd.rs",
"repository": {
"type": "git",
"url": "git+https://github.com/pmndrs/docs.git"
},
"license": "MIT",
"keywords": [
"pmndrs",
"documentation",
"mdx",
"docs",
"static-site"
],
"files": [
"bin",
"dist",
"public",
"registry",
"src",
"next.config.mjs",
"next-env.d.ts",
"postcss.config.mjs",
"tsconfig.json",
"!src/stories",
"!**/*.test.*",
"!**/*.stories.*"
]
}
Loading
Loading