ds300 / ds300/patch-package

patch-package needs to look in the parent's node_modules when invoked on a dependency of another project

Open
#356 11 comments 16 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.2k
Forks
325
PR merge metrics
No merged PRs in 30d

Description

I am a contributor to a project that has a complex architecture. There is a a job runner whose jobs make calls to third-party APIs through a collection of specialized plugins. The plugins are in turn generated by an independently running factory app which runs in two processes -- one to handle a web front end for human consumption and the other which is the back end that exposes an API where the real work of generating the plugins happens.

The project has begun to use patch-package on both parts of the plugin factory and also within some of the plugins themselves. The trouble is that the factory's back end is installed as a dependency to the front end, and likewise the plugins are installed as dependencies in the cloud version of the job runner, so when patch-package tries to look in node_modules, it doesn't find anything because the (sub)dependencies have been installed up in the parent's node_modules, and we end up with errors like

> Error: Patch file found for package grpc-js which is not present at node_modules/@grpc/grpc-js

because @grpc/grpc-js has instead been installed in ../../ (there are two ../ because there's a namespace directory). We sort of kludged a workaround in the case of the factory because my team has control of both the front end and the back end, and so we've just duplicated the patches in both projects. The scenario with the cloud version of the job runner can't be solved the same way because it's under the control of another team, and besides that, duplicating patches is not scalable (there are hundreds of possible plugins).

I was wondering if anyone has encountered a situation like this, and if so, what the solution was. Thanks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.