MONOREPO

Behind the scenes (lerna edition)

MASMOVIL TECHNOLOGY

CHANGED PACKAGES

 

DEPENDENCIES CACHE

 

BUILD CACHE

CHANGED PACKAGES

release

master

a

b

1

2

3

4

5

6

apps

commons

release

master

a

b

1

2

3

4

5

6

PACKAGES => 2

release

master

a

b

1

2

3

4

5

6

PACKAGES => 1

release

master

a

b

1

2

3

4

5

6

PACKAGES => 2

release

master

a

b

1

2

3

4

5

6

PACKAGES => 1, 2

release

master

a

b

1

2

3

4

5

6

PACKAGES => 3, 4, 5, 6

release

master

a

b

1

2

3

4

5

6

PACKAGES => 1, 2, 3, 4, 5, 6

master => since last release

 

 

branches => since master-head

 

 

release! release! release!

DEPENDENCIES CACHE

Dependencies

lockfile

package

package

package

pipeline

Lint

Test

Build

lockfile

SHA

sd34afg

install

sd34afg.tgz

node_modules

Dependencies

lockfile

package

package

package

pipeline

Lint

Test

Build

SHA

sd34afg

untar

node_modules

deps cache

install

sd34afg.tgz?

yes

no

lockfile

package

package

package

lockfile

SHA

zslwps9

install

zslwps9.tgz

node_modules

+

-

DEPS CACHE INVALIDATION

lockfile

package

package

package

install

node_modules

DEPS CACHE INVALIDATION

no cache invalidation!!!

!!!

lockfile

SHA

sd34afg

DEPS CACHE INVALIDATION

{
  "name": "masfront",
  "version": "1.0.0",
  "lockfileVersion": 2,
  ...
}

 New packages requires manual lockfile upgrade 

package-lock.json

Align dependencies version

 

Communicate packages/dependencies addition or upgrades

 

Lockfile upgrade => Manual cache invalidation

BUILD CACHE

Dependencies

pipeline

Lint

Test

Build

BUILD_ID + BRANCH_NAME => 13-PR-123

build

13-PR-123.tgz

dist

Dependencies

pipeline

Lint

Test

Build

BUILD-CACHE.tgz

Build

Docker

Dockerfile

DEPS-CACHE.tgz

Docker image

from node

copy cache

untar

run

Avoid install/build inside docker

Hermetic image builds

 

Secure docker builds

Q&A

@anthanh | #frontend-general | #mas-front

Icons made by Becris from www.flaticon.com

Monorepo: Behind the scenes (Lerna edition)

By Anthanh

Monorepo: Behind the scenes (Lerna edition)

How we operate with monorepo daily

  • 656