Module: Dependabot::NpmAndYarn::NativeHelpers

Defined in:
lib/dependabot/npm_and_yarn/native_helpers.rb

Class Method Summary collapse

Class Method Details

.helper_pathObject



6
7
8
# File 'lib/dependabot/npm_and_yarn/native_helpers.rb', line 6

def self.helper_path
  "node #{File.join(native_helpers_root, 'run.js')}"
end

.native_helpers_rootObject



10
11
12
13
14
15
# File 'lib/dependabot/npm_and_yarn/native_helpers.rb', line 10

def self.native_helpers_root
  helpers_root = ENV.fetch("DEPENDABOT_NATIVE_HELPERS_PATH", nil)
  return File.join(helpers_root, "npm_and_yarn") unless helpers_root.nil?

  File.join(__dir__, "../../../helpers")
end

.npm8_subdependency_update_command(dependency_names) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/dependabot/npm_and_yarn/native_helpers.rb', line 17

def self.npm8_subdependency_update_command(dependency_names)
  # NOTE: npm options
  # - `--force` ignores checks for platform (os, cpu) and engines
  # - `--dry-run=false` the updater sets a global .npmrc with dry-run: true to
  #   work around an issue in npm 6, we don't want that here
  # - `--ignore-scripts` disables prepare and prepack scripts which are run
  #   when installing git dependencies
  [
    "npm",
    "update",
    *dependency_names,
    "--force",
    "--dry-run",
    "false",
    "--ignore-scripts",
    "--package-lock-only"
  ].join(" ")
end