Slide 1

Slide 1 text

TypeScript + lerna + yarn monorepos FTW Paris TypeScript #10 10/10/2017 1

Slide 2

Slide 2 text

Me, myself & I Paul Souche Front End developer @S_A_N_T_E_C_H In love with TypeScript since 2014 @paul.souche paulsouche @paulsouche 2

Slide 3

Slide 3 text

Multi repos : why ? - Monoliths no more - Build only the necessary - Clearer subversion history - Easier revert - 1 app > 1 repo - 1 service > 1 repo... 3

Slide 4

Slide 4 text

Multi repos : but ... - Switch project all the time - Sequential builds - Evergreen anti pattern - Dependencies - Versioning - Features branch 4

Slide 5

Slide 5 text

- Build everything everytime - Build order - Subversion Conflicts - Licenses 5 Did you said monorepo?

Slide 6

Slide 6 text

6 DEPENDENCIES APP 1 DEPENDENCIES APP 2 Projects architecture

Slide 7

Slide 7 text

Editor architecture 7 DEPENDENCIES COMMON 2 COMMON 1 APP 1 APP 2 APP 3 APP 4

Slide 8

Slide 8 text

Lerna << Lerna is a tool that optimizes the workflow around managing multi-package repositories with git and npm >> 8

Slide 9

Slide 9 text

Prerequisites 9

Slide 10

Slide 10 text

Lerna project structure - lerna import - lerna bootstrap 10

Slide 11

Slide 11 text

What it does 11

Slide 12

Slide 12 text

Demo 12

Slide 13

Slide 13 text

Yeah… But ? - devDependencies are the same so lerna bootstrap could be very slow for more packages (cache) - Build is sequential 13

Slide 14

Slide 14 text

yarn workspaces 14

Slide 15

Slide 15 text

Lerna config 15

Slide 16

Slide 16 text

What happen to the structure 16

Slide 17

Slide 17 text

Demo 17

Slide 18

Slide 18 text

Build 18 - Several flags such as --parallel I won’t talk about - Bash is always the answer for uncommon problems

Slide 19

Slide 19 text

That’s all folks THANKS References Lerna Yarn workspaces Demo 19