question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Breaks dependencies in mono repos when using yarn

See original GitHub issue

If I install my dependencies with yarn install --frozen-lockfile --production and ts-node is only part of my dev dependencies, ts-patch will run npm, not yarn, and destroy my mono repo node_modules.

Desired fix:

  • please use yarn when there’s a yarn.lock
  • alternatively; add an option to skip npm usage, and either throw a warning or an error when mismatch dependencies.

My workaround currently:

  • moved ts-node to dependencies

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
manuthcommented, Aug 24, 2021

Awesome! Thanks for the explanation 😄

1reaction
nonaracommented, Aug 24, 2021

I thought of something like a remark that you have to install ts-node in the Setup-section of your readme:

I considered it, but ts-node is not actually required to use ts-patch. The majority of people won’t need it to be installed, as they are using transformer packages, which are already compiled to js.

ts-node is only really necessary if you want to try to directly use a .ts transformer. In that case, it should be assumed that ts-node is necessary, but we also throw a pretty clear error message, so I think we’re covered.

https://github.com/nonara/ts-patch/blob/541df51364cf277d003e3ab892ee8a3a2ec5a30f/src/patch/lib/plugin.ts#L163-L169

That said, in v2, it will come pre-packaged, so there won’t be any error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Easily Manage Dependencies in a JS Monorepo
Phantom dependencies break the code when you publish. With Pnpm or yarn workspace every package in the monorepo has its own package.json and ......
Read more >
Workspaces in Yarn | Yarn Blog
Monorepos · Lerna · Introducing Yarn Workspaces · Setting up Workspaces · Managing dependencies of Workspaces · Integrating with Lerna · What is...
Read more >
Working with multiple monorepos #5426 - yarnpkg/yarn - GitHub
I have 2 mono repos with yarn workspaces: A and B. B packages are using packages from A. I want to be able...
Read more >
A guide through The Wild Wild West of setting up a mono repo ...
Yarn Workspaces is a feature that allows users to install dependencies from multiple package.json files in subfolders of a single root package.json file,...
Read more >
TypeScript Monorepos with Yarn - Semaphore CI
Now, create a building block and uncheck the Dependencies section. Removing block dependencies in the pipeline makes blocks run in parallel.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found