nodejs

Configure nodejs via Boxen

Les Aker

halyard

7,889 downloads

6,596 latest version

4.6 quality score

Version information

  • 5.0.4 (latest)
  • 5.0.3
  • 5.0.2
  • 5.0.1
released Jan 16th 2016
This version is compatible with:
  • Darwin

Start using this module

Documentation

halyard/nodejs — version 5.0.4 Jan 16th 2016

puppet-nodejs

Puppet Forge Dependency Status MIT Licensed Build Status

Module to handle nodejs version management with nodenv for boxen, based on boxen's ruby module

Changes from upstream

  • Clean up meta files
  • Set up CircleCI builds
  • Switch to function bindings vs puppet-module-data

Usage

In your hiera config:

"nodejs::provider": "nodenv"
"nodejs::user": "deploy"

# https://github.com/OiNutter/node-build/releases
"nodejs::build::ensure": "f18b3d67756d1cb25ba6e35044f816fd67211b33"
"nodejs::nodenv::ensure": "v0.2.0"

# nodenv plugins
"nodejs::nodenv::plugins":
  "nodenv-vars":
    "ensure": "ee42cd9db3f3fca2a77862ae05a410947c33ba09"
    "source": "OiNutter/nodenv-vars"

# Environment variables for building specific versions
# You'll want to enable hiera's "deeper" merge strategy
# See http://docs.puppetlabs.com/hiera/1/configuring.html#mergebehavior
"nodejs::version::env":
  "0.4.2":
    "CC": "gcc"

# Version aliases, commonly used to bless a specific version
# Use the "deeper" merge strategy, as with nodejs::version::env
"nodejs::version::alias":
  "0.10": "0.10.36"
  "0.12": "0.12.0"
  "iojs-1.6": "iojs-1.6.2"

In your manifest:

# Set the global default node (auto-installs it if it can)
class { 'nodejs::global':
  version => '0.12'
}

# ensure a certain node version is used in a dir
nodejs::local { '/path/to/some/project':
  version => '0.12'
}

# ensure a npm module is installed for a certain node version
# note, you can't have duplicate resource names so you have to name like so
$version = "0.12"
npm_module { "bower for ${version}":
  module       => 'bower',
  version      => '~> 1.4.1',
  node_version => $version,
}

# ensure a module is installed for all node versions
npm_module { 'bower for all nodes':
  module       => 'bower',
  version      => '~> 1.4.1',
  node_version => '*',
}

# install a node version
nodejs::version { '0.12.2': }

# Installing nodenv plugin
nodejs::nodenv::plugin { 'nodenv-vars':
  ensure => 'ee42cd9db3f3fca2a77862ae05a410947c33ba09',
  source  => 'OiNutter/nodenv-vars'
}

Required Puppet Modules