Sha256: 9fc3d76e0dac7c89f8d25186a6ad9cb4604d05732281886900ca149e003564d5
Contents?: true
Size: 722 Bytes
Versions: 2
Compression:
Stored size: 722 Bytes
Contents
# frozen_string_literal: true require "json" require "pathname" module CobraCommander module Dependencies module Yarn # Represents an Yarn package.json file class Package attr_reader :path def initialize(path) @path = ::Pathname.new(File.join(path, "package.json")).realpath end def project_tag name.match(%r{^@[\w-]+/}).to_s end def name json["name"] end def dependencies json.fetch("dependencies", {}) .merge(json.fetch("devDependencies", {})) end private def json @json ||= JSON.parse(File.read(@path)) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cobra_commander-0.14.0 | lib/cobra_commander/dependencies/yarn/package.rb |
cobra_commander-0.13.0 | lib/cobra_commander/dependencies/yarn/package.rb |