Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TypeScript + lerna + yarn monorepos FTW

paul souche
October 08, 2017

TypeScript + lerna + yarn monorepos FTW

paul souche

October 08, 2017
Tweet

More Decks by paul souche

Other Decks in Programming

Transcript

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

    View full-size slide

  2. 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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  6. 6
    DEPENDENCIES
    APP 1
    DEPENDENCIES
    APP 2
    Projects
    architecture

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  9. Prerequisites
    9

    View full-size slide

  10. Lerna project structure
    - lerna import
    - lerna bootstrap
    10

    View full-size slide

  11. What it does
    11

    View full-size slide

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

    View full-size slide

  13. yarn workspaces
    14

    View full-size slide

  14. Lerna config
    15

    View full-size slide

  15. What happen to the structure
    16

    View full-size slide

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

    View full-size slide

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

    View full-size slide