|
| 1 | +# Migration to pnpm |
| 2 | + |
| 3 | +This project has been migrated from npm to pnpm to improve dependency management and developer experience. |
| 4 | + |
| 5 | +## Why pnpm? |
| 6 | + |
| 7 | +- **Faster installation**: pnpm is significantly faster than npm and yarn |
| 8 | +- **Disk space savings**: pnpm uses a content-addressable store to avoid duplication |
| 9 | +- **Phantom dependency prevention**: pnpm creates a strict node_modules structure |
| 10 | +- **Native workspaces support**: simplified monorepo management |
| 11 | + |
| 12 | +## How to use pnpm |
| 13 | + |
| 14 | +### Installation |
| 15 | + |
| 16 | +```bash |
| 17 | +# Global installation of pnpm |
| 18 | +npm install -g pnpm@10.8.1 |
| 19 | + |
| 20 | +# Or with corepack (available with Node.js 22+) |
| 21 | +corepack enable |
| 22 | +corepack prepare pnpm@10.8.1 --activate |
| 23 | +``` |
| 24 | + |
| 25 | +### Common commands |
| 26 | + |
| 27 | +| npm command | pnpm equivalent | |
| 28 | +| --------------- | ---------------- | |
| 29 | +| `npm install` | `pnpm install` | |
| 30 | +| `npm run build` | `pnpm run build` | |
| 31 | +| `npm test` | `pnpm test` | |
| 32 | +| `npm run lint` | `pnpm run lint` | |
| 33 | + |
| 34 | +### Workspace-specific commands |
| 35 | + |
| 36 | +| Action | Command | |
| 37 | +| ------------------------------------------ | ---------------------------------------- | |
| 38 | +| Run a command in a specific package | `pnpm --filter @openai/codex run build` | |
| 39 | +| Install a dependency in a specific package | `pnpm --filter @openai/codex add lodash` | |
| 40 | +| Run a command in all packages | `pnpm -r run test` | |
| 41 | + |
| 42 | +## Monorepo structure |
| 43 | + |
| 44 | +``` |
| 45 | +codex/ |
| 46 | +├── pnpm-workspace.yaml # Workspace configuration |
| 47 | +├── .npmrc # pnpm configuration |
| 48 | +├── package.json # Root dependencies and scripts |
| 49 | +├── codex-cli/ # Main package |
| 50 | +│ └── package.json # codex-cli specific dependencies |
| 51 | +└── docs/ # Documentation (future package) |
| 52 | +``` |
| 53 | + |
| 54 | +## Configuration files |
| 55 | + |
| 56 | +- **pnpm-workspace.yaml**: Defines the packages included in the monorepo |
| 57 | +- **.npmrc**: Configures pnpm behavior |
| 58 | +- **Root package.json**: Contains shared scripts and dependencies |
| 59 | + |
| 60 | +## CI/CD |
| 61 | + |
| 62 | +CI/CD workflows have been updated to use pnpm instead of npm. Make sure your CI environments use pnpm 10.8.1 or higher. |
| 63 | + |
| 64 | +## Known issues |
| 65 | + |
| 66 | +If you encounter issues with pnpm, try the following solutions: |
| 67 | + |
| 68 | +1. Remove the `node_modules` folder and `pnpm-lock.yaml` file, then run `pnpm install` |
| 69 | +2. Make sure you're using pnpm 10.8.1 or higher |
| 70 | +3. Verify that Node.js 22 or higher is installed |
0 commit comments