dependabot-npm_and_yarn 0.174.1 → 0.175.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1670420229d206add0e33c55f169aa32c48ffeb556c52eb852f0eed843dd567a
4
- data.tar.gz: e07a8e900f981e12b4edc06dfaa6deb404ab406705ae8f1e944934f551e2d918
3
+ metadata.gz: 3c07f155a90a67db8072626219fa6d797c7294ebb3531565c6fe5b7163378f3e
4
+ data.tar.gz: 5ededcae3a93518dd184c7e5b202a63b9f80c0614ceba6a9a59a9c32c92980af
5
5
  SHA512:
6
- metadata.gz: 42c6c3d11dce9a7c91115529cb62cdadab6ea13979ea4ed149383ac952fe94b507b784c43ac9e4abc39fc6681dcf0da6c377d26b0c27b52feae837547d1080a8
7
- data.tar.gz: 6d4ee2595178167f01f29bcbd304ff05f823c3e42fc9b7ec849a27a9eacfe3cd8fc71ea3ac5ef5b6d8fea64166dda4221f2edfd52f3b57aa3853ace78f87e834
6
+ metadata.gz: ef4274999e5373d0e7d20c5697214836c67750719061b9e9768f688a42f2fb84a80dc841363158f2520d8330eb2b913e5d4ab4af318bdd6b9faed192cc0f6767
7
+ data.tar.gz: 2b739c355b0096994ee83157bfdf4f514a310ca0981ef649d550d446951b40ce87d174802c1ec4c0b9446bf207d5d123f1876a6741de7e67100f2cbec5604f6e
@@ -476,6 +476,7 @@ module Dependabot
476
476
  updated_content = lock_deps_with_latest_reqs(updated_content)
477
477
 
478
478
  updated_content = sanitized_package_json_content(updated_content)
479
+
479
480
  File.write(file.name, updated_content)
480
481
  end
481
482
  end
@@ -495,6 +496,16 @@ module Dependabot
495
496
  end
496
497
  end
497
498
 
499
+ # Takes a JSON string and detects if it is spaces or tabs and how many
500
+ # levels deep it is indented.
501
+ def detect_indentation(json)
502
+ indentation = json.scan(/^\s+/).min_by(&:length)
503
+ indentation_size = indentation.length
504
+ indentation_type = indentation.scan(/\t/).any? ? "\t" : " "
505
+
506
+ indentation_type * indentation_size
507
+ end
508
+
498
509
  def lock_git_deps(content)
499
510
  return content if git_dependencies_to_lock.empty?
500
511
 
@@ -508,7 +519,8 @@ module Dependabot
508
519
  end
509
520
  end
510
521
 
511
- json.to_json
522
+ indent = detect_indentation(content)
523
+ JSON.pretty_generate(json, indent: indent)
512
524
  end
513
525
 
514
526
  def git_dependencies_to_lock
@@ -549,7 +561,8 @@ module Dependabot
549
561
  end
550
562
  end
551
563
 
552
- json.to_json
564
+ indent = detect_indentation(content)
565
+ JSON.pretty_generate(json, indent: indent)
553
566
  end
554
567
 
555
568
  def replace_ssh_sources(content)
@@ -56,8 +56,8 @@ module Dependabot
56
56
  # npm ERR! peer @opentelemetry/api@">=1.0.0 <1.1.0" from @opentelemetry/context-async-hooks@1.0.1
57
57
  NPM7_PEER_DEP_ERROR_REGEX =
58
58
  /
59
- npm\sERR!\sCould\snot\sresolve\sdependency:\n
60
- npm\sERR!\speer\s(?<required_dep>\S+@\S+(\s\S+)?)\sfrom\s(?<requiring_dep>\S+@\S+)
59
+ npm\s(?:WARN|ERR!)\sCould\snot\sresolve\sdependency:\n
60
+ npm\s(?:WARN|ERR!)\speer\s(?<required_dep>\S+@\S+(\s\S+)?)\sfrom\s(?<requiring_dep>\S+@\S+)
61
61
  /x.freeze
62
62
 
63
63
  def initialize(dependency:, credentials:, dependency_files:,
@@ -458,10 +458,13 @@ module Dependabot
458
458
  end
459
459
 
460
460
  def run_npm7_checker(version:)
461
- SharedHelpers.run_shell_command(
461
+ cmd =
462
462
  "npm install #{version_install_arg(version: version)} --package-lock-only --dry-run=true --ignore-scripts"
463
- )
464
- nil
463
+ output = SharedHelpers.run_shell_command(cmd)
464
+ if output.match?(NPM7_PEER_DEP_ERROR_REGEX)
465
+ error_context = { command: cmd, process_exit_value: 1 }
466
+ raise SharedHelpers::HelperSubprocessFailed.new(message: output, error_context: error_context)
467
+ end
465
468
  rescue SharedHelpers::HelperSubprocessFailed => e
466
469
  raise if e.message.match?(NPM7_PEER_DEP_ERROR_REGEX)
467
470
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-npm_and_yarn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.174.1
4
+ version: 0.175.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-22 00:00:00.000000000 Z
11
+ date: 2022-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dependabot-common
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.174.1
19
+ version: 0.175.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.174.1
26
+ version: 0.175.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement