Skip to content

Instantly share code, notes, and snippets.

View cau777's full-sized avatar

Cauã Rinaldi cau777

View GitHub Profile
@cau777
cau777 / pnpm-overrides-fix.ts
Last active February 6, 2024 00:31
Simple TS script that reads patches from `pnpm audit` and manually applies them to package.json overrides, so that `pnpm` recognizes them properly. Meant to be used with `ts-node`
import { readFileSync, writeFileSync } from 'fs'
import semver from 'semver'
import { exec } from 'child_process'
// Currently, pnpm (version 8.5.1) is not recognizing overrides properly on install
// This is a temporary solution that simplifies the overrides generated by pnpm audit -P --json
// It basically gets rid of the vulnerable version specifier
interface SimplifiedPackageConfig {
pnpm?: {