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 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 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 Slide

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

    View Slide

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

    View Slide

  6. 6
    DEPENDENCIES
    APP 1
    DEPENDENCIES
    APP 2
    Projects
    architecture

    View Slide

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

    View Slide

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

    View Slide

  9. Prerequisites
    9

    View Slide

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

    View Slide

  11. What it does
    11

    View Slide

  12. Demo
    12

    View Slide

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

    View Slide

  14. yarn workspaces
    14

    View Slide

  15. Lerna config
    15

    View Slide

  16. What happen to the structure
    16

    View Slide

  17. Demo
    17

    View Slide

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

    View Slide

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

    View Slide