A minimal package manager inspired by pnpm, built for learning.
mini-pnpm resolves package versions from the npm registry, verifies tarball integrity, stores package contents in a global content store, and links dependencies into a local virtual store. It writes a YAML lockfile (mini-pnpm-lock.yaml) so installs are reproducible and the full resolution graph (including transitive dependencies, integrity, and tarball URLs) is recorded.
- Install dependencies from
package.json - Add dependencies with semver ranges or tags
- Add dev dependencies with
-D/--save-dev - Remove dependencies from
package.json - Lockfile (
mini-pnpm-lock.yaml): pins the resolved graph, top-leveldependencies/devDependenciesversions, and detects whenpackage.jsonis out of sync - Use a global store at
~/.mini-pnpm-store - Link packages into
node_modules/.pnpm, top-level symlinks innode_modules, and executable symlinks innode_modules/.binwhen packages declarebin - Show store status and total store size
- In-memory metadata cache during a single resolve to avoid duplicate registry fetches for the same package name
- Stronger security around tarball download
- Richer default help / command-specific help (current
helpoutput is minimal) - Workspaces support
- Parallel tarball downloads
- Run scripts (
mini-pnpm run …) - Benchmark
- Optional dependencies
- Peer dependencies
- Node.js 18+
- npm
npm installnpm run buildnpm linkAfter linking, run commands with:
mini-pnpm <command>If you do not link globally, run from source with:
npm run dev -- <command>-v,--version: print version-D,--save-dev: add as dev dependency (foradd)--log-level <level>: one ofdebug,info,warn,error(default:info)
Install all dependencies and devDependencies from package.json, reconcile with the lockfile, download missing packages, and refresh mini-pnpm-lock.yaml.
mini-pnpm installAdd a package to dependencies.
mini-pnpm add react
mini-pnpm add react@18.3.1
mini-pnpm add lodash@^4.17.0
mini-pnpm add typescript -DNotes:
- If no version is provided,
latestis used with a^range. - Package tarball integrity is verified before storing.
Remove a package from dependencies and devDependencies in package.json, then reconcile the lockfile and node_modules.
mini-pnpm remove reactDisplay packages in the global store and total size.
mini-pnpm store status- Read
package.json(andmini-pnpm-lock.yamlwhen present). - Compare top-level dependency ranges with the lockfile; resolve any mismatches or missing entries against the npm registry.
- Walk the dependency graph (with metadata cached per package name during the run).
- Download tarballs, verify integrity, and extract into the global store (
~/.mini-pnpm-store). - Hard-link package files into
node_modules/.pnpm/.... - Create top-level symlinks in
node_modules/<package>and bin shims innode_modules/.binwhere applicable. - Write an updated
mini-pnpm-lock.yaml.
For a full explanation of the resolver design and its limitations vs production ready package managers, see docs/dependency-resolution.md.
npm run dev # Run CLI via tsx
npm run build # Compile TypeScript to dist/
npm run type-check # tsc --noEmit
npm run format # Biome check --fix
npm test # Run tests (Vitest)- This project is for educational purposes and does not implement the full pnpm feature set.