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
9
votes
1 answer

Bump version and publish packages from one branch but keep tags in another branch

I'm migrating my project consisting of many dependent on each other packages to monorepo with Lerna. We follow something like Gitflow workflow during development. The main concept is to make all source code changes in develop branch and all other…
ezze
  • 3,933
  • 2
  • 34
  • 58
9
votes
2 answers

Interrupt all lerna --parallel tasks at once

I have a lerna script (lerna dev) that boots up several package's dev servers with the --parallel option (if I didn't use that option, only the first service would start, but not the others). These servers serve their respective apps in dev mode on…
Gabriel Theron
  • 1,346
  • 3
  • 20
  • 49
9
votes
3 answers

Run specific jest project

I'm setting up a lerna monorepo with jest, I'm using jest's projects like so: projects: ['/packages/*']. Running tests work as expected, however, I'm not sure how can I run a specific project? Say I have: /packages jest.config.js /core …
donzul
  • 405
  • 1
  • 4
  • 13
9
votes
1 answer

Prioritize build order with yarn workspaces and lerna

I have this big typescript project in a mono-repository using yarn workspaces and lerna with the following architecture: repo ├── API │ └── (GraphQL API) ├── Apps │ └── (Front-end React Apps) ├── Libs │ └── (Shared libraries) └── Services …
Marco Daniel
  • 5,467
  • 5
  • 28
  • 36
9
votes
2 answers

Is it possible to break down the dependency list of a (published) package by creating new (non-published) "sub"-packages?

I maintain a JavaScript library that is published on the npm registry and it has lots of dependencies. It gets difficult to keep track of what part of the code depends on what external packages. Unfortunately neither lerna, yarn's workspaces, npm…
brillout
  • 7,804
  • 11
  • 72
  • 84
9
votes
1 answer

Jest fails to transpile import from npm linked module

I have a project with multiple modules (using Lerna) and I want to use Jest to run tests. However, when I test code that uses a shared module (npm linked module via Lerna) it seems that Babel is not correctly applied and I get the following…
Florian Eckerstorfer
  • 1,526
  • 1
  • 14
  • 21
8
votes
2 answers

How to configure Storybook to run from a directory other than the project root

I'm trying to configure Storybook to run from a directory that is not the root of the project and I'm having a little trouble. I've setup a mono-rep using https://github.com/jibin2706/cra-monorepo-demo as base. My project directory looks like…
Ian
  • 33,605
  • 26
  • 118
  • 198
8
votes
1 answer

How do I update all subfolder package.json in a monorepo to the same version?

I have a repository with a bunch of different front-end React projects, which all have package.json files of their own. I have four requrements: I want to keep all of these projects on the same dependency track. (ie, I want all my projects to use…
InspectorDanno
  • 935
  • 2
  • 12
  • 23
8
votes
1 answer

In npm/yarn workspaces, should packages consume src or dist

I want to use a monorepo for our frontend app. We want to divide some react UI components into a package folder under "/packages/ui-components" and leave the app in an "/apps/app" folder and then have the app consume ui-components by importing it…
8
votes
0 answers

How to automatically bump version of peerDependencies for local packages in a monorepository with yarn worskpaces?

When running lerna version or lerna publish it bumps versions of all the packages in yarn workspace and do update relevant devDependencies but keeps unchanged versions in peerDependencies so packages reference old & incorrect versions and that…
8
votes
0 answers

Lerna avoid symlink

I'm using the below command lerna bootstrap --hoist I want lerna to install all dev and prod dependencies of the packages to the main root node_modules. Some packages are dependencies of each other. When I run the bootstrap command it installs all…
javauser35
  • 1,177
  • 2
  • 14
  • 34
8
votes
2 answers

How to configure Webpack to load a module from its src folder instead of dist?

I am working on a monorepo and therefore I want Webpack to load my sources from src instead of dist (dist is specified in package.json). For example given the following structure: /packages/core/dist/index.js (compiled…
Kai Sellgren
  • 27,954
  • 10
  • 75
  • 87
8
votes
4 answers

How do I deploy monorepo code to AWS Lambda using lerna?

I am attempting to make two AWS Lambda functions (written in typescript). Both of these functions share the same code for interacting with an API. In order to not have to copy the same code to two different Lambdas, I would like to move my shared…
Crabby
  • 91
  • 1
  • 4
8
votes
2 answers

Jest in a React-Native project. How to Blacklist or delete duplicate modules?

I am trying to set up a React-Native project with lerna. When I try to run jest I face the following error. The name `setupDevtools` was looked up in the Haste module map. It cannot be resolved, because there exists several different files, or…
Kevin Amiranoff
  • 13,440
  • 11
  • 59
  • 90
8
votes
3 answers

Monolithic repo and multiple node_modules folder

I have a project using monolithic repositories. Each packages has his own package.json file to manage dependencies for the said package. I'm using lerna to install package in all "sub-packages" of our monorepo app. The current project structure…
Marc-Andre R.
  • 658
  • 7
  • 23