Forge Home

yarn

Puppet Module to install Yarn Package Manager

96,385 downloads

91,811 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 1.1.0 (latest)
  • 1.0.3
  • 1.0.2
  • 1.0.1
released Jul 28th 2020
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >=4.0.0 <7.0.0
  • , , , ArchLinux, , , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'initforthe-yarn', '1.1.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add initforthe-yarn
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install initforthe-yarn --version 1.1.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download
Tags: nodejs, node, yarn, npm, bower

Documentation

initforthe/yarn — version 1.1.0 Jul 28th 2020

Puppet yarn

Build Status

A puppet module to install Yarn Package Manager.

Table of Contents

  1. Module Description - What the module does and why it is useful
  2. Setup - The basics of getting started with yarn
  3. Usage - Configuration options and additional functionality
  4. Reference - An under-the-hood peek at what the module is doing and how
  5. Limitations - OS compatibility, etc.
  6. Development - Guide for contributing to the module

Module Description

Yarn is a fast, reliable, and secure dependency manager for npm and bower. This Puppet module simplifies the task of installing it and supports package, npm or source installation.

Setup

What yarn affects

  • It will install Yarn.
  • It will install wget, tar and gzip packages if you choose the source installation method.

Node.js requirement: Yarn requires Node.js to be installed, but this module will not do it. You need to install Node.js by your own, you can use the puppet-nodejs to do it. Examples are provided with this module.

Beginning with yarn

To have Puppet install yarn with the default parameters, declare the yarn class:

class { 'yarn': }

The Puppet module applies a default configuration: installs yarn using the recommended methods, package for Debian and RedHat families and source for the rest. You can also use npm to install it. Use the Reference section to find information about the class's parameters and their default values.

You can customize parameters when declaring the yarn class. For instance, this declaration will install yarn using the npm method for the foo user:

class { 'yarn':
  user           => 'foo',
  install_method => 'npm',
}

Usage

Installing Yarn

This is the most common usage for yarn. It installs yarn with default parameters.

class { 'yarn': }

Installing Yarn on CentOS with Node.js

The following code require that you add the puppet-nodejs module also, but you can adapt it for any other module.

class { 'nodejs':
  repo_url_suffix => '6.x',
}

class { 'yarn': }

Package['nodejs'] -> Package['yarn']

if $::osfamily == 'RedHat' and $::operatingsystemrelease =~ /^5\.(\d+)/ {
  class { 'epel': }
  Class['epel'] -> Class['nodejs'] -> Class['yarn']
}

Installing Yarn on Ubuntu with Node.js

The following code require that you add the puppet-nodejs module also, but you can adapt it for any other module.

class { 'nodejs':
  repo_url_suffix => '6.x',
}

class { 'yarn': }

Package['nodejs'] -> Package['yarn']

Installing Yarn on other Linux distros with Node.js

The following code require that you add the puppet-nodejs module also, but you can adapt it for any other module.

class { 'nodejs':
  repo_url_suffix => '6.x',
}

class { 'yarn':
  manage_repo    => false,
  install_method => 'source',
  require        => Package['nodejs'],
}

Installing Yarn using npm with Node.js

The following code require that you add the puppet-nodejs module also, but you can adapt it for any other module.

class { 'nodejs':
  repo_url_suffix => '6.x',
}

class { 'yarn':
  manage_repo    => false,
  install_method => 'npm',
  require        => Class['nodejs'],
}

Remove Yarn

class { 'yarn':
  package_ensure => 'absent',
}

Reference

Details are into REFERENCE.md in puppet-strings format, excepted for OS dependent values of yarn class presented bellow.

manage_repo

Allos the module to manage the Yarn repo.

Default: true for Debian and RedHat, false for the rest.

install_method

Sets the installation method. Allowed values: source, npm, package.

Default: package for Debian and RedHat, source for the rest.

  • Ensures packages wget, tar and gzip when source method is used.

Limitations

This module can not work on Windows and should work on LINUX systems.

This module is CI tested against open source Puppet on OSes declared in metadata.json.

This module should also work properly in other distributions and operating systems, such as FreeBSD, Gentoo, and Amazon Linux, but is not formally tested on them.

Development

Contributing

This modules is an open project, and community contributions are highly appreciated.

For more information, please read the complete module contribution guide.

Running tests

This project contains tests for both rspec-puppet and beaker-rspec to verify functionality. For detailed information on using these tools, please see their respective documentation.

This project contains tests for rspec-puppet to verify functionality. For detailed information on using these tools, please see their respective documentation.

Testing quickstart

gem install bundler
bundle install
bundle exec rake test
./spec/run_virtualbox_tests.sh # this will take a long time