Skip to content

using turborepo / monorepo and npm #551

Open
@mdroidian

Description

@mdroidian

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.

const packageLockExists = fs.existsSync(
join(appRootPath, "package-lock.json"),

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions