cobra_commander 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '037980fd32c80d6ea74549f570cf31cf88d92d4a2702f4ab6568a68bf6160893'
4
- data.tar.gz: 46da654f6a423723487f595bfe1f397cb32208ef995634396e508594fd51b5fd
3
+ metadata.gz: c7b56002a2501fd994a0d806833c2d4f10f3d8090b5f9983534c1fd2b36bf8e6
4
+ data.tar.gz: 6b0dca74d6a0f9a91ee7a0d7704bfbc82710cbfa89e696184e87de1f623beb40
5
5
  SHA512:
6
- metadata.gz: aa50298aacd18c53e98f73859e3bd787def474fbd7854f67c014b6c35ca1ea2ee82b84d8af1ac25d47ff8b3317410951a2e021fead7d19eb4d0dabfafd8e89ab
7
- data.tar.gz: b8b5e75884f2c3b49839c14654f0b729ba9247fb67e90d86b4946fe896f5bfe4da39149f5a79a2d6bb63507e862a91b30817b99905ebd77d95a04a8b839163e0
6
+ metadata.gz: a321af237699e859f729bc241889bb95b83832f7d8e4d5191e09fc627b5101240dfa8ef8f96034ab7c0f3dd42f5b4518976c65953fc088b7e69410040a0ad422
7
+ data.tar.gz: 7a447a00e0fb9d4b389d1f9296115f8b2e232cd72b5d3519d3868b0b69211ad92ce0fb0bb07921ba596e87796f657f56826a905ced034cee1eb708783170672e
data/.travis.yml CHANGED
@@ -4,6 +4,8 @@ before_install:
4
4
  - "find /home/travis/.rvm/rubies -wholename '*default/bundler-*.gemspec' -delete"
5
5
  - gem install bundler:"$BUNDLER_VERSION"
6
6
  - sudo apt-get -qq install graphviz
7
+ - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
8
+ - export PATH="$HOME/.yarn/bin:$PATH"
7
9
  rvm:
8
10
  - 2.5.1
9
11
  env:
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## Version 0.6.1 - 2019-07-05
6
+
7
+ * Better supports yarn workspaces globbing by delegating to yarn to calculate the list of components rather than re-implementing in Ruby. PR [#34](https://github.com/powerhome/cobra_commander/pull/34)
8
+
5
9
  ## Version 0.6.0 - 2019-07-03
6
10
 
7
11
  * Tracks package.json `workspaces` in addition to `dependencies` and `devDependencies`. PR [#31](https://github.com/powerhome/cobra_commander/pull/31)
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "cobra_commander/component_tree"
4
+ require "open3"
4
5
 
5
6
  module CobraCommander
6
7
  # Represents a dependency tree in a given context
@@ -121,25 +122,19 @@ module CobraCommander
121
122
 
122
123
  def build_workspaces(workspaces)
123
124
  return [] if workspaces.nil?
124
- workspaces.map do |workspace|
125
- glob = "#{@root_path}/#{workspace}/package.json"
126
- workspace_dependencies = Dir.glob(glob)
127
- workspace_dependencies.map do |wd|
128
- { name: component_name(wd), path: component_path(wd) }
129
- end
130
- end.flatten
131
- end
132
-
133
- private
134
125
 
135
- def component_name(dir)
136
- component_path(dir).split("/")[-1]
126
+ yarn_workspaces.map do |_, component|
127
+ { name: component["location"].split("/")[-1], path: component["location"] }
128
+ end
137
129
  end
138
130
 
139
- def component_path(dir)
140
- return dir.split("/package.json")[0] if @root_path == "."
131
+ private
141
132
 
142
- dir.split(@root_path)[-1].split("/package.json")[0]
133
+ def yarn_workspaces
134
+ @yarn_workspaces ||= begin
135
+ output, = Open3.capture2("yarn workspaces info --silent", chdir: @root_path)
136
+ JSON.parse(output)
137
+ end
143
138
  end
144
139
  end
145
140
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CobraCommander
4
- VERSION = "0.6.0"
4
+ VERSION = "0.6.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cobra_commander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Langfeld
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-07-03 00:00:00.000000000 Z
12
+ date: 2019-07-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor