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

How to ensure Master and Dev branches are kept in sync when deploying from CI/CD with Semantic Versioning or Lerna Publish

Setup I have several gitlab repos where the general setup involves having a master branch, a stage (pre-release) branch and a dev branch. Push permissions are disabled for all 3 branches. The workflow is to fork from the dev branch for any…
7
votes
0 answers

Deduplicating assets in a monorepo

My file structure is as follows: - packages - app1 - node_modules - shared - public - svg1 - src/pages - app2 - node_modules - shared - public - svg1 …
slider
  • 2,736
  • 4
  • 33
  • 69
7
votes
1 answer

Dockerizing multiple Node apps with Lerna in mono repository

I am having some problems with my mono-repository and Docker project setup. I want to use Lerna for my mono-repository setup, and Docker for project building. Before I integrated Lerna things were working just fine, but now I have Lerna integrated…
Musayyab Naveed
  • 365
  • 5
  • 14
7
votes
1 answer

Lerna publish adds gitHead key to package.jsons

I've got the following scripts in my root package.json in my lerna repo: "scripts": { "lerna:changed": "npx lerna changed", "lerna:diff": "npx lerna diff", "lerna:publish": "npx lerna publish" } After running npm run lerna:publish I…
fumeng
  • 1,771
  • 5
  • 22
  • 61
7
votes
0 answers

Lerna publish : determine published generated version number

When running lerna publish within our pipeline like so : lerna publish --yes --force-publish=* --canary --preid 2760 --registry Is there a way of getting the actual published version of the artifact. One solution I can think of is trying to parse…
vanzylv
  • 841
  • 2
  • 10
  • 22
7
votes
3 answers

creating a monorepo without hosting on a package registry and installing via bitbucket

At my organization, we are trying to create a monorepo of react components so they can be used on several sites. We currently have a repo called react-components hosted on bitbucket and we wanted to set it up as a monorepo using lerna.js so the…
James Daly
  • 1,357
  • 16
  • 26
7
votes
1 answer

JSDoc does not work in local package in a Lerna monorepo project using webpack dev server but works when released to package registry

Github Project repo: https://github.com/Fralleee/lerna-intellisense-jsdoc-vscode I have a monorepo project with two packages (Web & API). These are linked using Lerna. The Web project imports the API package, and the API requests are documented…
Fralle
  • 889
  • 6
  • 12
7
votes
0 answers

Connect local packages in monorepo with lerna

I'm trying to setup a Monorepo with Lerna and yarn workspaces, but the thing that I cannot get to work is where I try to add packages as a dependency of an other local package So, what does that mean I have a project structure like this / …
Jeanluca Scaljeri
  • 26,343
  • 56
  • 205
  • 333
7
votes
1 answer

How to import a local git repo in lerna?

I am trying to use lerna for the first time. When I use: lerna import /path/to/my/create_react_app This is the response: lerna notice cli v3.13.1 lerna ERR! Error: Command failed: git rev-parse HEAD lerna ERR! fatal: ambiguous argument 'HEAD':…
bier hier
  • 20,970
  • 42
  • 97
  • 166
7
votes
1 answer

How to deal with env files in monorepo?

How to deal with env files in monorepo with lerna? I was wondering if I should have one env file in the root of the repository for every app? or should each app have it's own env file? I can't find any references to this issue.
Jon Sud
  • 10,211
  • 17
  • 76
  • 174
7
votes
1 answer

Type definitions for peer packages in TypeScript monorepos: development vs production

I have a monorepo project that uses yarn workspaces and lerna; all its parts are written in TypeScript. The modules are located in subfolders like packages/module-n and each module has its own package.json with the following lines: "main":…
6
votes
1 answer

NPM Install pre-release versions for peer dependency

We have a mono-repository using lerna. On every pull request, we would like to create a pre-release version and publish it. Demo Project for better understanding => react-lerna-demo Package structure: util-lib shared-ui --> util-lib…
kk-dev11
  • 2,654
  • 5
  • 37
  • 48
6
votes
1 answer

Lerna / Nx / Turborepo or other monorepo systems for non-js apps (php)

I have repository with /frontend (JS/Vue) and /backend (PHP) and docker-compose.yml for development. But now I need to add another JS frontend that will be sharing some components, libs etc. I do not want to repeat code, so I found that I can use…
norr
  • 1,725
  • 1
  • 20
  • 33
6
votes
0 answers

Rollup bundling peer dependencies / Multiple instances of MUI make the ThemeProvider not work

I have two different repos I'm working on, lib and apps. lib has some React components made with MUI that I want to consume in apps, and that's built with Rollup. apps is a Lerna monorepo with a Next.js app that imports lib as a dependency to…
Danziger
  • 19,628
  • 4
  • 53
  • 83
6
votes
2 answers

What does a `workspace:` prefix in a package.json 'dependencies' value mean?

Where can I learn more about what is workspace: prefix in version number? For example, in Babel: "dependencies": { "@babel/helper-plugin-utils": "workspace:^7.13.0", source
Anton Dozortsev
  • 4,782
  • 5
  • 34
  • 69