Your organisation relies on third‑party libraries. Sooner or later, your security tools will flag a critical bug in a dependency of a dependency. The original project still uses the unsafe version, the maintainers are inactive, and your release is close. You need a safe, fast fix that doesn’t change product behaviour.
Make the smallest safe change so the build passes checks and the schedule stays on track.
Given this, most teams should choose fork‑patch‑publish.
Keep the fork small:
This lowers risk, meets checks, and keeps the release on time.
In short: make the smallest change needed to remove the issue.
Forking gives the fastest, lowest‑risk path to a green build while keeping behaviour the same.
Publishing a forked package to npm isn’t always possible. Use it when these hold:
If you meet these criteria, publishing a forked package is a sensible, low‑risk way to unblock a release.
This approach came from a real case:
Example dependency swap in package.json:
{
"dependencies": {
"linkedin-api-js-client": "npm:@ruchernchong/linkedin-api-client@^X.Y.Z"
}
}Thinking like an organisation on your side projects pays off at work. Use the same habits:
While working on my SG Cars Trends side project, I hit a similar problem. I solved it the same way: make a small, safe change, document it, and keep behaviour the same. Here’s the commit:
https://github.com/sgcarstrends/sgcarstrends/commit/3c122d94d1f0d9625eaf0295438c1be6d83ef3e8
Switch in one of two ways. Replace names and versions as needed.
Option A — override the transitive dependency (works well for monorepos):
{
"overrides": {
"<vulnerable-dependency>": "^<safe-version>"
}
}Option B — swap the package to the forked publish name (no code changes required):
{
"dependencies": {
"<original-package>": "npm:@your-scope/<forked-package>@^X.Y.Z"
}
}For npm you can use overrides; for Yarn use resolutions; for pnpm use top‑level overrides. Pick the simplest option your tooling supports.
This builds good habits, reduces risk, and makes it easier to bring useful ideas back into the company.
If your team hits a similar blocker, make the smallest safe change to pass checks, ship the release, and keep a clear plan to remove the fork.