Speakeasy Logo
Skip to Content

Switching default package manager to pnpm

Prerequisite

Adding pnpm Support

  1. Open the GitHub Actions workflow file (e.g., .github/workflows/sdk-generation.yaml).
  2. Modify the generate job to include the pnpm_version input. This ensures pnpm is installed during the action.

Example Workflow File

(Optional) Verifying pnpm Installation

Ensure pnpm is used in the workflow by adding a step to verify its presence:

This outputs the installed pnpm version for confirmation during workflow execution.

Additional Notes

  • Use the same pnpm_version as used in local development for consistency.
  • Ensure any package.json files are compatible with pnpm. Run pnpm install locally to verify.

Using PNPM in Monorepos

When working with monorepos, pnpm offers several advantages including strict module resolution and efficient workspace management. To configure Speakeasy to use pnpm in your monorepo:

Local Development Configuration

Add the compileCommand configuration to your gen.yaml file:

Workspace Configuration

Ensure your pnpm-workspace.yaml includes the SDK directory:

Benefits for Monorepos

  • Strict module resolution: Prevents dependency confusion between packages
  • Efficient storage: Shared dependencies across workspace packages
  • Better workspace support: Built-in monorepo tooling

Last updated on