dependabot-npm_and_yarn 0.98.54 → 0.98.55

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: 2519db1b627e2df67d5f9329759197ee31447d745e5bffcb7ccbda001fa74ead
4
- data.tar.gz: 047aa0253028c392916ca345565354aa810f535a1e7480c31240123acf7c375c
3
+ metadata.gz: c1b60ad0cde3a07eb21dc861b48b62baaf6a581915e55c1b11fd81373929651f
4
+ data.tar.gz: 155018fb261ff5c681cec8cfe01ee84766de16d35b25a1edb59c51a537e04987
5
5
  SHA512:
6
- metadata.gz: ba6ac068d22a3b536f5965c3de31e5327075b90bad3ec01290ed829baf571877c9584e9029318e8293e5cace02c7dba05886cff266f43757d203d814898c0f62
7
- data.tar.gz: e9d64b579762374750f29cc7ca4956230f6f25cd6753dca0f0faa1184a73b6a2640ce06a9e323f884531ea7b5223bda4b16a74f7af06dfe4dd18ce9948bbe71d
6
+ metadata.gz: 702a87f110e7085ba75c887ec69e7641501cc42033831d75912d11decbf915c9294e7c2c124a11f4ef7a70850d0da9e9ab78b4a00f39a2387fae6f5799974ab0
7
+ data.tar.gz: 7a0a503775c5e4d2efc1d762ced122a22f63775c1d2789b4850ee8143d4a0e00918cb1f69e27827c08bd19caf96746ba141a1c28fffa5b0f71eebeef48255007
@@ -35,7 +35,7 @@ module Dependabot
35
35
  run_current_npm_update(lockfile_name: lockfile_name)
36
36
  end
37
37
  updated_content = updated_files.fetch(lockfile_name)
38
- post_process_npm_lockfile(updated_content)
38
+ post_process_npm_lockfile(lockfile.content, updated_content)
39
39
  end
40
40
  rescue SharedHelpers::HelperSubprocessFailed => error
41
41
  handle_npm_updater_error(error, lockfile)
@@ -474,8 +474,9 @@ module Dependabot
474
474
  npm_lockfile.merge("dependencies" => dependencies)
475
475
  end
476
476
 
477
- def post_process_npm_lockfile(lockfile_content)
478
- updated_content = lockfile_content
477
+ def post_process_npm_lockfile(original_content, updated_content)
478
+ updated_content =
479
+ replace_project_metadata(updated_content, original_content)
479
480
 
480
481
  # Switch SSH requirements back for git dependencies
481
482
  git_ssh_requirements_to_swap.each do |req|
@@ -515,6 +516,17 @@ module Dependabot
515
516
  updated_content
516
517
  end
517
518
 
519
+ def replace_project_metadata(new_content, old_content)
520
+ old_name = old_content.match(/(?<="name": ").*(?=",)/)&.to_s
521
+
522
+ if old_name
523
+ new_content = new_content.
524
+ sub(/(?<="name": ").*(?=",)/, old_name)
525
+ end
526
+
527
+ new_content
528
+ end
529
+
518
530
  def tarball_urls
519
531
  all_urls = [*package_locks, *shrinkwraps].flat_map do |file|
520
532
  file.content.scan(/"resolved":\s+"(.*)\"/).flatten
@@ -554,6 +566,7 @@ module Dependabot
554
566
 
555
567
  def sanitized_package_json_content(content)
556
568
  content.
569
+ gsub(/\{\{.*?\}\}/, "something"). # {{ name }} syntax not allowed
557
570
  gsub(/(?<!\\)\\ /, " "). # escaped whitespace not allowed
558
571
  gsub(%r{^\s*//.*}, " ") # comments are not allowed
559
572
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-npm_and_yarn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.98.54
4
+ version: 0.98.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.98.54
19
+ version: 0.98.55
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.98.54
26
+ version: 0.98.55
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement