What is a preset?
A preset is a named configuration that includes:- A preset name that identifies the configuration
- An optional description explaining what the preset does
- A package manager to use for installation (npm, pnpm, yarn, or bun)
- A packages array listing all packages to install and how to install them
pm-auto install <preset-name>, PM-Auto reads the preset configuration, translates it to the appropriate package manager commands, and executes them in the correct order.
Anatomy of a preset
Here’s the TypeScript interface that defines a preset:Field breakdown
presetName
presetName
A unique identifier for your preset. This is the name you’ll use when running
Type:
Example:
pm-auto install <preset-name>.Required: YesType:
stringExample:
"example", "react-starter", "fullstack-nextjs"description
description
A human-readable explanation of what the preset installs and who it’s for.Required: No
Type:
Example:
Type:
stringExample:
"A sample configuration demonstrating all options for PM-Auto"packageManager
packageManager
The package manager to use for installing packages. Must be one of:
Type:
Example:
npm, pnpm, yarn, or bun.Required: YesType:
stringExample:
"bun", "pnpm"packages
packages
An array of package configurations. Each package specifies what to install and how to install it.Required: Yes
Type:
Type:
Array<PackageType>See Configuration for detailed package field documentation.How presets work internally
When you install a preset, PM-Auto processes it in three steps:1. Command separation
PM-Auto separates packages into two categories:- Interactive packages: Packages with
"interactive": truethat require user input (likecreate-next-apporshadcn init) - Non-interactive packages: Packages with
"interactive": falsethat install without prompts
2. Command batching
Non-interactive packages are batched into a single install command for efficiency:3. Package manager translation
PM-Auto translates your preset configuration to the correct commands for your chosen package manager. The same preset works across all supported package managers.PM-Auto handles differences between package managers automatically, including dev flags (
-D vs -d) and run commands (npx vs bunx vs pnpm dlx).Real-world example
Here’s a complete preset from the PM-Auto source:- Runs
bunx create-next-app@latest .(interactive) - Runs
bunx shadcn@latest init(interactive) - Installs
gsap,@react-three/fiber,clsx, and@types/threein one batched command
When to create a new preset
Create a new preset when you:- Have a repeatable tech stack you use across multiple projects
- Want to onboard new team members with a standardized setup
- Need to document your preferred package versions and configurations
- Want to share a working configuration with the community
Examples of good presets:
"nextjs-tailwind-shadcn"- A Next.js starter with styling libraries"react-testing"- Testing tools for React projects"express-api"- Backend API with Express and common middleware"typescript-node"- TypeScript configuration for Node.js projects
When to modify an existing preset
Modify an existing preset when you:- Need to update package versions
- Want to add or remove packages from an established workflow
- Need to adjust flags or installation options
- Discover a better package that replaces an existing one
Multiple presets in one file
You can define multiple presets in yourconfig.json file. Each preset is a top-level key:
The top-level JSON key and the
presetName field should match to avoid confusion.