Questions tagged [monorepo]
A monorepo is a single repository containing more than one project (in contrast to the single-repository-per-project approach).
monorepo
803
questions with no upvoted or accepted answers
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
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 ...
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 ...
12
votes
1
answer
1k
views
How can i Deploy a single npm workspace which depends on packages and other workspaces?
I created a project using npm workspaces and Typescript Project References pretty much exactly like this example repo: https://github.com/Quramy/npm-ts-workspaces-example.
This setup keeps all ...
12
votes
2
answers
9k
views
How to use Turborepo for an existing react app created with Create React App in order to make it a monorepo?
I have a fun project made with create react app. I want to convert the same application to a browser extension. This idea forces me to make the project a mono repo. Because in both applications, I ...
11
votes
1
answer
4k
views
Managing a Python Monorepo in PyCharm
I'm experimenting with monorepos & python. The idea is having multiple projects in the same repo, each project should have its own virtualenv.
I find it kinda cumbersome managing all of that in ...
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
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
702
views
Deploying yarn workspace monorepo app with internal dependencies to Google App Engine
I want to deploy my app from my monorepo to GAE. The app depends on local packages that I pre-publish to github packages. To make life easy, I just tell my app to always get latest:
"...
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
2k
views
Running ESLint in project subdir yields "heap out of memory"
If I run eslint . from my project-root, it prints all errors and warnings to the console, as I would expect it to.
However, when I cd into a subdirectory of the project, eslint . yields the following ...
9
votes
0
answers
785
views
Importing files in subdirectories when using Yarn Workspaces and Typescript
I'm having trouble porting a Yarn Workspaces monorepo to TypeScript. In the previous working version of the monorepo, moduleA could import something from a subdirectory of moduleB.
The new ported code ...
9
votes
0
answers
361
views
Monorepo + Pipelines: Can't specify buildpacks for review apps, and app.json can't be in the project root
I'm trying to set up a pipeline for my Monorepo structure similar to this:
> yarn.lock
> package.json
> packages
> my-heroku-app
> app.json
> Procfile
...
9
votes
1
answer
23k
views
TypeScript: Error: Cannot find module when using paths
I have a monorepo containing the Back-end(NodeJS), Front-end(Angular) and Shared directory (container models shared by the front-end and back-end.)
preagree-mono/
preagree-api/
preagree-app/
...
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.
...
8
votes
2
answers
10k
views
Jest: "Directory in the roots[0] option was not found"
I am trying to set up monorepo to run all of its Jest tests at once. In each package, I'm using react-app-rewired to get Babel to transpile code imported from other packages without ejecting from ...
7
votes
1
answer
2k
views
How to setup lint-staged with turbo monorepo?
I have a turbo monorepo, with packages/... and apps/app-a, apps/app-b .
I have set up husky pre-commit hook, which will run pnpm dlx lint-staged
I want lint-staged to run lint script from the closest ...
7
votes
0
answers
3k
views
When using npm workspaces, how to force a package to be installed in the relative node_modules?
Here are some related questions:
When using yarn workspaces, how to force a package to be installed in the relative node_modules?
NPM 7 Workspaces - Multiple node_modules?
Should I have to use no-...
7
votes
2
answers
8k
views
How to use monorepo packages with nestjs using turborepo?
Here's what a real simple monorepo with nestjs using turborepo looks like:
.
├── README.md
├── apps
│ └── nest
│ ├── README.md
│ ├── nest-cli.json
│ ├── package.json
│ ├── ...
7
votes
0
answers
789
views
How to pass arguments to filtered workspaces separately using Turborepo?
My use case is, I have two workspaces say foo and bar, and I want to pass the different command line args, is it possible to achieve such functionality with Turborepo.
I want to do something like this:...
7
votes
0
answers
1k
views
Command to build/run typescript project with NX
I am trying to run typescript file (within an app) that depends on a couple libraries with NX but I can not figure out how to do it. I've tried numerous methods, here are a couple ways I tried:
First ...
7
votes
1
answer
2k
views
"Error: Invalid hook call." when importing React component from shared component library in monorepo (turborepo & npm workspaces)
I've been setting up a monorepo with the goal of creating a shared component library to use for several different Next.js apps (following this example) but whenever I import a component from the ...
7
votes
0
answers
2k
views
how can i use absolute paths in same library in NX monorepo
I am working on Nx monorepo. We have 5 library and are using imports like this '../../components/Button' in library. but instead of this, we want to use absolute imports.
For example:
there are 2 ...
7
votes
2
answers
4k
views
TypeScript tsc type check with references in monorepos
I'm using Yarn Workspaces, and I want a cli-command to check the types of my source ts files located at packages/*.
Originally I build my project by using webpack (with esbuild, which does not check ...
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
1
answer
1k
views
Install Python package from monorepo
We have a private git monorepo which hosts a number of Python packages. Poetry was the dependency management tool initially chosen for the project. Anyway, due to this Poetry issue, it would not be ...
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
...
7
votes
0
answers
7k
views
Passing all node_modules path to AWS CodeBuild cache
Currently I'm using AWS CodeBuild to deploy my monorepo project and I'm trying to use its cache properties. I want to cache my node_modules folder and my buildspec.yml is:
version: 0.2
phases:
...
7
votes
0
answers
629
views
How do I get Heroku CI to run tests when using a monorepo?
I have a nodejs app in a subdirectory called node-server of a monorepo project.
I was able to leverage heroku-buildpack-monorepo project to allow me to deploy just the node-server directory to ...
6
votes
0
answers
1k
views
Turborepo preparing engine: Could not find "___ROOT___#build" in root turbo.json
When i run yarn build i get this error :
ERROR run failed: error preparing engine: Could not find "___ROOT___#build" in root turbo.json
Turbo error: error preparing engine: Could not find &...
6
votes
0
answers
854
views
Can I publish only a subset of packages in one Turborepo, using Changesets?
As seen in the Turborepo docs, the monorepo can include internal packages in order to share code between apps inside the monorepo.
There is also a docs section on how to publish packages in a monorepo,...
6
votes
0
answers
530
views
Eslint not working in VSCode for Next.js in a monorepo setup
I have a monorepo project for a full stack application. Two services that I'm working on right now are NestJs API and Next.js ssr/frontend.
My folder structure is as follows:
services/
api-main/
...
6
votes
0
answers
563
views
Create Common Shared Pages Working With Next JS and Turborepo
I have a monorepo created with turborepo which contains two next.js apps. The structures is as follows
base
|---apps
| |---editor
| | |---pages
| | |---index.js //this file is ...
6
votes
0
answers
961
views
What is the convention for using symbols like @, ~, #, etc. for path aliases in TypeScript
In a recent project, in the tsconfig.json, I found path aliases using the symbol @.
{
"compilerOptions": {
"target": "es5",
...
"baseUrl": ".&...
6
votes
0
answers
936
views
How to use local resolutions in yarn workspaces?
I have a monorepo based on yarn workspaces, with two projects, A and B. Both projects depend on the foo package.
I would like to create a resolution in the parent package.json file (since resolutions ...
6
votes
1
answer
4k
views
How to publish yarn workspace with root package.json dependencies?
I'm trying to publish one (yarn) workspace from a monorepo to npm repository, and include root project's dependencies in the published package. The setup is as follows:
package.json (contains shared ...
6
votes
0
answers
1k
views
How to include 3rd party dependencies in Nx library
New to Nx and not sure yet when it makes sense to extract code into libraries...
Is it possible/does it make sense to build an Nx library using a 3rd party dependency (let's say angular material) and ...
6
votes
0
answers
1k
views
Wrong dependency is getting picked up in monorepo and with yarn workspaces
We just started to use monorepo and yarn workspaces for two of our main projects. One is originally built on Angular 11 and another is in React.
We set up yarn workspaces, and on one project (Angular) ...
6
votes
0
answers
2k
views
Creating a usable library on npm... with yarn workspaces
I'm looking for feedback on a pattern I coded while tinkering around.
Context
I'm creating a package for my company, which going to be released publicly. The DX (Developer Experience) is the most ...
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 ...
6
votes
0
answers
496
views
How do I use ES6 imports in Detox tests with Yarn Workspaces?
I have already integrated Detox to my react native project (using yarn workspaces) and it works ok. But when I want to use import syntax the tests fail.
This is the error:
import { linkBarTest } ...
6
votes
0
answers
803
views
How to do group permissions in a Monorepo on Github
So we moving over to a monorepo structure and I'm left with the problem of how to restrict access to individual components within the repo on a team by team basis.
There isn't a feature on github(yet) ...
5
votes
0
answers
491
views
How to manage databases in a NX workspace
What is the best practice for managing databases in NX?
I am using Knex migrations to manage the schema of a database and would like to add this to the NX monorepo to simplify development, deployment, ...
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 ...
5
votes
0
answers
740
views
How to use two different React versions in a monorepo with Turborepo and avoid conflicts?
I'm creating a monorepo using Turborepo and have two applications in my apps folder: app-x, which uses "react": "17.0.2", and app-y, which uses "react": "18.0.2"...
5
votes
1
answer
1k
views
Error: Cannot find module '@nrwl/workspace/src/utilities/perf-logging'
I have try run Angular project of nxMonrepo and I have already install all node_modules and it didnot show any error when I try to run PS C:\Users\Dell\Desktop\MEANAPP\EAAPP> nx migrate --run-...