Install
Show an install command for npm, pnpm, yarn, and bun, in the reader's package manager.
Write the package name once and <Install> turns it into the right command for each package manager, as tabs with a copy button. When a reader picks their package manager, every install command on the site switches to it, and the pick is remembered for their next visit.
npm install doccupineInstall usage
Put the package names inside <Install>. Separate several packages with spaces.
<Install>doccupine</Install>
<Install>react react-dom</Install>npm install react react-domPick a tab in one block and the other blocks on the page follow.
Development dependencies
Add dev to install the packages as development dependencies.
<Install dev>typescript @types/node</Install>npm install -D typescript @types/nodeRun without installing
Add exec to run a package without installing it, the way npx does. Everything after the package name is passed to it as arguments.
<Install exec>doccupine build</Install>npx doccupine buildyarn dlx needs Yarn 2 or later. Readers on Yarn 1 can use the npm tab.
Commands
| Package manager | Install | With dev | With exec |
|---|---|---|---|
| npm | npm install | npm install -D | npx |
| pnpm | pnpm add | pnpm add -D | pnpm dlx |
| yarn | yarn add | yarn add -D | yarn dlx |
| bun | bun add | bun add -d | bunx |
The page is rendered with npm selected. A reader's own pick replaces it as soon as the page loads. For other commands that differ by tool, use code tabs.
Properties
The packages to install, separated by spaces. With exec, the package to run followed by its arguments.
The packages, when you would rather pass them as a property than as the children.
Install the packages as development dependencies. Defaults to false.
Run the package without installing it (npx, pnpm dlx, yarn dlx, bunx). Takes precedence over dev. Defaults to false.