Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@stephansama/pnpm-hooks

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stephansama/pnpm-hooks

preconfigured pnpm hooks and types for pnpmfile

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

@stephansama/pnpm-hooks

source code documentation npm socket.dev jsr npm downloads

tsdown

preconfigured pnpm hooks and types for pnpmfile

Table of contents
Open Table of contents

Installation

pnpm install @stephansama/pnpm-hooks

Why

pnpmfile hooks are useful, but the types and small reusable hook helpers are easy to reimplement in every workspace. This package collects both:

  • ready-to-use pnpm hook implementations
  • exported TypeScript types for authoring your own pnpmfile hooks

What this package exports

The package exposes two top-level namespaces:

  • readPackageHooks prebuilt readPackage hook utilities
  • types pnpm hook types including PnpmFileHooks, ReadPackageHook, BeforePackingHook, AfterAllResolvedHook, ImportPackageHook, PreResolutionHook, and UpdateConfigHook

Included hooks

The sections below are organized so each hook can carry its own behavior notes and example output as the package grows.

readPackageHooks.pinAllDependencies

Pins dependency ranges by removing leading ^ and ~ prefixes from:

  • dependencies
  • devDependencies
  • optionalDependencies

This runs on every manifest processed by pnpm through the readPackage hook, which makes it useful for workspaces that want consistently pinned transitive and nested dependency ranges during resolution.

Hook examples

readPackageHooks.pinAllDependencies

Given a dependency manifest like this:

{
  "dependencies": {
    "react": "^19.1.0"
  },
  "devDependencies": {
    "typescript": "~5.9.2"
  },
  "optionalDependencies": {
    "@types/node": "^24.0.0"
  }
}

pinAllDependencies rewrites it to:

{
  "dependencies": {
    "react": "19.1.0"
  },
  "devDependencies": {
    "typescript": "5.9.2"
  },
  "optionalDependencies": {
    "@types/node": "24.0.0"
  }
}

Requirements

  • Node.js >=24
  • a pnpm setup that loads a pnpmfile

Usage

import { readPackageHooks } from "@stephansama/pnpm-hooks";

/** @type {import("../dist/index.mjs").types.PnpmFileHooks} */
export const hooks = {
  readPackage: readPackageHooks.pinAllDependencies,
};

Keywords

pnpm-hooks

FAQs

Package last updated on 16 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts