Module: Dependabot::NpmAndYarn::NativeHelpers

Extended by:
T::Sig
Defined in:
lib/dependabot/npm_and_yarn/native_helpers.rb

Class Method Summary collapse

Class Method Details

.helper_pathObject



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

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

.native_helpers_rootObject



17
18
19
20
21
22
# File 'lib/dependabot/npm_and_yarn/native_helpers.rb', line 17

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

.run_npm8_subdependency_update_command(dependency_names) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/dependabot/npm_and_yarn/native_helpers.rb', line 25

def self.run_npm8_subdependency_update_command(dependency_names)
  # NOTE: npm options
  # - `--force` ignores checks for platform (os, cpu) and engines
  # - `--ignore-scripts` disables prepare and prepack scripts which are run
  #   when installing git dependencies
  command = [
    "update",
    *dependency_names,
    "--force",
    "--ignore-scripts",
    "--package-lock-only"
  ].join(" ")

  fingerprint = [
    "update",
    "<dependency_names>",
    "--force",
    "--ignore-scripts",
    "--package-lock-only"
  ].join(" ")

  Helpers.run_npm_command(command, fingerprint: fingerprint)
end