Skip to content

wesleybl/pnpm-home

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PNPM Home Docker Environment

Docker environment for developing with pnpm workspaces, featuring Node.js 22 and pnpm 9.1.1.

� Quick Start

# Clone the repository
git clone <your-repo-url>
cd pnpm-home

# Build the Docker image
./build.sh

# Run the example application
docker run --rm pnpm-home:latest pnpm start

�📁 Project Structure

pnpm-home/
├── Dockerfile            # Docker image definition
├── build.sh             # Build script with validations
├── .dockerignore        # Docker ignore patterns  
├── .gitignore           # Git ignore patterns
├── README.md            # This file
└── project-workspace/   # Example pnpm workspace project
    ├── package.json     # Workspace root configuration (pnpm version spec)
    ├── .npmrc          # Workspace engine strict mode
    ├── pnpm-workspace.yaml  # Workspace configuration
    └── packages/       # Workspace packages
        ├── utils/      # Utility library (@my-workspace/utils)
        └── app/        # Main application (@my-workspace/app)

🔧 Configuration

The pnpm version is specified in project-workspace/package.json using both fields:

{
  "packageManager": "pnpm@9.1.1",
  "engines": {
    "pnpm": "9.1.1"
  }
}

The build system reads from both packageManager and engines.pnpm fields to ensure version consistency.

� Docker Features

  • Debian latest base image
  • Node.js 22 from official repository
  • pnpm 9.1.1 (version controlled via package.json)
  • Non-root user (node)
  • Example workspace project included
  • Engine version validation with .npmrc
  • Dependencies pre-installed in the image

🛠️ Usage

Prerequisites

# Install the latest pnpm version locally (for development)
npm install -g pnpm

# Ensure Docker is running
sudo systemctl start docker

Build Docker Image

# Build the image (installs dependencies and creates Docker image)
./build.sh

# Build with custom tag
./build.sh v1.0

Run the Example Project

# Run the example application directly
docker run --rm pnpm-home:latest pnpm start

# Or enter the container interactively
docker run --rm -it pnpm-home:latest

# Inside the container, you can:
pnpm start    # Run the main application
pnpm test     # Run tests in all packages
ls -la        # Explore the workspace

📦 Example Workspace

The included project-workspace demonstrates a simple pnpm workspace with:

@my-workspace/utils

Simple utility library with helper functions:

  • formatDate() - Formats dates to en-US
  • capitalize() - Capitalizes strings
  • generateId() - Generates random IDs

@my-workspace/app

Simple main application that uses the utilities and prints output with console.log.

🔍 Example Output

When you run the example project, you'll see:

🚀 Application started!
📅 Current date: 7/21/2025
✨ Formatted text: Hello world
🔑 Generated ID: x8k2m9p4q

👥 Users:
- John (john@email.com)
- Jane (jane@email.com)

🚀 Development

Working with the Workspace

# Install dependencies
cd project-workspace
pnpm install

# Run the application locally  
pnpm start

# Run tests
pnpm test

# Add dependencies to specific packages
pnpm --filter @my-workspace/app add lodash
pnpm --filter @my-workspace/utils add moment

Docker Development

# Rebuild after changes
./build.sh

# Run with volume mount for development
docker run --rm -it -v $(pwd)/project-workspace:/workspace pnpm-home:latest

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors