Questions tagged [monorepo]
A monorepo is a single repository containing more than one project (in contrast to the single-repository-per-project approach).
monorepo
1,435
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 ...
57
votes
4
answers
22k
views
How to build a docker image from a nodejs project in a monorepo with yarn workspaces
We are currently looking into CI/CD with our team for our website. We recently also adapted to a monorepo structure as this keeps our dependencies and overview a lot easier. Currently testing etc is ...
37
votes
1
answer
18k
views
How to version products inside monorepo?
I have been educating myself about monorepos as I believe it is a great solution for my team and the current state of our projects. We have multiple web products (Client portal, Internal Portal, API, ...
34
votes
5
answers
17k
views
Sharing a typescript library in a monorepo
I'm trying to setup a monorepo with 3 services sharing some library code.
This is the current situation:
repo: web
pdf/
package.json
reference to shared-ts using github url
tsconfig.json
...
33
votes
1
answer
13k
views
How to manage SCSS stylesheets across a monorepo with different libraries sharing variables?
I have an angular monorepo set up via Nrwl and am using Angular Material's theming, which uses SASS.
I want the SCSS source files to import at the project level where I'll override default color ...
30
votes
5
answers
25k
views
nohoist with workspaces still hoisting
Inside my Monorepo I have one packages in which I want all the dependencies inside its node_modules.
But whatever I do, it's node_modules remains empty.
So, for the purpose of my question I was ...
29
votes
1
answer
8k
views
Can I exclude directories from GitHub Dependabot?
I have a directory /experiments in my repo which contains - surprise! - experiments. Those usually come with their own package.json which includes dependencies that were up to date at the time I made ...
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 ...
25
votes
3
answers
9k
views
Granular access to directories within monorepo
I've been reading about the advantages of monorepos, but haven't yet found a mitigation for the problem of sharing parts of a repo:
Let's say an organization has a monorepo for a client/server web ...
25
votes
4
answers
12k
views
Publishing Github packages for a monorepo as part of an organization
I have a Lerna monorepo on Github Enterprise which currently has two npm packages that I'm trying to publish to the Github package registry under the same repo.
For reference say they are:
github....
24
votes
2
answers
9k
views
Preventing inappropriate imports and enforcing project hierarchy in Typescript
In a TS project I'd like the following to be blocked:
A file from folder common importing from folder projectA
A file from folder projectB importing from folder projectA
I'd like the following to be ...
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 ...
24
votes
2
answers
5k
views
How to reuse pyproject.toml in monorepo with Poetry?
There are multiple projects in my monorepo, which has package management via Poetry individually. For instance,
monorepo
├── a
│ └── pyproject.toml
├── b
│ └── pyproject.toml
└── c
└── ...
23
votes
3
answers
9k
views
GitHub Cloud Build Integration with multiple cloudbuild.yamls in monorepo
GitHub's Google Cloud Build integration does not detect a cloudbuild.yaml or Dockerfile if it is not in the root of the repository.
When using a monorepo that contains multiple cloudbuild.yamls, how ...
23
votes
2
answers
16k
views
Monorepo with paths from Typescript is not working
I have monorepo (yarn workpaces) with following file structure:
├── client (workspace @client)
│ ├── package.json
│ └── tsconfig.json (extended tsconfig)
├── server ...
23
votes
2
answers
14k
views
Extend a "paths" tsconfig file for a monorepo
I've got a folder structure like so:
- mono-repo
tsconfig.paths.json
- Website
tsconfig.json
- src
test.ts
index.ts
- Tool
- src
index.ts
// mono-repo/tsconfig.paths....
23
votes
1
answer
4k
views
Yarn workspace, react, monorepo issue with conflict library version
I'm experimenting with yarn workspace monorepo. It is consisting of a TestProject created with create-react-app, and a SharedLib1 which is created with create-react-library. TestProject imports code ...
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 ...
22
votes
7
answers
16k
views
Global Type Declarations within a NX and NextJS monorepo
I've been looking around the web to try and find s nice solution to my problem but so far I have not.
I have a NX monorepo with NextJS and I am trying to create a global types/ folder that can be used ...
22
votes
2
answers
3k
views
How to deploy one app from a large monorepo with dependencies to packages in the same repo to google app engine?
I have a large node.js monorepo with several applications and packages and inter dependencies. It is all managed with yarn workspaces and a little bit of lerna. Everything works great for me, however ...
21
votes
3
answers
23k
views
NPM Workspaces Typescript unable to find local modules
I have a NodeJS monorepo set up using NPM workspaces and Typescript. It works fine without Typescript, however introducing TS brings some dependency resolving errors with it. Current directory setup:
+...
21
votes
4
answers
9k
views
Typescript: Yarn Workspaces IDE Support (IntelliJ, VSCode ...)
Working on a larger typescript project we decided to move the code to a monorepo with yarn workspaces.
We use webpack to build and bundle and everything works well (especially the linking between ...
20
votes
8
answers
20k
views
share env variable beween turborepo monorepo project
I ve setup a basic turborepo project and I want to share .env variables across the all the apps and some of packages. If I set one .env file in the root of project and how can all apps and packages ...
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) ...
20
votes
3
answers
11k
views
Create React App + Typescript In monorepo code sharing
I currently have a monorepo where I have two (+) packages using yarn workspaces:
root
/packages
/common
/web
...
root/package.json
...
"workspaces": {
"packages": [
"...
20
votes
2
answers
9k
views
How to configure Source code analysis for Monorepo?
I have a Mono repo in which all my Spring boot based micro service reside.
I know how to configure a SonarQube analysis for poly repo but wondering how sonarqube analysis can be done on a monorepo ...
20
votes
0
answers
5k
views
Typescript pnpm monorepo, path aliases conflicts between local dependencies during build
I have a PNPM with TurbeRepo monorepo, used this template. In this monorepo I have a NextJS app that uses a ui-shared package (local shared code, not actually an npm package).
The ui-shared is made in ...
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 ...
19
votes
1
answer
14k
views
Using different versions of a dependency in different packages of a Yarn Workspace
I'm relatively new to using Yarn Workspaces and having a Monorepo set up, so forgive me if this has been answered. I don't believe I've found a clear answer on whether or not this is possible for a ...
19
votes
4
answers
6k
views
Firebase Functions with Yarn workspaces
We're starting to adopt a monorepo setup using yarn workspaces and we'd like to have our firebase functions inside it. The repo structure is something like:
repo
node_modules <- all ...
19
votes
1
answer
3k
views
How can I maintain an automatic changelog per module in a monorepo?
I'm working on a project which consists of multiple git repositories. There are multiple microservices, a frontend, some npm-packages and gateway containers, etc.
As I often run into the problem that ...
18
votes
1
answer
11k
views
Angular + Jest: Can't resolve all parameters for AppComponent: (?)
I am operating inside a Typescript Monorepo. I want to add an Angular 8 frontend with Jest testing to the Monorepo. But I am encountering some issues.
I am using
Angular CLI: 8.3.5
What I did
I ...
18
votes
2
answers
25k
views
Eslint doesn't work in VScode, but work from terminal
I have monorepository managed by rush (https://rushjs.io/)
The structure of code is:
As you see, there are two eslint configs and two directories node_modules (it is just symlink created by rush).
...
18
votes
3
answers
14k
views
Jenkins multibranch pipeline only for subfolder
I have git monorepo with different apps. Currently I have single Jenkinsfile in root folder that contains pipeline for app alls. It is very time consuming to execute full pipeline for all apps when ...
18
votes
2
answers
1k
views
Share codebase using common Sdk module in create react app Reactjs application
I want to start a new app that will have both web and reactnative interfaces.
I decided to move all business -non enviroment dependent- code into a third package -aka sdk- that i can share between ...
17
votes
8
answers
27k
views
Nx CLI run many command is not working for multiple apps
I have tried using Nx in an attempt to make use of Monorepos. I have been facing an issue to serve multiple apps via nx run-many command. Can anyone correct me if I'm doing something wrong?
Command ...
17
votes
3
answers
20k
views
what the different between `pnpm install` and `pnpm add`?
I am work on monorepo stuff, and found that some guys use pnpm install to install packages in workspace, but some other use pnpm add.
in the pnpm docs, its seem like the same between add and install ...
17
votes
3
answers
10k
views
Jest Projects in a Monorepo unable to find config files in projects
Having trouble setting up jest projects.
Project A has some additional configuration that it runs (setupJest, creates some custom matchers, etc) that project B does not have. When I run jest I get ...
17
votes
1
answer
10k
views
NPM 8 workspaces - Install one package as the dependency for another package in monorepo
Say I have the following structure
packages
- @my-scope/packageA
- @my-scope/packageB
- @my-scope/packageC
Let's say I want to install packageA as a dependency of packageB. With NPM 8 ...
16
votes
3
answers
25k
views
tsconfig.json shows error: Entry point for implicit type library 'glob'
I have a Monorepo which uses Typescript. I have a common folder which shows this error on the top of the file -> Entry point for implicit type library 'glob'. I am not sure what is wrong with the ...
16
votes
2
answers
18k
views
Where to configure jest in a monorepo?
I am setting up a monorepo in which I am building a react app where I will be using typescript. We want to use jest to test backend features and React-Testing-Library to test frontend features. Should ...
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
2
answers
15k
views
Include a package for some libs in Nrwl/Nx workspace
It seems like in a Nrwl/Nx workspace there is only a single package.json file. Now if we have multiple applications, each dependent on different packages, then we have to include all of those package ...
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 ...
15
votes
2
answers
7k
views
How to bump version in all the packages when using yarn workspaces?
When using Yarn Workspaces, we have a project structure like:
- package.json
- packages/
- package-a/
- package.json
- index.js
- package-b/
- package.json
- ...
15
votes
2
answers
4k
views
Should a developer be able to create a docker artifact from a lerna monorepo in their development environment?
I've recently started using lerna to manage a monorepo, and in development it works fine.
Lerna creates symlinks between my various packages, and so tools like 'tsc --watch' or nodemon work fine for ...
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 ...