Sha256: f29250c1824ec64955bdaef284cf98cb5b1a330ff7a7af6af05c347207267070
Contents?: true
Size: 740 Bytes
Versions: 5
Compression:
Stored size: 740 Bytes
Contents
require 'json' EXTRACT_DEPENDENCY_NAME = /"?(.+?)@.+?"?(?:,\s+|\Z)/.freeze EXTRACT_DEPENDENCY_DETAILS = /(^((?!= ).*?):\n.*?(?:\n\n|\Z))/m.freeze def direct_dependencies_names package_json = JSON.parse(File.open('package.json').read) direct_dependencies = package_json.fetch_values('dependencies', 'devDependencies', 'peerDependencies') { } direct_dependencies.compact.inject([]) { |memo, v| memo.concat(v.keys) } end @dependencies = direct_dependencies_names yarn_lock_content = File.open('yarn.lock').read yarn_lock_content.scan(EXTRACT_DEPENDENCY_DETAILS).each do |dependency_block| direct_dep = @dependencies.include?(dependency_block[1].match(EXTRACT_DEPENDENCY_NAME).to_a[1]) puts dependency_block[0] if direct_dep end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
jt_tools-0.0.6 | rejuvenation.rb |
jt_tools-0.0.5 | rejuvenation.rb |
jt_tools-0.0.4 | rejuvenation.rb |
jt_tools-0.0.3 | rejuvenation.rb |
jt_tools-0.0.2 | rejuvenation.rb |