The Zen of Yarn

Rate this content
Bookmark

In the past years Yarn took a spot as one of the most common tools used to develop JavaScript projects, in no small part thanks to an opinionated set of guiding principles. But what are they? How do they apply to Yarn in practice? And just as important: how do they benefit you and your projects?


In this talk we won't dive into benchmarks or feature sets: instead, you'll learn how we approach Yarn’s development, how we explore new paths, how we keep our codebase healthy, and generally why we think Yarn will remain firmly set in our ecosystem for the years to come.

This talk has been presented at DevOps.js Conf 2022, check out the latest edition of this JavaScript Conference.

FAQ

We offer free articles, videos, courses, and tutorials to help you learn all about React.

React was introduced in 2011.

React is popular because it enables modern apps by look and function, and has become essential for both web and mobile developers.

TypeScript lets you write JavaScript the way you want to, improving the development experience with various courses available to explore.

Mael works for Japanese social networks and Datadog as part of the developer efficiency team. He has also been leading the development of the Yarn package manager since 2017.

The main goal of Yarn is to ensure stability and consistency in your projects, making it a safe bet for long-term use.

The 'Zen of Python' is a set of philosophical guidelines for writing Python code, such as 'beautiful is better than ugly.' Mael has created a similar set of guidelines for Yarn to ensure it remains maintainable and user-friendly.

Yarn ensures consistency by standardizing the nomenclature for all flags, settings, and commands, making it easier for users to remember and use them.

Some key principles include: 'Uniform is better than varying,' 'Stable is better than unstable,' 'Readable is better than messy,' and 'Errors are great tools.'

Using the same version ensures consistent behavior across all development environments, reducing the risk of difficult-to-debug issues.

Maël Nison
Maël Nison
31 min
24 Mar, 2022

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Let's talk about React and TypeScript, Yarn's philosophy and long-term relevance, stability and error handling in Yarn, Yarn's behavior and open source sustainability, investing in maintenance and future contributors, contributing to the JavaScript ecosystem, open-source contribution experience, maintaining naming consistency in large projects, version consistency and strictness in Yarn, and Yarn 4 experiments for performance improvement.
Available in Español: La filosofía de Yarn

1. Introduction to React and TypeScript

Short description:

Let's talk about React, a framework introduced in 2011 that has become essential for web and mobile developers. TypeScript allows you to write JavaScript the way you want to and improves the development experience.

And now, let's talk about React. We're bringing free articles, videos, courses, and tutorials to help you learn all about React. Introduced in 2011, the framework has become essential for web and mobile developers alike, enabling modern apps by look and function. And while other JS tools have expanded or revised its original notions, React's popularity is still the one to beat

Did you know that TypeScript lets you write JavaScript the way you really want to? Explore the variety of TypeScript courses we compiled from our speakers and collaborators and find out what you can do with this language and how it improves the development experience

2. Introduction to Yarn and Its Philosophy

Short description:

Hello everyone, my name is Mael, and today we're going to talk about Yarn, a package manager that has been thriving and will continue to do so in the future. We will focus on the project itself, its philosophy, and why it's a safe bet for your project. Yarn is designed to make developers' lives easier by allowing them to focus on writing products instead of dealing with tools and infrastructure. We will also discuss how to evaluate projects and make conscious choices. Let's start by exploring the Zen of Python and how it can be applied to Yarn. Yarn is here to stay for the next 10 years, ensuring its long-term relevance and coolness.

Hello everyone, my name is Mael, and today we're going to talk a bit about young. So first, let me tell you a bit who I am. So I work for the Japanese and social networks and I work at Datadog and part of the developer efficiency team. And our job is to make sure that developers working at Datadog, product developers, can focus on writing products and don't have to deal with maintaining tools or infrastructure or deployments or this kind of stuff.

As part of that I've been also contributing to the Yarn package manager, and in fact, leading its development since 2017. Let me ask you a question for this talk. How do you evaluate projects? All tools have their own strengths and weaknesses and it's your job, as developers, to decide which one you will want to use on a project in order to benefit the project itself. And as maintainers of open source projects, our job is to give you all the information you need in order to make a conscious choice that will allow you to move forward in your implementations.

So in order to do that, I could tell you the feature list of Yarn. But I don't think it would be as useful as many people make it sound. Indeed, a feature list is transient, it's just a point in time. If I was to tell you the feature list of Yarn, all the nice things it can do for you, it would quickly become obsolete when we are going to implement new ones. And in fact, we are working on Yarn 4. So, as you can guess, new things will come in the next version. So, instead of doing that and making this talk obsolete as I'm speaking it, we are going to focus on the project itself and how it works, why does Yarn thrive, why will it keep doing so in the future, why is it a safe bet for your project? That's what I think would be interesting to discuss.

In order to do this, I remembered something called the Zen of Python. You might not know it, but in Python, if you are doing a special type of import, you're going to get a poem printed on screen. I put the lines there, like, beautiful is better than ugly, explicit is better than implicit, simple is better than complex, you see the picture. The idea is that all those statements are actually the philosophy of Python code. So if you write Python code, it's supposed to be simple is better than complex, it's supposed to be flat more than less, this kind of stuff. I really like this format and I wonder what would it look like if it was on YARN. I wrote those statements. I'm leaving it on screen for a few seconds, but you don't have to read it, we're going to go over each and every one of them, so don't read it, just screenshot if you want.

Ok, let's start. But before we start, one last thing. YARN is there for the 10 years to come, that's our goal. So all the slides that I'm going to follow have to be put inside this context. We are working on this project not only so that it's cool now, but also so that it remains cool for the future. So, first statement. Uniform is better than varying.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Levelling up Monorepos with npm Workspaces
DevOps.js Conf 2022DevOps.js Conf 2022
33 min
Levelling up Monorepos with npm Workspaces
Top Content
NPM workspaces help manage multiple nested packages within a single top-level package, improving since the release of NPM CLI 7.0. You can easily add dependencies to workspaces and handle duplications. Running scripts and orchestration in a monorepo is made easier with NPM workspaces. The npm pkg command is useful for setting and retrieving keys and values from package.json files. NPM workspaces offer benefits compared to Lerna and future plans include better workspace linking and adding missing features.
Automating All the Code & Testing Things with GitHub Actions
React Advanced 2021React Advanced 2021
19 min
Automating All the Code & Testing Things with GitHub Actions
Top Content
We will learn how to automate code and testing with GitHub Actions, including linting, formatting, testing, and deployments. Automating deployments with scripts and Git hooks can help avoid mistakes. Popular CI-CD frameworks like Jenkins offer powerful orchestration but can be challenging to work with. GitHub Actions are flexible and approachable, allowing for environment setup, testing, deployment, and custom actions. A custom AppleTools Eyes GitHub action simplifies visual testing. Other examples include automating content reminders for sharing old content and tutorials.
Fine-tuning DevOps for People over Perfection
DevOps.js Conf 2022DevOps.js Conf 2022
33 min
Fine-tuning DevOps for People over Perfection
Top Content
DevOps is a journey that varies for each company, and remote work makes transformation challenging. Pull requests can be frustrating and slow, but success stories like Mateo Colia's company show the benefits of deploying every day. Challenges with tools and vulnerabilities require careful consideration and prioritization. Investing in documentation and people is important for efficient workflows and team growth. Trust is more important than excessive control when deploying to production.
Why is CI so Damn Slow?
DevOps.js Conf 2022DevOps.js Conf 2022
27 min
Why is CI so Damn Slow?
Slow CI has a negative impact on productivity and finances. Debugging CI workflows and tool slowness is even worse. Dependencies impact CI and waiting for NPM or YARN is frustrating. The ideal CI job involves native programs for static jobs and lightweight environments for dynamic jobs. Improving formatter performance and linting is a priority. Performance optimization and fast tools are essential for CI and developers using slower hardware.
Atomic Deployment for JS Hipsters
DevOps.js Conf 2024DevOps.js Conf 2024
25 min
Atomic Deployment for JS Hipsters
This Talk discusses atomic deployment for JavaScript and TypeScript, focusing on automated deployment processes, Git hooks, and using hard links to copy changes. The speaker demonstrates setting up a bare repository, configuring deployment variables, and using the post-receive hook to push changes to production. They also cover environment setup, branch configuration, and the build process. The Talk concludes with tips on real use cases, webhooks, and wrapping the deployment process.
How to Build CI/CD Pipelines for a Microservices Application
DevOps.js Conf 2021DevOps.js Conf 2021
33 min
How to Build CI/CD Pipelines for a Microservices Application
Top Content
This Talk discusses the benefits of microservices and containers for building CI-CD pipelines. It explains how container technology enables portability and scalability. The challenges of microservices include network communication and testing in isolation. The Talk introduces Tacton, a cloud-native CICD pipeline for Kubernetes, and highlights the use of GitOps and Argo CD. It also discusses the importance of maintaining referential integrity between microservices and the evolving role of operators in the DevOps world.

Workshops on related topic

Deploying React Native Apps in the Cloud
React Summit 2023React Summit 2023
88 min
Deploying React Native Apps in the Cloud
WorkshopFree
Cecelia Martinez
Cecelia Martinez
Deploying React Native apps manually on a local machine can be complex. The differences between Android and iOS require developers to use specific tools and processes for each platform, including hardware requirements for iOS. Manual deployments also make it difficult to manage signing credentials, environment configurations, track releases, and to collaborate as a team.
Appflow is the cloud mobile DevOps platform built by Ionic. Using a service like Appflow to build React Native apps not only provides access to powerful computing resources, it can simplify the deployment process by providing a centralized environment for managing and distributing your app to multiple platforms. This can save time and resources, enable collaboration, as well as improve the overall reliability and scalability of an app.
In this workshop, you’ll deploy a React Native application for delivery to Android and iOS test devices using Appflow. You’ll also learn the steps for publishing to Google Play and Apple App Stores. No previous experience with deploying native applications is required, and you’ll come away with a deeper understanding of the mobile deployment process and best practices for how to use a cloud mobile DevOps platform to ship quickly at scale.
MERN Stack Application Deployment in Kubernetes
DevOps.js Conf 2022DevOps.js Conf 2022
152 min
MERN Stack Application Deployment in Kubernetes
Workshop
Joel Lord
Joel Lord
Deploying and managing JavaScript applications in Kubernetes can get tricky. Especially when a database also has to be part of the deployment. MongoDB Atlas has made developers' lives much easier, however, how do you take a SaaS product and integrate it with your existing Kubernetes cluster? This is where the MongoDB Atlas Operator comes into play. In this workshop, the attendees will learn about how to create a MERN (MongoDB, Express, React, Node.js) application locally, and how to deploy everything into a Kubernetes cluster with the Atlas Operator.
Azure Static Web Apps (SWA) with Azure DevOps
DevOps.js Conf 2022DevOps.js Conf 2022
13 min
Azure Static Web Apps (SWA) with Azure DevOps
WorkshopFree
Juarez Barbosa Junior
Juarez Barbosa Junior
Azure Static Web Apps were launched earlier in 2021, and out of the box, they could integrate your existing repository and deploy your Static Web App from Azure DevOps. This workshop demonstrates how to publish an Azure Static Web App with Azure DevOps.
How to develop, build, and deploy Node.js microservices with Pulumi and Azure DevOps
DevOps.js Conf 2022DevOps.js Conf 2022
163 min
How to develop, build, and deploy Node.js microservices with Pulumi and Azure DevOps
Workshop
Alex Korzhikov
Andrew Reddikh
2 authors
The workshop gives a practical perspective of key principles needed to develop, build, and maintain a set of microservices in the Node.js stack. It covers specifics of creating isolated TypeScript services using the monorepo approach with lerna and yarn workspaces. The workshop includes an overview and a live exercise to create cloud environment with Pulumi framework and Azure services. The sessions fits the best developers who want to learn and practice build and deploy techniques using Azure stack and Pulumi for Node.js.