All Questions
200
questions
61
votes
1
answer
30k
views
the difference between nx and Lerna ? (monorepos)
hello i'm in new in monorepos world and i'm now searching about different monorepos tools
and i found two intersting tools Nx(nrwl) and lerna but i didn't understand the real differnce between these ...
29
votes
1
answer
15k
views
Peer Dependencies In A Monorepo
When packages in a monorepo have peer dependencies, how should these dependencies be made available to them during development?
For example a package at /packages/namespace/alpha/ might have a ...
26
votes
6
answers
53k
views
Building Typescript: [!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
I've encountered problem building typescript packages with rollup inside lerna managed monorepo.
Error:
lerna ERR! rollup --config ../../rollup.config.js stderr:
loaded ../../rollup.config.js with ...
24
votes
2
answers
4k
views
Install package from lerna-managed monorepo via git URL
I am using yarn for my project. My project has a dependency which happened to be a subpackage of larger monorepo maintained by lerna.
The subpackage was updated but not published yet and I need that ...
23
votes
0
answers
3k
views
With Yarn workspaces, how can compiled binaries be linked to the workspace post-compilation?
Context
Yarn workspaces provide for a convenient mono-repo-like functionality where packages are automatically linked. I.e. they can require/import each other, and their binaries are linked and ...
20
votes
2
answers
16k
views
How Should VSCode Be Configured To Support A Lerna Monorepo?
I have a lerna monorepo containing lots of packages.
I'm trying to achieve the following:
Ensure that VSCode provides the correct import suggestions (based on package names, not on relative paths) ...
19
votes
2
answers
4k
views
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 ...
15
votes
3
answers
8k
views
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 <package_name>
Yarn adds it ...
15
votes
1
answer
4k
views
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 ...
15
votes
4
answers
13k
views
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"
},...
15
votes
2
answers
19k
views
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 ...
14
votes
6
answers
20k
views
"'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 ...
14
votes
1
answer
4k
views
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 ...
11
votes
1
answer
10k
views
"Lerna List" and "Lerna Changed" Returns 0 Packages
Gist
I have a monorepo and I am using yarn workspaces and lerna to manage it. I had no issues with it until now. I need to know all the changed packages since the last release.
Issue
So I run lerna ...
11
votes
1
answer
3k
views
Enforcing shared dependencies in a monorepo
We have a monorepo using lerna and yarn workspaces. Multiple teams contribute packages to it and there are some common dependencies where we want to force people to use the same version.
What are the ...
11
votes
0
answers
3k
views
How to generate per-package package-lock.json for existing Lerna mono-repo
We have an existing Lerna mono-repo that has a structure like:
/
/packages
/package1
/package2
/package3
...
We currently use Yarn for our project, and actually only have a top-...
10
votes
5
answers
12k
views
Lerna always lists all packages ready to publish when running workflow of Github actions
Lerna does not correctly detect packages change during running workflow of Github actions.
If I make none packages related changes, commit and runlerna updatedlocally. it tells me No changed packages ...
10
votes
1
answer
3k
views
How to Share Build Scripts In Lerna Packages
I have a lerna repo that contains multiple packages organised in the usual structure:
package.json
/packages
- alpha
package.json
- bravo
package.json
- charlie
package.json
I need ...
10
votes
0
answers
1k
views
create-react-app + gatsby packages in monorepo won't both run
I'm trying to create a monorepo with these packages:
a web app created using create-react-app
a gatsby site
a library of components etc. that the web app and gatsby app will share (which is my main ...
10
votes
0
answers
860
views
How do you share uncompiled typescript between React Native and Next.js in a monorepo?
I have settled a monorepo with Lerna and Yarn Workspaces with this structure:
project
| - packages
| - ReactNativeApp
| - NextJsApp
| - FirebaseCloudFunctions
| - Common
| - ...
9
votes
1
answer
4k
views
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 ...
9
votes
2
answers
10k
views
Yarn Link All Packages/Workspaces
Yarn's link allows you to register a local package for symlinking into another local package. To use link you cd into the package directory and run yarn link. This works fine on individual packages, ...
9
votes
2
answers
12k
views
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",...
9
votes
1
answer
3k
views
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....
8
votes
2
answers
15k
views
How to use lint-staged in a lerna monorepo to run the same command in all packages?
I have the following root package.json:
{
"name": "project",
"private": true,
"workspaces": [
"packages/*"
],
"scripts": {
...
8
votes
2
answers
3k
views
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/...
8
votes
0
answers
2k
views
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.
...
7
votes
3
answers
3k
views
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 ...
7
votes
2
answers
4k
views
Yarn workspaces best practice when using shared library
I have a common (or not so coomon) scenario for yarn workspaces and didn't find the right guide for me online.
yarn workspaces look like that:
- monorepo
- packages
- client
- admin
...
7
votes
0
answers
620
views
Deduplicating assets in a monorepo
My file structure is as follows:
- packages
- app1
- node_modules
- shared
- public
- svg1
- src/pages
- app2
- node_modules
...
7
votes
0
answers
2k
views
Force Hoisting Of Package Dependencies In Yarn (v1) Workspace
I have a monorepo containing many packages. It is using yarn(v1) workspaces. One of the packages contains a set of development dependencies (packages/example-dev/@example/dev) that are consumed as a ...
7
votes
0
answers
4k
views
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
...
6
votes
2
answers
3k
views
Can't resolve 'fs' in firebase-admin/lib' when using nextjs monorepo project with lerna
I have a Lerna MonoRepo project setup.
Like
root/
lerna.json
packgae.json
package.lock.json
packages/
app1 - Create react app (with firebase sdk dependency)
app2 - Next Js ...
6
votes
1
answer
2k
views
Yarn workspace + lerna is creating node_modules in each sub-package
I have a monorepo which I'm managing with yarn workspaces + lerna. From what I understand, running yarn should create a node_modules directory at the root of the project but not in each individual ...
6
votes
2
answers
2k
views
What is a correct approach to a javascript monorepo
I'm trying to figure out correct approach for a javascript monorepo. Imagine monorepo containing packages / libraries:
root
- node_modules
- packages
+ lib-a
* node_modules
+...
6
votes
1
answer
4k
views
How Can I Fix VSCode Import Path Suggestions In Lerna Monorepo?
VSCode does a great job with autosuggesting imports, however inside a (Lerna) monorepo it only suggests relative paths from one package to another, for example:
import example from '../../../@scope/...
6
votes
1
answer
2k
views
Is lerna bootstrap command useful when using yarn workspace
I'm using lerna in combination with yarn workspaces.
In that case, all the package hoisting and symlinking is handled by yarn workspaces.
In that particular case, what's the role of the lerna bootsrap ...
6
votes
1
answer
2k
views
with lerna monorepo, how to reference different versions of a shared package?
New to lerna and monorepo, my understanding is with lerna, we put all shared packages and all consumer packages in a single repo. Then after 'lerna bootstrap', consumer1 and consumer2 will both have a ...
6
votes
1
answer
3k
views
How do you publish and install a private npm package to GitHub packages as an organisation?
We have a monorepo with a shared package called "@myorganization/common", that is used by both the app and Google cloud functions.
Google cloud functions requires that the package is ...
6
votes
1
answer
2k
views
Dealing with Docker images in a Javascript/Typescript monorepo with unpublished packages
I've been trying to find a clear answer to this problem, but unfortunately I haven't been able to. There are two similar SO questions that touch on this subject,
Should a developer be able to create a ...
6
votes
0
answers
198
views
How to automate publish in a CI environment?
We are using lerna to manage a monorepo and we want to automate the publishing process:
The developer makes changes in one of the packages in the monorepo
The CI detects that changes have been made
...
6
votes
0
answers
1k
views
lerna not generating node_module in packages
I have a monorepo with Lerna and typescript with a basic structure
- root
package.json
- packages
package-A
package.json
src
package-B
package.json
...
6
votes
0
answers
3k
views
typescript monorepo "@/*" alias
I'm moving my projects to a monorepo with Lerna and yarn workspace.
I managed to setup the basic stuffs but I'm stuck with this issue and can't find similar problem on the web.
As you can see on the ...
6
votes
1
answer
1k
views
Is there any way to avoid symlinking in monorepo built with yarn workspaces and lerna?
Lets say there is a monorepo with package A and B.
Package A is dependent on B. Package B is also published in npm registry. So when installing dependencies it does not install the package B from npm ...
5
votes
2
answers
9k
views
Can Lerna bump prerelease version according to the Conventional Commits specification?
It doesn't seem that Lerna 3.20.2 is able to bump prerelease versions (e.g. 1.0.0-alpha.0) according to the Conventional Commits specification.
I made a Minimal Reproducible Example if you want to ...
5
votes
1
answer
7k
views
Monorepo with Lerna and TypeScript fails to import package by path alias
I am trying to setup a TypeScript based monorepo using Lerna where I have two packages, bar and foo. foo imports bar by path alias and fails doing so.
tree
.
├── lerna.json
├── package.json
├── ...
5
votes
1
answer
2k
views
How to use Typescript's references and build mode to compile a mono repo to a serverless bundle?
Typescript recently introduced a new feature to work with monorepos: references. By specifying references you can build all interdependent packages using tsc -b (see also this blog post)
This seems ...
5
votes
1
answer
2k
views
Why vscode doesn't intellisense function inside packages in typescript monorepo?
I created a monorepo with lerna (the code in github).
Inside I have two packages each package export sum function.
In app1 folder I want to import this function but vscode doesn't find the function.
...
5
votes
1
answer
1k
views
How to manage multiple monorepos
In our projects we have multiple monorepos used across whole company. The problem is, that we have for example monorepo-A and monorepo-B and monorepo-B uses components from monorepo-A (this is ...
5
votes
0
answers
543
views
Bundle Prisma Client in a module
I'm having questions, on prisma generated clients, maybe I'm doing things wrong.
I Have a monorepo with the following modules dependency tree:
Module A -
|- Module C
Module B -
Module A ...