staging/lib/vcap/staging/plugin/node/npm_support/npm_support.rb
# If there is no npm-shwrinkwrap.json file don't do anything
# If user has node_modules folder and config option "ignoreNodeModules"
# in cloudfoundry.json is not set don't do anything
# Otherwise, install node modules according to shwrinkwrap.json tree
#
# For each dependency in shrinkwrap tree recursively:
# - Get from cache by name & version
# - If not in cache, fetch it, run npm rebuild, put in cache
If there is no npm-shwrinkwrap.json file don't do anything
If user has node_modules folder and config option "ignoreNodeModules"
in cloudfoundry.json is not set don't do anything
Otherwise, install node modules according to shwrinkwrap.json tree

For each dependency in shrinkwrap tree recursively:
Get from cache by name & version
If not in cache, fetch it, run npm rebuild, put in cache
If there is no npm - shwrinkwrap . json file don ' t do anything If user has node_modules folder and config option " ignoreNodeModules " in cloudfoundry . json is not set don ' t do anything Otherwise install node modules according to shwrinkwrap . json tree For each dependency in shrinkwrap tree recursively : Get from cache by name & version If not in cache fetch it run npm rebuild put in cache
def compile_node_modules
    return unless runtime["npm"]
    @dependencies = get_dependencies
    return unless should_install_packages?
    @npm_helper = NpmHelper.new(runtime["executable"], runtime["version"], runtime["npm"],
                                @secure_uid, @secure_gid)
    return unless @npm_helper.npm_version
    @app_dir = File.expand_path(File.join(destination_directory, "app"))
    setup_logger
    cache_base_dir = StagingPlugin.platform_config["cache"]
    cache_dir  = File.join(cache_base_dir, "node_modules", library_version)
    @cache = NpmCache.new(cache_dir, @logger)
    @logger.info("Installing dependencies. Node version #{runtime["version"]}")
    install_packages(@dependencies, @app_dir)
  end
def compile_node_modules return unless runtime [ "npm" ] @dependencies = get_dependencies return unless should_install_packages? @npm_helper = NpmHelper . new ( runtime [ "executable" ] , runtime [ "version" ] , runtime [ "npm" ] , @secure_uid , @secure_gid ) return unless @npm_helper . npm_version @app_dir = File . expand_path ( File . join ( destination_directory , "app" ) ) setup_logger cache_base_dir = StagingPlugin . platform_config [ "cache" ] cache_dir = File . join ( cache_base_dir , "node_modules" , library_version ) @cache = NpmCache . new ( cache_dir , @logger ) @logger . info ( "Installing dependencies. Node version #{runtime["version"]}" ) install_packages ( @dependencies , @app_dir ) end
If there is no npm-shwrinkwrap.json file don't do anything
If user has node_modules folder and config option "ignoreNodeModules"
in cloudfoundry.json is not set don't do anything
Otherwise, install node modules according to shwrinkwrap.json tree
If there is no npm - shwrinkwrap . json file don ' t do anything If user has node_modules folder and config option " ignoreNodeModules " in cloudfoundry . json is not set don ' t do anything Otherwise install node modules according to shwrinkwrap . json tree
# npm provided?