By Luca Blanco, Pablo Fernndez, ngel Olmedo and Ral Prez What is - - PowerPoint PPT Presentation

by luc a blanco pablo fern ndez ngel olmedo and ra l p
SMART_READER_LITE
LIVE PREVIEW

By Luca Blanco, Pablo Fernndez, ngel Olmedo and Ral Prez What is - - PowerPoint PPT Presentation

By Luca Blanco, Pablo Fernndez, ngel Olmedo and Ral Prez What is ? (A brief introduction) How does it work? RESOLUTION FLETCHING LINKING Petitions to the registry and Check if dependency is Copy cache to


slide-1
SLIDE 1

By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez

slide-2
SLIDE 2

What is ?

(A brief introduction)

slide-3
SLIDE 3

RESOLUTION FLETCHING LINKING

How does it work?

Petitions to the registry and check dependencies in the directory. Check if dependency is already in cache’s global directory. Copy cache to node_modules in local directory.

slide-4
SLIDE 4

Stakeholders

  • Software Architects
  • Development Teams
  • Project Managers
  • Companies (StackShare,

Docplanner...) Basically, anyone who works with dependencies!

slide-5
SLIDE 5

Quality Goals

slide-6
SLIDE 6

Performance

  • Offline caché
  • Multithreading
  • Zero Installs
  • Network Performance
slide-7
SLIDE 7

Reliability

  • Detailed but concise lockfile format
  • The same dependencies will be installed in the same exact

way on any machine, regardless of installation order

  • Network resilience
slide-8
SLIDE 8

Security

  • Checksums to verify the integrity of every installed package

before its code is executed.

slide-9
SLIDE 9

Usability

  • Simple commands
  • Per-Project installation
  • Plug’n’Play feature
slide-10
SLIDE 10

Constraints

slide-11
SLIDE 11

Prior Art

  • Bundler
  • Cargo
  • npm
slide-12
SLIDE 12

JavaScript

  • Programming decisions.
  • Follow language specific coding styles.
slide-13
SLIDE 13

Lockfile

Supporting lockfiles has its tradeoffs

slide-14
SLIDE 14

Technical Context

slide-15
SLIDE 15

Basic concepts

  • Dependency: Piece of software on which a project relies
  • Package: A package contains all the code being shared as well as a manifest
  • Manifest: File named package.json which describes the package
slide-16
SLIDE 16

General architecture

  • Core: Module that contains the logic required to manage a program

○ Exposes the base components that make up a program ○ Clases from the API

  • CLI: Injects prebuilt Yarn plugins into the environment
  • Third-party plugins

○ Simple codebase ○ Freedom to implement external logic

slide-17
SLIDE 17

Contributing to Yarn

slide-18
SLIDE 18

Repositories

  • Github: Two different repositories
slide-19
SLIDE 19

Repositories

Two different versions:

  • Yarn 1.22.0 (classic): original implementation of Yarn written completely in

JavaScript

  • Yarn berry (version 2): modular API implementation, mainly written in TypeScript

and JavaScript. Being implemented since 2019.

slide-20
SLIDE 20

Building Yarn

Steps to build Yarn berry locally:

  • Install Yarn
  • Clone the repo
  • Open local directory in an editor (VSCode)
  • Run yarn build:cli
slide-21
SLIDE 21

Building Yarn

Building cli allows our initial global installation of yarn to reflect changes done to the code locally

slide-22
SLIDE 22

Modifying a command

slide-23
SLIDE 23

Modifying a command

  • Help shown when typing yarn config --help will be modified
  • Found in the file config.ts, in plugin-essentials package
slide-24
SLIDE 24

Modifying a command

This is the normal output of running yarn config --help This is the output after modifying config.ts

slide-25
SLIDE 25

Installing Dependencies

slide-26
SLIDE 26

Normal installation

Run yarn install on your project folder (package.json needed). Yarn will install all the dependencies

slide-27
SLIDE 27

Other options

  • yarn install --flat: Install only one version of the package.
  • yarn install --force: Re-download all packages.
  • yarn install --production: Install only production dependencies