Skip to content

Improve the DX by making npm install smarter #59726

Description

@mountiny

Background

In projects where patches are frequently updated or modified, keeping track of and applying the latest versions of these patches can become a challenge. As patches evolve, they may conflict with existing dependencies, leading to failures during the npm install process.

Problem

Developers need to remove the entire node_modules folder every time patch-package fails, which is time-consuming and disrupts productivity.

Solution

Let’s improve the applyPatches script to handle failures caused by outdated or modified patches. When patch-package fails, the script will automatically remove the entire node_modules folder and then run npm install again to reinstall all dependencies and apply the patches correctly. To avoid circular npm installs on consecutive fails, create a flag file to keep track if npm install was already ran and on the second fail, exit the script; clean up the flag file in both cases. This approach ensures a smoother and more efficient process, reducing downtime and improving productivity for contributors.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.ReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions