CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-pnpm

Fast, disk space efficient package manager for Node.js with hard links, symlinks, and monorepo support

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

configuration.mddocs/

Configuration and Environment

Configure pnpm settings, manage Node.js environments, and set up shell integrations for optimal development workflows.

Capabilities

Configuration Management

Manage pnpm configuration settings through CLI commands and configuration files.

/**
 * Manage pnpm configuration settings
 * Supports global, user, and project-level configuration
 */
pnpm config <command> [options]
pnpm c <command> [options]

Available Commands:

  • get <key> - Get configuration value
  • set <key> <value> - Set configuration value
  • delete <key> - Delete configuration key
  • list - List all configuration
  • edit - Edit configuration file

Usage Examples:

# List all configuration
pnpm config list

# Get specific setting
pnpm config get registry

# Set configuration value
pnpm config set registry https://registry.npmjs.org

# Delete configuration
pnpm config delete proxy

# Edit configuration file
pnpm config edit

Get Configuration Values

Retrieve specific configuration values or display current settings.

/**
 * Get configuration values
 * Retrieves settings from config hierarchy
 */
pnpm get <key> [options]

Usage Examples:

# Get registry URL
pnpm get registry

# Get store directory
pnpm get store-dir

# Get all settings (same as config list)
pnpm get

Set Configuration Values

Set configuration values at different scopes (global, user, project).

/**
 * Set configuration values
 * Updates configuration files with new values
 */
pnpm set <key> <value> [options]

Options:

  • --global, -g - Set in global config
  • --location <location> - Set in specific config location

Usage Examples:

# Set registry
pnpm set registry https://npm.example.com

# Set global configuration
pnpm set --global store-dir /shared/pnpm-store

# Set package manager settings
pnpm set auto-install-peers true
pnpm set strict-peer-dependencies false

Configuration Files

Configuration Hierarchy

pnpm reads configuration from multiple sources in priority order:

# Configuration priority (highest to lowest)
1. Command line options          # --registry=...
2. Environment variables         # PNPM_REGISTRY=...
3. Project .pnpmrc              # ./pnpmrc or ./.pnpmrc
4. Workspace .pnpmrc            # <workspace-root>/.pnpmrc
5. User .pnpmrc                 # ~/.pnpmrc
6. Global .pnpmrc               # /etc/pnpmrc
7. Default values               # Built-in defaults

.pnpmrc File Format

Configuration file syntax and common settings:

# Registry configuration
registry=https://registry.npmjs.org
@myorg:registry=https://npm.myorg.com

# Store configuration  
store-dir=~/.pnpm-store
package-import-method=hardlink

# Installation behavior
auto-install-peers=true
strict-peer-dependencies=false
shamefully-hoist=false

# Workspace settings
link-workspace-packages=true
shared-workspace-lockfile=true

# Logging and output
loglevel=info
reporter=default

# Network settings
fetch-retries=3
fetch-retry-factor=2
fetch-timeout=60000

# Security settings
audit-level=moderate

Common Configuration Options

Key configuration settings and their usage:

# Package management
auto-install-peers              # Automatically install peer dependencies
strict-peer-dependencies        # Fail on missing peer dependencies  
shamefully-hoist               # Hoist dependencies (not recommended)
public-hoist-pattern           # Patterns for public hoisting

# Store and caching
store-dir                      # Global store directory
cache-dir                      # Cache directory
package-import-method          # hardlink, copy, or clone
verify-store-integrity         # Verify packages when adding to store

# Lockfile behavior
lockfile                       # Generate lockfile (default: true)
lockfile-dir                   # Lockfile directory
frozen-lockfile               # Don't update lockfile
prefer-frozen-lockfile        # Prefer existing lockfile

# Registry and network
registry                      # Default registry URL
fetch-retries                 # Network retry attempts
fetch-timeout                 # Network timeout (ms)
ca                           # Certificate authority
cert                         # Client certificate
key                          # Client key

# Workspace configuration
link-workspace-packages       # Link workspace packages
shared-workspace-lockfile     # Single lockfile for workspace

Environment Management

Node.js Version Management

Manage Node.js versions per project with integrated version switching.

/**
 * Manage Node.js environments and versions
 * Provides Node.js version management similar to nvm
 */
pnpm env <command> [options]

Available Commands:

  • use <version> - Use specific Node.js version
  • list - List installed Node.js versions
  • list-remote - List available remote versions
  • install <version> - Install Node.js version
  • remove <version> - Remove Node.js version

Usage Examples:

# Install and use Node.js version
pnpm env use 18.17.0

# List installed versions
pnpm env list

# List available remote versions
pnpm env list-remote

# Install specific version
pnpm env install 20.5.0

# Remove version
pnpm env remove 16.20.0

Project Node.js Version

Configure project-specific Node.js version requirements.

// package.json - engine requirements
{
  "engines": {
    "node": ">=18.12.0"
  }
}

// .nvmrc - version specification
18.17.0

Configuration Options:

# Set Node.js version for project
pnpm config set use-node-version 18.17.0

# Environment variable
export PNPM_NODE_VERSION=18.17.0

Environment Setup

Set up pnpm environment and shell integrations.

/**
 * Setup pnpm environment and shell integration
 * Configures PATH, completion, and shell hooks
 */
pnpm setup [options]

Options:

  • --shell <shell> - Specify shell (bash, zsh, fish, powershell)
  • --global - Set up globally

Usage Examples:

# Setup for current shell
pnpm setup

# Setup for specific shell
pnpm setup --shell zsh

# Global setup
pnpm setup --global

System Information

Binary Directory

Show the directory containing pnpm executables.

/**
 * Show path to executable directory
 * Returns directory containing pnpm binaries
 */
pnpm bin [options]

Options:

  • --global, -g - Show global bin directory

Usage Examples:

# Show local bin directory
pnpm bin

# Show global bin directory
pnpm bin -g

# Use in scripts
export PATH="$(pnpm bin):$PATH"

Modules Directory

Show the directory containing installed packages.

/**
 * Show path to modules directory
 * Returns directory containing node_modules
 */
pnpm root [options]

Options:

  • --global, -g - Show global modules directory

Usage Examples:

# Show local modules directory
pnpm root

# Show global modules directory  
pnpm root -g

# Use in scripts
NODE_MODULES=$(pnpm root)

Registry Configuration

Multiple Registries

Configure different registries for different scopes:

# Set default registry
pnpm set registry https://registry.npmjs.org

# Set scoped registry
pnpm set @myorg:registry https://npm.myorg.com

# Set registry with authentication
pnpm set //npm.myorg.com:_authToken YOUR_TOKEN

Registry Authentication

Configure authentication for private registries:

# Token-based authentication
//registry.npmjs.org/:_authToken=npm_TOKEN

# Username/password authentication
//npm.myorg.com/:username=myuser
//npm.myorg.com/:_password=BASE64_PASSWORD
//npm.myorg.com/:email=user@myorg.com

# Certificate-based authentication
ca=/path/to/ca.pem
cert=/path/to/cert.pem
key=/path/to/key.pem

Performance Configuration

Network Settings

Configure network behavior for optimal performance:

# Network timeouts and retries
fetch-timeout=60000           # Request timeout in milliseconds
fetch-retries=3              # Number of retry attempts
fetch-retry-factor=2         # Retry delay multiplier
fetch-retry-mintimeout=1000  # Minimum retry delay
fetch-retry-maxtimeout=60000 # Maximum retry delay

# Concurrent connections
network-concurrency=16       # Max concurrent network requests

Cache Configuration

Configure caching behavior:

# Cache settings
cache-dir=~/.pnpm-cache       # Cache directory
cache-max=Infinity           # Maximum cache size
cache-min=0                  # Minimum cache retention time

# Offline behavior
prefer-offline=false         # Prefer cached packages
offline=false               # Work offline only

Security Configuration

Audit Settings

Configure security audit behavior:

# Audit configuration
audit-level=moderate         # Audit severity level (low, moderate, high, critical)
audit=true                  # Enable audit on install

# Package verification
verify-store-integrity=true  # Verify package integrity

Package Manager Enforcement

Enforce specific package manager usage:

// package.json - enforce pnpm usage
{
  "packageManager": "pnpm@8.6.12",
  "engines": {
    "pnpm": ">=8.0.0"
  }
}

Configuration:

# Package manager settings
package-manager-strict=true        # Enforce packageManager field
package-manager-strict-version=true # Enforce exact version

Self-Management

Self-Update

Update pnpm to the latest version.

/**
 * Update pnpm to latest version
 * Downloads and installs the latest pnpm release
 */
pnpm self-update [options]

Usage Examples:

# Update to latest version
pnpm self-update

# Update to specific version
pnpm self-update 8.7.0

Shell Completion

Generate shell completion scripts for enhanced CLI experience.

/**
 * Generate shell completion script
 * Enables tab completion for pnpm commands
 */
pnpm completion [shell] [options]

Supported Shells:

  • bash - Bash completion
  • zsh - Zsh completion
  • fish - Fish completion
  • powershell - PowerShell completion

Usage Examples:

# Generate completion for current shell
pnpm completion

# Generate completion for specific shell
pnpm completion bash > ~/.pnpm-completion.bash

# Install completion for zsh
pnpm completion zsh > ~/.zsh/completions/_pnpm

Project Initialization

Initialize new Node.js projects with package.json and basic configuration.

/**
 * Initialize new Node.js project
 * Creates package.json and basic project structure
 */
pnpm init [options]

Options:

  • --yes, -y - Accept all defaults without prompting
  • --scope <scope> - Initialize scoped package
  • --private - Mark package as private

Usage Examples:

# Initialize new project interactively
pnpm init

# Initialize with defaults
pnpm init -y

# Initialize scoped package
pnpm init --scope @myorg

# Initialize private package
pnpm init --private

System Diagnostics

Diagnose pnpm installation and configuration issues.

/**
 * Diagnose pnpm installation and configuration
 * Checks for common issues and provides recommendations
 */
pnpm doctor [options]

Usage Examples:

# Run full diagnostic check
pnpm doctor

# Check specific directory
pnpm doctor --dir /path/to/project

The doctor command checks:

  • pnpm installation integrity
  • Node.js version compatibility
  • Store location and permissions
  • Workspace configuration
  • Registry connectivity
  • Common configuration issues

Install with Tessl CLI

npx tessl i tessl/npm-pnpm

docs

configuration.md

index.md

package-inspection.md

package-management.md

script-running.md

store-management.md

workspace-management.md

tile.json