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
14
votes
2
answers
11k
views
Cannot find "lint" target for the specified project OR Data path "" must have required property 'lintFilePatterns'
After changing my project structure to a monorepo structure in Angular according to this tutorial, I encountered numerous config bugs that I managed to squash after lots of troubleshooting.
The full ...
14
votes
2
answers
4k
views
Go to Typescript Source Definition instead of Compiled Definition in Visual Studio Code
I am working on a typescript project with Visual Studio Code including multiple npm packages structured like this:
Source code: /src/index.ts
Compiled code: /dist/...
When I right click on imported ...
14
votes
1
answer
17k
views
Issues building a TypeScript monorepo project
I have a fairly simple mono repo. It is available on GitLab
here. This uses yarn workspaces, TypeScript, Jest, ts-jest
and ESLint with eslint-plugin-import.
I am trying to properly build the project ...
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 ...
13
votes
4
answers
7k
views
Styled-jsx typescript error after migrating to monorepo structure. Property 'jsx' does not exist on type 'DetailedHTMLProps'
I am using styled-jsx in my project and I just migrated it to a monorepo structure, and since then I have been having the following problem:
Type '{ children: string; jsx: true; }' is not ...
13
votes
1
answer
5k
views
How to refresh monorepo TypeScript types in VS Code without reloading the window
I have an open source project called react-querybuilder that is maintained as a monorepo. Most of the TypeScript type definitions live in the ts package.
When I have a file open in VS Code for one of ...
13
votes
8
answers
13k
views
Building library with imports from another library using NX Monorepo
Here is the case. I am using Nrwl NX Monorepo. I have 2 libraries: lib-a and lib-b; both are publishable libraries created via NX.
Now I create a MyClass.ts in lib-a. Naturally under paths in ...
13
votes
1
answer
5k
views
How to share a global.d.ts from several packages in monorepo
I have my interface definitions of the result of several database queries in a global.d.ts file. As I moved the various project folders using those interfaces into a single monorepo, I am still using ...
13
votes
3
answers
5k
views
Babel: root programmatic options
I seem to not grasp where to put root programmatic options for the babel.
If I have a monorepo and need to tell the different sub packages that they shall look upwards for my babel.config.js then I ...
13
votes
2
answers
7k
views
Sharing config variables across projects in a monorepo using yarn workspaces?
Is it possible to share config variables / env variables across subfolders of a monorepo that is set up using yarn workspaces? We've got a monorepo for a project, and several of the subfolders are ...
12
votes
1
answer
15k
views
migrating to yarn 3 + workspaces + nohoist
I'm migrating from yarn 1.xx to yarn 3 and I'm currently having a workspaces definition with nohoist configuration in my package.json:
"workspaces": {
"packages": [
&...
12
votes
1
answer
2k
views
Import shared code in Next.js app in a monorepo
I want to leverage monorepo by reusing types, DTOs, and other isomorphic app stuff from the backend (Nest.js) services within the same mono repo. In my case the next.js app and the nest.js app (which ...
12
votes
2
answers
3k
views
Using Peer Dependencies With Local (file:../some-lib) Dependencies
I have a monorepo that has many micro-services in it. There are some library-type functions / classes that I want to make available to any micro-service that needs it. However, if that library package ...
12
votes
2
answers
14k
views
@nrwl/nx angular Run all test for coverage in a single test run to get all covered code in my mono repo
I'm running tests in multiple projects of my nx angular monorepo and would like to get a single code coverage report of all projects with all code files covert from the tests. The test-runs seems to ...
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
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
2
answers
11k
views
Typescript eslint tsconfig resolution error in monorepo
I have the following project structure:
/root
/serviceA
/serviceB
/serviceC
/serviceD
Not all of the services are typescript / node based, so I want to avoid adding tsconfig into the root. ...
11
votes
1
answer
6k
views
pnpm in monorepo - how to run a command only in a specific package?
Let's say I want to install a package in a specific package in my monorepo, how do I do this from root?
in npm, you can do this with something like this:
npm install react --workspace=a
I searched ...
11
votes
1
answer
5k
views
pnpm -- sync versions of dependencies
Let's say I have the following stricture for a Javascript monorepo
-- module a
package.json
-- module b
package.json
package.json
Module A and Module B both depend on lodash.
With pnpm, is ...
11
votes
1
answer
9k
views
monorepo Yarn workspaces - shared esLint and Prettier configs
How someone could share esLint/prettier config across Yarn workspaces(no NPM, Lerna and etc).
I try to keep things pretty high level but I have tried to create a separate package for esLint config and ...
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
1
answer
6k
views
How can I get live-reload on a local npm package in a monorepo?
I'm setting up a monorepo workspace for a Vue 3 (vite + ts), cloud functions, & shared-lib (shared functions and ts interfaces etc.).
I can get the import of my local shared-lib folder to work. 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-...
11
votes
1
answer
2k
views
Typescript: resolve relative import path when using symlinks
This seems like a dumb question, but I struggle to find the answer.
The situation
Here is my folder structure:
myProject/
├── module1/
│ ├── config.ts
│ └── init.ts #symlink
├── module2/
│ ├── ...
10
votes
5
answers
47k
views
Npm workspaces - call workspace script from root package
I'm struggling with multiple npm packages in a root git repository with custom dev scripts to handle launch, compile, build and so on. Now I came across npm workspaces and wanted to use this stunning ...
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
5
answers
31k
views
Uncaught SyntaxError: Cannot use 'import.meta' outside a module - Nx Monorepo
I created an angular nx monorepo and created two applications. When I start either of them I get the following error:
I already saw some stackoverflow posts were the answers suggested to just add &...
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
1
answer
6k
views
How to migrate multiple repositories into a mono-repo while maintaining commit history?
I'm trying to migrate a few Git repositories into one monorepo.
I have two project repositories, let's call them project1 and project2. In my monorepo, I want to have a projects directory with two ...
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
5
answers
12k
views
how to delete all node_modules from all packages in npm 7 workspace monorepo
how can I delete all node_modules folders from all packages in an npm 7 workspace?
With Lerna we could just execute lerna clean -y but when migrating to native NPM 7+ workspaces, is there some ...
9
votes
3
answers
4k
views
GitOps - Config in same repo or seperate repo?
Firstly this is in the context of a mono-repo application that runs inside Kubernetes.
In GitOps my understanding is everything is declarative and written in configuration files such as YAML. This ...
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
1
answer
6k
views
Nrwl / Nx - how to build single js file consumable by browser with dependencies bundled
I need to build a single js that can be used as Service Worker.
I have a nrwl workspace with two @nrwl/web:lib packages, one is common and the other is worker. The worker package uses common through ...
9
votes
3
answers
5k
views
Bazel - Build, Push, Deploy Docker Containers to Kubernetes within Monorepo
I have a monorepo with some backend (Node.js) and frontend (Angular) services. Currently my deployment process looks like this:
Check if tests pass
Build docker images for my services
Push docker ...
9
votes
3
answers
6k
views
Turborepo Eslint config not applying
I created a Turborepo testing project and I wanted to try if ESlint config that it's set in the root of the Turborepo applies to all of the projects inside my /apps folder, turns out it does not work ...
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
2
answers
2k
views
Flow: resolving modules in a monorepo that uses Yarn workspaces
We have a monorepo that uses Yarn’s ‘workspaces’ feature, meaning that whenever possible, Yarn will hoist dependencies to the monorepo's root node_modules directory rather than keep them in the ...
9
votes
2
answers
3k
views
Monorepo - Multiple .vscode settings
Project structure
I have the following project structure:
/
| - .vscode/
| - - - - settings.json
|
| - packages/
| - - - - app/
| - - - - - - index.js
| - - - - - - package.json
| - - - - website/
| - ...
9
votes
1
answer
709
views
How to set Docker Compose `env_file` relative to `.yml` file when multiple `--file` option is used?
I am trying to set my env_file configuration to be relative to each of the multiple docker-compose.yml file locations instead of relative to the first docker-compose.yml.
The documentation (https://...
9
votes
1
answer
2k
views
Conditional Cloud Builds with Many Packages in a Monorepo
Motive
I want to fully automate the deployment of many services with the help of Google Cloud Build and Google Kubernetes Engine. Those services are located inside a monorepo, which has a folder ...
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....
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
...