Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
Socket

force-resolutions

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

force-resolutions

This package modifies package-lock.json to force the installation of specified versions of transitive dependencies

latest
Source
npmnpm
Version
1.0.11
Version published
Weekly downloads
36K
-1.44%
Maintainers
1
Weekly downloads
 
Created
Source

force-resolutions-logo

This package modifies package-lock.json to force the installation of specified versions of a set of transitive dependencies (dependencies of dependencies).

Getting started

  • Add a field resolutions with the dependency version you want to fix at the main level of your package.json.

Example:

"resolutions": {
  "ssri": "8.0.5"
}
  • Add force-resolutions to the preinstall script so that it patches the package-lock.json file before every npm install:
"scripts": {
  "preinstall": "npx force-resolutions"
}
  • Install dependencies
npm install

Remember that whenever you run npm install, the preinstall command will run automatically.

If a package.lock.json is not detected the script will not run, and any other command after it will be executed as normal.

  • To confirm that the right version of the package you are trying to override was installed, use:
npm ls ssri

Running this repository locally

NodeJS and NPM versions NodeJS version:

v16.13.1

NPM version:

8.1.2

Instructions

  • Install the dependencies of the project:
npm install
  • Build the project:
npm run build
  • Go to the dist folder
cd dist
  • Copy a package.json and a package-lock.json file into the dist folder

  • Add a resolutions field in the package.json and inside of it a package to override

  • Run the compiled file

node index.js
  • Search in the package-lock.json to see that the versions of the packages are updated

Why this project was created

This project was created because npm-force-resolutions became not suitable for the necesities the team I was working in had. We needed to avoid triggering the execution of the script when there was no package-lock.json, descriptive error logs, descriptive logs during the execution, faster download times, compatibility with multiple npm versions and faster execution times.

Discord community

To simplify communication I have created a discord community, if you detect an issue with this package or want to improve it in some way, you can contact me here:

Join discord community

NPM

Find the package on NPM

See other versions of the package on NPM

Acknowledgments

This project was inspired by the next package: npm-force-resolutions.

Special thanks to Denis Gulin for contributing to fix issues that were happening with the package and improving the code.

Keywords

force-resolutions

FAQs

Package last updated on 13 Jan 2023

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