Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes YarnLockfileParser #6016

Merged
merged 3 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
require "dependabot/dependency_file"
require "dependabot/errors"
require "dependabot/npm_and_yarn/file_fetcher"
require "dependabot/npm_and_yarn/file_parser/yarn_lockfile_parser"

module Dependabot
module NpmAndYarn
Expand Down Expand Up @@ -122,7 +121,17 @@ def parsed_yarn_lock
return {} unless yarn_lock

@parsed_yarn_lock ||=
FileParser::YarnLockfileParser.new(lockfile: yarn_lock).parse
SharedHelpers.in_a_temporary_directory do
File.write("yarn.lock", yarn_lock.content)

SharedHelpers.run_helper_subprocess(
command: NativeHelpers.helper_path,
function: "yarn:parseLockfile",
args: [Dir.pwd]
)
rescue SharedHelpers::HelperSubprocessFailed
raise Dependabot::DependencyFileNotParseable, yarn_lock.path
end
end

# The path back to the root lockfile
Expand Down
2 changes: 1 addition & 1 deletion npm_and_yarn/lib/dependabot/npm_and_yarn/file_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def build_dependency(file:, type:, name:, requirement:)
# TODO: Handle aliased packages:
# https://github.com/dependabot/dependabot-core/pull/1115
#
# Ignore dependencies with an alias in the name (only supported by Yarn)
# Ignore dependencies with an alias in the name
# Example: "my-fetch-factory@npm:fetch-factory"
return if aliased_package_name?(name)

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,8 @@
context "that can't be parsed" do
let(:project_name) { "yarn/unparseable" }

it "raises a PathDependenciesNotReachable error with details" do
expect { dependency_file }.
to raise_error(
Dependabot::PathDependenciesNotReachable,
"The following path based dependencies could not be retrieved: " \
"etag"
)
it "raises DependencyFileNotParseable" do
expect { dependency_file }.to raise_error(Dependabot::DependencyFileNotParseable)
end
end

Expand Down

This file was deleted.