ds300 / ds300/patch-package

using turborepo / monorepo and npm

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

Description

Does `patch-package` support turborepo / monorepo using npm?

My repo has a similar structure to: https://github.com/vercel/turborepo/blob/main/examples/basic/README.md

Namely, each `app` / `package` (workspace) has a `package.json` but no `package-lock.json`, which gives me an error when trying to patch.

## Steps to Repo
- navigate to workspace
`cd apps/myApp`
- install `patch-package`
`npm i patch-package --save-dev`
- fix a bug in one of your dependencies
`vim node_modules/some-package/brokenFile.js`
- run patch-package to create a .patch file
`npx patch-package some-package`

```
Creating temporary folder
Error: Can't find yarn.lock file
```

It is throwing this error because it cannot find the `package-lock.json` in the workspace directory, so it assumes yarn.

https://github.com/ds300/patch-package/blob/bd2e9a49d884516199079add143c1649541e8efe/src/detectPackageManager.ts#L44-L45

## Patch Package in root

The package/file I want to patch is located in the `node_modules` of the `app` / `package` (workspace).

`apps/myApp/nod_modules/some-package`

Is it possible to target that via `npx patch-package some-package` when running in the root directory?

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.