Skip to content

Combination of an Angular app with dependencies to a monorepo containing the libraries

Notifications You must be signed in to change notification settings

jogelin/build-angular-monorepo-and-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Buid Angular Monorepo and App (@bamaa)

The goal of this repo is to define a good way to build :

  • A monorepo containing a list of Javascript/Angular packages
  • An Angular app having dependencies to these packages

dependencies

Two main scenarios (for the moment) :
  1. Build both the monorepo and the app locally for development at two different place....BUT....It should be easy to serve the app and modify the libraries of the monorepo without publishing, installing, etc.. JUST CODING !!!

  2. Build both the monorepo and the app for production using a CI tool

Getting started

Remark : yarn is needed :

npm install yarn -g

Work locally

angular-monorepo

  1. Install :
$ yarn
  1. Bootstrap package :
$ yarn bootstrap
  1. Build package :
$ yarn build
  1. Post Build copy package.json in dist

angular-app

  1. Link to libs
$ yarn run link:internal
  1. Run the app
$ npm start (would like to use yarn but it check the lib on the registry even if they are links...)

Monorepo :

The goal is to be able to build all packages in a single command : npm run build

Tools

OAO

OAO is a lerna like using yarn and it support almost what we want to do. A packaging phase is missing

Today, even there are linked, yarn doesn't support libraries that are not found on the registry. A hack is to remove dependencies from the package.json, do the yarn install and recreate the package.json...

Scripts

OAO doesn't do the building/packaging of our libraries, some steps need to be executed before publishing :

  • transpile code using ngc
  • package code using rollup
  • copy static files :
    • copy and clean the package.json. Also replacing placeholders version to have common versions
    • copy the README.md

TODO/Constraints :

  • AOT compatible
  • links between app and monorepo
  • avoiding scripts with hardcoded libs names
  • having one tsconfig per lib...but with ngc on lib-3, they are strange duplications
  • be able to publish
  • remove dependency to ng2-translate in the angular-app

Useful articles about mono repo :

New wave modularity with Lerna, monorepos, and npm organizations : Article explaining the problematic and how npm organization works

Thoughts about package modularization : Article explaining the problematic of multiple packages and the lerna library

Setting Up a Javascript monorepo : Description of 2 tools, lerna and builder, but introduce a simpler bash script

Monorepo scaling project : Description of multiple tools and introduce his own tool : bumped

Babel : Example of monorepo usage and explanation

About

Combination of an Angular app with dependencies to a monorepo containing the libraries

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published