lib/vx/builder/script_builder/nodejs.rb in vx-builder-0.5.12 vs lib/vx/builder/script_builder/nodejs.rb in vx-builder-0.5.13

- old
+ new

@@ -3,10 +3,11 @@ class ScriptBuilder class Nodejs < Base DEFAULT_NODE = '0.10' + NPM_PACKAGES = '~/.npm-packages' def call(env) if enabled?(env) vxvm_install(env, 'nodejs', node_version(env)) @@ -24,9 +25,19 @@ i << trace_sh_command("npm install") end do_script(env) do |i| i << trace_sh_command("npm test") + end + + do_before_install(env) do |i| + i << "mkdir -p #{NPM_PACKAGES}" + i << trace_sh_command("npm config set prefix=#{NPM_PACKAGES}") + i << "export PATH=$PATH:#{NPM_PACKAGES}/bin" + end + + do_cached_directories(env) do |i| + i << NPM_PACKAGES end end app.call(env) end