Search

Home > Coder Catchup > Episode 091 - Yarn, NPM Friend Or Foe?
Podcast: Coder Catchup
Episode:

Episode 091 - Yarn, NPM Friend Or Foe?

Category: Technology
Duration: 00:10:54
Publish Date: 2016-10-17 15:45:00
Description:

Fast, reliable, and secure dependency management for JavaScript. https://yarnpkg.com/ https://github.com/yarnpkg/yarn

Facebook Post: https://code.facebook.com/posts/1840075619545360 Facebook announced Yarn, a collaboration with Exponent, Google, and Tilde

Yet another dependency manager, but for the better!

Yarn wouldn't exist if it wasn't for excellent prior art. Yarn has been inspired by the following projects: Bundler, Cargo, npm

Fast: Yarn caches every package it downloads so it never needs to again. It also parallelizes operations to maximize resource utilization so install times are faster than ever.

Reliable: Using a detailed, but concise, lockfile format, and a deterministic algorithm for installs, Yarn is able to guarantee that an install that worked on one system will work exactly the same way on any other system.

Secure: Yarn uses checksums to verify the integrity of every installed package before its code is executed.

Features - Offline Mode: If you've installed a package before, you can install it again without any internet connection. - Deterministic: The same dependencies will be installed the same exact way across every machine regardless of install order. - Network Performance: Yarn efficiently queues up requests and avoids request waterfalls in order to maximize network utilization. - Multiple Registries: Install any package from either npm or Bower and keep your package workflow the same. - Network Resilience: A single request failing won't cause an install to fail. Requests are retried upon failure. - Flat Mode: Resolve mismatching versions of dependencies to a single version to avoid creating duplicates. - More emojis. - Ability to restrict licenses of installed modules and a means for outputting license information. - Exposes a stable public JS API with logging abstracted for consumption via build tools. - Readable, minimal, pretty CLI output.

Availability and install - macOS - curl for it or manually add it via a couple commands - Windows (via Installer) - Linux - apt, yum, curl - Also install via NPM - npm install -g yarn

Usage - yarn init - yarn add [package, package@version, package@tag] - yarn upgrade [...] - yarn remove [package] - yarn or yarn install to install deps - Oh and yarn publish can publish your project to npm registry - Flags for dev dependencies, peer deps, e.g. yarn add --dev

Notes - Generates a yarn.lock file which you should not be editing, it has more information than what your package.json file contains and is important. - Make sure you check in your yarn.lock file to your VCS

Summary FAST, RELIABLE, AND SECURE DEPENDENCY MANAGEMENT.

Ultra Fast. Yarn caches every package it downloads so it never needs to again. It also parallelizes operations to maximize resource utilization so install times are faster than ever.

Mega Secure Yarn uses checksums to verify the integrity of every installed package before its code is executed.

Super Reliable Using a detailed, but concise, lockfile format, and a deterministic algorithm for installs, Yarn is able to guarantee that an install that worked on one system will work exactly the same way on any other system.

Total Play: 0