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

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

Transcript of Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía...

Page 1: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

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

Page 2: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

What is ?(A brief introduction)

Page 3: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

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_modulesin local directory.

Page 4: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Stakeholders● Software Architects

● Development Teams

● Project Managers

● Companies (StackShare, Docplanner...)

Basically, anyone who works with dependencies!

Page 5: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Quality Goals

Page 6: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Performance

● Offline caché

● Multithreading

● Zero Installs

● Network Performance

Page 7: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

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

Page 8: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Security

● Checksums to verify the integrity of every installed package

before its code is executed.

Page 9: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Usability

● Simple commands

● Per-Project installation

● Plug’n’Play feature

Page 10: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Constraints

Page 11: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Prior Art

● Bundler

● Cargo

● npm

Page 12: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

JavaScript

● Programming decisions.

● Follow language specific coding styles.

Page 13: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Lockfile

Supporting lockfiles has its tradeoffs

Page 14: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Technical Context

Page 15: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

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

Page 16: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

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

Page 17: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Contributing to Yarn

Page 18: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Repositories

● Github: Two different repositories

Page 19: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

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.

Page 20: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Building Yarn

Steps to build Yarn berry locally:

● Install Yarn

● Clone the repo

● Open local directory in an editor (VSCode)

● Run yarn build:cli

Page 21: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Building Yarn

Building cli allows our initial

global installation of yarn to

reflect changes done to the code

locally

Page 22: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Modifying a command

Page 23: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Modifying a command

● Help shown when typing yarn config --help will be modified

● Found in the file config.ts, in plugin-essentials package

Page 24: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Modifying a command

This is the normal output of running

yarn config --help

This is the output after modifying config.ts

Page 25: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Installing Dependencies

Page 26: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

Normal installation

Run yarn install on your project folder

(package.json needed).

Yarn will install all the dependencies

Page 27: Olmedo and Raúl Pérez By Lucía Blanco, Pablo Fernández, Ángel · 2021. 5. 28. · By Lucía Blanco, Pablo Fernández, Ángel Olmedo and Raúl Pérez. What is ? (A brief introduction)

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