Skip to main content

Questions tagged [monorepo]

A monorepo is a single repository containing more than one project (in contrast to the single-repository-per-project approach).

Filter by
Sorted by
Tagged with
5 votes
9 answers
7k views

Angular monorepo error TS6059: File 'ng-youtube-api.service.ngtypecheck.ts' is not under 'rootDir'. 'rootDir' is expected to contain all source files

I've created 3 angular libraries/packages: @example/ng-youtube-player containing a YoutubePlayerComponent and YoutubeApiService @example/ng-dailymotion-player containing a DailymotionPlayerComponent ...
Pieterjan's user avatar
  • 3,526
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 ...
Dan Dascalescu's user avatar
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 ...
sabrehagen's user avatar
  • 1,597
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": [ "...
Brandon's user avatar
  • 1,027
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 ...
Thiago Nascimento's user avatar
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/ | - ...
Raul's user avatar
  • 2,981
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 ...
Jeanluca Scaljeri's user avatar
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 ...
Undistraction's user avatar
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 ...
Ben Carp's user avatar
  • 25.8k
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 ...
J V's user avatar
  • 733
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 ...
Algirdyz's user avatar
  • 617
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 ...
dwjohnston's user avatar
  • 12.4k
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 ...
Hivaga's user avatar
  • 4,296
7 votes
2 answers
5k views

NPM Workspaces monorepo - share local package's distribution folder as root instead of the entire source files

Using NPM Workspaces, I'm sharing one package (components) with others (webapp1 and webapp2). Something like this: root apps webapp1 webapp2 packages components Everything is ...
Johnny Oshika's user avatar
5 votes
1 answer
3k views

How to set up Lerna monorepo with TypeScript

I have a core library with the following in package.json: "main": "dist/cjs/index.js", "module": "dist/esm/index.js", "es2015": "dist/es2015/index.js", "types": "dist/es2015/index.d.ts", "typings": "...
Kai Sellgren's user avatar
  • 29.6k
4 votes
1 answer
4k views

React Native in yarn workspaces not resolving external packages

I am using yarn workspaces to create monorepo for react and react-native. I tried to add redux to @app/common and it works fine with react, but it is not resolving in native. You can see the source at ...
Faisal Manzer's user avatar
1 vote
1 answer
637 views

Azure pipeline conditional release with NX monorepo

We have a NX monorepo with several projects inside and are using nx affected to determine which projects have been touched. This works very nicely for our build pipelines but we want to release our ...
Vince V.'s user avatar
  • 3,143
1 vote
1 answer
2k views

Two projects in one repository with GitHub Actions (monorepo)

I am currently working on my personal e-commerce project that I am developing with Java/spring boot for the backend and angular for the frontend. Both projects (frontend and backend) are in a single ...
can's user avatar
  • 23
0 votes
1 answer
755 views

How to use NX DTO libraries decorated with NestJS swagger api in frontend frameworks

I have a nestjs dto in my NX project library declared like following: import { ApiProperty } from '@nestjs/swagger'; import { MinLength, MaxLength, IsNotEmpty, IsEmail } from 'class-validator'; class ...
Noman's user avatar
  • 151
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 ...
33Fraise33's user avatar
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 ...
Corentin S.'s user avatar
  • 5,920
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 ...
Kevin Beal's user avatar
  • 10.8k
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 ...
Kirill Morozov's user avatar
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 ...
Max Komarychev's user avatar
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: +...
Brady Harper's user avatar
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) ...
Undistraction's user avatar
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 ...
axelyung's user avatar
  • 463
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 ...
Florian Ludewig's user avatar
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 ...
BingeCode's user avatar
  • 1,639
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 ...
hmlee's user avatar
  • 877
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 ...
hurrtz's user avatar
  • 1,973
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 ...
Richard Liebmann's user avatar
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 ...
Jeremy Thomerson's user avatar
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 &...
Stefan's user avatar
  • 1,292
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 ...
eded's user avatar
  • 3,918
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: "...
FrozenKiwi's user avatar
  • 1,483
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 ...
Alex Pab's user avatar
  • 137
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 ...
Joe Attardi's user avatar
  • 4,501
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....
Alexander Kachkaev's user avatar
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, ...
Undistraction's user avatar
8 votes
2 answers
8k views

Angular Libraries Monorepo: Is it possible to use different versions for every library?

just a simple question I can't seem to find an answer for. I'm trying to build a monorepo which should be able to use angular-cli v8, but still being able to compile and build libraries (mainly ...
Michael Di Prisco's user avatar
7 votes
3 answers
7k views

React-native, monorepo: Unable to resolve module @babel/runtime/helpers/interopRequireDefault

I've set up a react-native app as workspace in a monorepo. I did this because I want to share some react components I've created between my mobile and web apps. The basic structure of my repo is: ...
Jim B.'s user avatar
  • 4,654
7 votes
4 answers
21k views

How to change the ts path aliases for an nx application

I am importing an existing application into an NX monorepo with a file structure a little different from default apps. It looks like this: apps my-app src feature-1 feature-2 ...
plusheen's user avatar
  • 1,364
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 ...
llioor's user avatar
  • 6,178
7 votes
2 answers
5k views

NX Error for Relative Imports within the Same Project

I'm getting an error when using TS aliased paths within the same project: Projects should use relative imports to import from other files within the same project I don't want this behavior. Any idea ...
S. C.'s user avatar
  • 187
6 votes
3 answers
7k views

TypeORM migration with nx-Monorepo Issue

I tried this a lot but now I think I need some help. I have a nx-monorepo with angular-frontend and nestjs backend. Now I added a Postgres-SQL database with TypeORM. Everything is working fine, ...
igl1991's user avatar
  • 61
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 ...
y_nk's user avatar
  • 2,234
5 votes
1 answer
4k views

How to I get hot module reloading to work in a typescript monorepo

So I've been trying for the last few days completely in vain to get hot module reloading working in my Typescript/React/Koa/Mongo based monorepo; I feel like I've been banging my head against a brick ...
Ben Wainwright's user avatar
5 votes
1 answer
4k views

What is a sensible structure for multiple-language project in source control?

At work we're developing a large-scale application with quite a few front-end, back-end and support components. Typically the front-end is developed in C# and the back-end is developed in Java, ...
5 votes
1 answer
1k views

How can I deploy to Google App Engine an app that depends on a yarn workspaces without publishing the packages to a npm registry?

I am currently migrating our monorepo to yarn workspaces. It contains multiple packages and services. Services depends on packages in their respective package.json. I would like to deploy my services ...
Gabriel Colson's user avatar