Questions tagged [lerna]

Lerna is a tool designed to help develop JavaScript projects in a single git repo containing multiple related npm packages.

The two primary commands in Lerna are lerna bootstrap and lerna publish.

bootstrap will link dependencies in the repo together. publish will help publish any updated packages.

Related links:

644 questions
20
votes
3 answers

Lerna specify run order

In my monorepo, I have 3 packages package1, package2, package3, each package contains a npm script named build. However, these packages are not linked together. I.e. there are no require() in any of those packages linking to a sibling package. From…
jeanpaul62
  • 9,451
  • 13
  • 54
  • 94
19
votes
3 answers

How to get rollup to include a dependency from another package in a lerna monorepo in its transpilation (TypeScript)?

I created a minimal example to show the question I have: Github repo. I have a lerna monorepo with two npm packages in the packages folder, the packages are called: utils: exports a function: export const add = (a:number, b: number) => a +…
evianpring
  • 3,316
  • 1
  • 25
  • 54
19
votes
2 answers

Are there any advantages to using Lerna with Yarn workspaces?

We're in the process of migrating our monorepo to use Lerna. Lerna supports both NPM and Yarn and furthermore allows configuration of use with Yarn workspaces. It's unclear to me whether Lerna with Yarn workspaces has any distinct advantages to…
axelyung
  • 463
  • 4
  • 9
15
votes
2 answers

Why does Yarn throw "Invariant Violation: expected workspace package to exist" when I attempt to upgrade some dependencies?

I have a monorepo that is managed by lerna which relies on the Yarn workspaces feature. It looks like this: /repo |-- packages | |-- pkg-a | | |-- package.json | |-- pkg-b | | |-- package.json | |-- pkg-c | | |--…
customcommander
  • 17,580
  • 5
  • 58
  • 84
15
votes
4 answers

How do I load a package from a package in a Lerna monorepo?

I have: packages -models -package.json -.... -server -src -index.ts -package.json In my packages/server/package.json, I have: "scripts": { "dev": "ts-node src/index.ts" }, "dependencies": { "@myapp/models":…
Shamoon
  • 41,293
  • 91
  • 306
  • 570
15
votes
3 answers

How to avoid install of packages in monorepo using Yarn

I built a monorepo using Lerna and Yarn workspaces. Everything works fine but everytime I install a new dependency on a package (let's call him A) using: yarn add Yarn adds it and then triggers the install script of all the packages…
Erazihel
  • 7,295
  • 6
  • 30
  • 53
15
votes
2 answers

How to install packages in just one package.json file in Yarn workspaces?

I have the classic Lerna set up. root directory, packages folder, 2 subdirectories I want to just run yarn install inside one package and just to install the dependencies for this package. for some reason when I run it (even from inside this folder)…
Red Baron
  • 7,181
  • 10
  • 39
  • 86
14
votes
2 answers

Lerna. Install dependencies to root project

I have standard Lerna repository like this: my-repo - package.json - packages - api - package.json - web-app - package.json If I need same dependency in both packages (for example lodash), then people in tutorials suggest to…
WelcomeTo
  • 19,843
  • 53
  • 170
  • 286
14
votes
1 answer

lerna link vs. lerna bootstrap

I have a Lerna project which until recently was using lerna bootstrap --hoist. This worked well but I found the devDependencies in the many sub folders were mostly identical. Upgrading to Lerna v3 I read about lerna link convert. Does lerna link…
user2965155
  • 319
  • 3
  • 6
13
votes
3 answers

Single ESLint setting for all Lerna sub repositories?

I have heard somewhere that it's possible to create just one ESlint preset for all Lerna subrepositories, but when begin to collect info actively about this did not found clear information. Why it's attractive If I want change the settings for…
Takeshi Tokugawa YD
  • 670
  • 5
  • 40
  • 124
13
votes
1 answer

VSCode - Lerna - Typescript - Monorepo Code Navigation

We have a monorepo for all our Javascript related SDKs here at Sentry. https://github.com/getsentry/sentry-javascript If you clone this repo, set it up properly with yarn install and then open any file like packages/node/src/backend.ts and try to…
HazA
  • 1,274
  • 12
  • 17
13
votes
3 answers

Use Lerna with React Native?

Is it possible to use Lerna (lernajs.io) with React Native? I'm attempting to create new project with the following structure: MyApp packages myapp-core myapp-mobile myapp-web lerna bootstrap doesn't seem to have any issues with core…
samcorcos
  • 2,330
  • 4
  • 27
  • 40
12
votes
4 answers

lerna add : No packages found where can be added

have added lerna to my project, i have added a package to my server by running this command successfully: lerna add @types/express --dev But when I want to add another one: lerna add graphql class-validator type-graphql I got this error : info…
Amir Meyari
  • 573
  • 4
  • 9
  • 30
12
votes
5 answers

"'rootDir' is expected to contain all source files" in monorepo

I'm working on converting a large(ish) monorepo into TypeScript for a client, however, I'm pretty new to TS myself and have run into an error that I can't find an obvious fix for. TS6059: File '[path to repo root]/packages/config/globals.ts' is not…
Alex Foxleigh
  • 1,784
  • 2
  • 21
  • 47
11
votes
2 answers

Lerna bootstrap does not link local dependencies?

What is the proper way of working with lerna and local dependencies? I have configured two modules in a mono repo to use lerna with a local dependency. I expected that $ lerna bootstrap $ lerna run test would be sufficient to download all external…
matsev
  • 32,104
  • 16
  • 121
  • 156
1
2
3
42 43