pls 1.0.4 → 1.0.6

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: e29e8adf7c20a487bdaf8dbfba216e90e9a1e1a437e3b4dd898a4215d26c5b23
4
- data.tar.gz: d588aa8b0bcb1e89c913d25693527e0891f1b0ce1d528d8d901e7ed4276f831f
3
+ metadata.gz: b43308beaeccec801bc337bc71c112c1f78d55616e9e892276d7d5018832fade
4
+ data.tar.gz: cec62f282796af53d772dc2def89c5f9f0f23bf03a0bd49ec203b45d4009e4d8
5
5
  SHA512:
6
- metadata.gz: fcfa540e6b32134b4027eef99b8436cc08823a802e377ca762244ce1d0bdfe32f041590dadebb91dfbee634f000bea8eaaca07bd7582d026c5c6c1d7ed48a097
7
- data.tar.gz: dc168e92e90d20ef6a9ebae1bc19ab662b89fd4a9daa6c8d6d97d0bdb52eb9d5cdc56619a78da67699494d2be62cd0d9ef6c6e2e651979b6b947b3f77df1dbac
6
+ metadata.gz: aca3ceb133cf72a9de8aac4916d2cb89a8e0780980d590842cb75cafd6a4c4dec95ec464ad72ce7a6236d551aca7872ce8fdff80c12b599b9f52bcfdc6e7f874
7
+ data.tar.gz: 737300c19c7635bdad0396382b873e0e46dd7192123803d9b1955b11eb0efe2e567a8a95ce32fe5c2ddde83f1a2b5cc446f45b58e0b68ed563f19c5f100b6a07
data/Gemfile.lock CHANGED
@@ -4,28 +4,28 @@ GEM
4
4
  addressable (2.9.0)
5
5
  public_suffix (>= 2.0.2, < 8.0)
6
6
  ast (2.4.3)
7
- bigdecimal (4.0.1)
7
+ bigdecimal (4.1.3)
8
8
  crack (1.0.1)
9
9
  bigdecimal
10
10
  rexml
11
- csv (3.3.5)
11
+ csv (3.3.6)
12
12
  drb (2.2.3)
13
13
  hashdiff (1.2.1)
14
- httparty (0.24.2)
14
+ httparty (0.24.3)
15
15
  csv
16
16
  mini_mime (>= 1.0.0)
17
17
  multi_xml (>= 0.5.2)
18
- json (2.20.0)
18
+ json (3.1.0)
19
19
  language_server-protocol (3.17.0.6)
20
20
  lint_roller (1.1.0)
21
21
  mini_mime (1.1.5)
22
22
  minitest (6.0.6)
23
23
  drb (~> 2.0)
24
24
  prism (~> 1.5)
25
- multi_xml (0.8.1)
25
+ multi_xml (0.9.1)
26
26
  bigdecimal (>= 3.1, < 5)
27
27
  parallel (1.28.0)
28
- parser (3.3.11.1)
28
+ parser (3.3.12.0)
29
29
  ast (~> 2.4.1)
30
30
  racc
31
31
  prism (1.9.0)
@@ -33,38 +33,38 @@ GEM
33
33
  racc (1.8.1)
34
34
  rainbow (3.1.1)
35
35
  rake (13.4.2)
36
- regexp_parser (2.12.0)
36
+ regexp_parser (2.13.1)
37
37
  rexml (3.4.4)
38
- rubocop (1.88.2)
39
- json (~> 2.3)
38
+ rubocop (1.92.0)
39
+ json (>= 2.3)
40
40
  language_server-protocol (~> 3.17.0.2)
41
41
  lint_roller (~> 1.1.0)
42
42
  parallel (>= 1.10)
43
43
  parser (>= 3.3.0.2)
44
44
  rainbow (>= 2.2.2, < 4.0)
45
- regexp_parser (>= 2.9.3, < 3.0)
45
+ regexp_parser (>= 2.11.3, < 3.0)
46
46
  rubocop-ast (>= 1.49.0, < 2.0)
47
47
  ruby-progressbar (~> 1.7)
48
48
  unicode-display_width (>= 2.4.0, < 4.0)
49
49
  rubocop-ast (1.50.0)
50
50
  parser (>= 3.3.7.2)
51
51
  prism (~> 1.7)
52
- rubocop-minitest (0.39.1)
52
+ rubocop-minitest (0.41.0)
53
53
  lint_roller (~> 1.1)
54
- rubocop (>= 1.75.0, < 2.0)
54
+ rubocop (>= 1.89.0, < 2.0)
55
55
  rubocop-ast (>= 1.38.0, < 2.0)
56
- rubocop-performance (1.26.1)
56
+ rubocop-performance (1.27.0)
57
57
  lint_roller (~> 1.1)
58
- rubocop (>= 1.75.0, < 2.0)
58
+ rubocop (>= 1.89.0, < 2.0)
59
59
  rubocop-ast (>= 1.47.1, < 2.0)
60
60
  rubocop-rake (0.7.1)
61
61
  lint_roller (~> 1.1)
62
62
  rubocop (>= 1.72.1)
63
63
  ruby-progressbar (1.13.0)
64
- unicode-display_width (3.2.0)
65
- unicode-emoji (~> 4.1)
66
- unicode-emoji (4.2.0)
67
- webmock (3.26.2)
64
+ unicode-display_width (3.3.0)
65
+ unicode-emoji (~> 4.3)
66
+ unicode-emoji (4.3.0)
67
+ webmock (3.30.0)
68
68
  addressable (>= 2.8.0)
69
69
  crack (>= 0.3.2)
70
70
  hashdiff (>= 0.4.0, < 2.0.0)
data/README.adoc CHANGED
@@ -2,64 +2,78 @@
2
2
  :toc: macro
3
3
  :!toc-title:
4
4
  // URLs:
5
- :img-gem: https://badge.fury.io/rb/pls.svg
5
+ :img-gem: https://img.shields.io/gem/v/pls?color=dfaf8f&labelColor=555555&logo=rubygems&logoColor=dcdccc&style=flat
6
6
  :img-hoc: https://hitsofcode.com/github/rdavid/pls?branch=master&label=hits%20of%20code
7
- :img-license: https://img.shields.io/github/license/rdavid/pls?color=blue&labelColor=gray&logo=freebsd&logoColor=lightgray&style=flat
8
- :img-rake: https://github.com/rdavid/pls/actions/workflows/rake.yml/badge.svg
9
- :img-rubocop: https://github.com/rdavid/pls/actions/workflows/rubocop.yml/badge.svg
10
- :img-style: https://img.shields.io/badge/code_style-rubocop-brightgreen.svg
7
+ :img-license: https://img.shields.io/github/license/rdavid/pls?color=94bff3&labelColor=555555&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI%2BPHRleHQgeD0iMTIiIHk9IjIwIiBmb250LWZhbWlseT0iSGVsdmV0aWNhLEFyaWFsLHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iMjgiIHRleHQtYW5jaG9yPSJtaWRkbGUiIGZpbGw9IiNkY2RjY2MiPiYjMTY5OzwvdGV4dD48L3N2Zz4%3D&style=flat
8
+ :img-rake: https://img.shields.io/github/actions/workflow/status/rdavid/pls/rake.yml?branch=master&label=rake&color=7f9f7f&labelColor=555555&logo=github&logoColor=dcdccc&style=flat
9
+ :img-rubocop: https://img.shields.io/github/actions/workflow/status/rdavid/pls/rubocop.yml?branch=master&label=rubocop&color=93e0e3&labelColor=555555&logo=rubocop&logoColor=dcdccc&style=flat
11
10
  :url-cv: http://cv.rabkin.co.il
12
11
  :url-gem: https://badge.fury.io/rb/pls
13
12
  :url-hoc: https://hitsofcode.com/view/github/rdavid/pls?branch=master
13
+ :url-homebrew: https://brew.sh
14
14
  :url-license: https://github.com/rdavid/pls/blob/master/LICENSES/0BSD.txt
15
15
  :url-rake: https://github.com/rdavid/pls/actions/workflows/rake.yml
16
16
  :url-reuse: https://github.com/fsfe/reuse-action
17
17
  :url-rubocop: https://github.com/rdavid/pls/actions/workflows/rubocop.yml
18
18
  :url-ruby: https://www.ruby-lang.org/en/documentation/installation
19
- :url-style: https://github.com/rubocop/rubocop
19
+ :url-site: https://rdavid.github.io/pls
20
+ :url-tap: https://rdavid.github.io/homebrew-tap
20
21
  :url-vale: https://vale.sh
21
22
  :url-yamllint: https://github.com/adrienverge/yamllint
22
23
 
23
24
  = Package Lister
24
25
 
25
- image:{img-rake}[rake,link={url-rake}]
26
- image:{img-rubocop}[rubocop,link={url-rubocop}]
27
- image:{img-gem}[gem version,link={url-gem}]
28
- image:{img-style}[code style,link={url-style}]
29
- image:{img-hoc}[hits of code,link={url-hoc}]
30
- image:{img-license}[license,link={url-license}]
26
+ [subs=attributes+]
27
+ ++++
28
+ <div align="right">
29
+ <a href="{url-rake}"><img src="{img-rake}" alt="rake"></a>
30
+ <a href="{url-rubocop}"><img src="{img-rubocop}" alt="rubocop"></a>
31
+ <a href="{url-gem}"><img src="{img-gem}" alt="gem version"></a>
32
+ <a href="{url-hoc}"><img src="{img-hoc}" alt="hits of code"></a>
33
+ <a href="{url-license}"><img src="{img-license}" alt="license"></a>
34
+ </div>
35
+ ++++
31
36
 
32
37
  toc::[]
33
38
 
39
+ ifdef::pages-build[]
40
+ ++++
41
+ <div id="repo-link">
42
+ <a href="https://github.com/rdavid/pls" aria-label="GitHub repository" target="_blank" rel="noopener">
43
+ <svg viewBox="0 0 16 16" width="18" height="18" fill="currentColor" aria-hidden="true">
44
+ <path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"/>
45
+ </svg>
46
+ </a>
47
+ </div>
48
+ ++++
49
+ endif::[]
50
+
34
51
  == About
35
52
  Package Lister prints the full dependency tree of a given NodeJS package.
36
- NodeJS developers use packages, which are modules that bundle versioning,
37
- documentation, dependencies on other packages, and more.
38
- npm, NodeJS's package manager, is updated continually with new packages
39
- and new versions of existing ones.
53
+ NodeJS packages are modules published to npm, each with its own version,
54
+ documentation, and dependencies on other packages.
40
55
  Given a package name, the tool fetches its complete set of dependencies
41
56
  from npm.
57
+ ifndef::pages-build[The project has a {url-site}[website].]
42
58
 
43
- == Installation
44
- The tool works on macOS, GNU/Linux, Windows, and other Unix-like operating
45
- systems.
46
- It is packaged as a gem and requires Ruby 3.2 or later.
47
- If you don't have the required Ruby version, see {url-ruby}[Installing
48
- Ruby].
59
+ == Install
60
+ The tool runs on macOS, GNU/Linux, other Unix-like systems, and Windows.
61
+ It is packaged as a Ruby gem and requires Ruby 3.2 or later.
62
+ If your platform lacks a suitable Ruby, see {url-ruby}[Installing Ruby].
49
63
 
50
- Use this command to install:
64
+ Install the gem with:
51
65
 
52
66
  [,sh]
53
67
  ----
54
68
  gem install pls
55
69
  ----
56
70
 
57
- == Updating
58
- Use this command to update the package:
71
+ Or install it with {url-homebrew}[Homebrew] from the
72
+ {url-tap}[rdavid tap]:
59
73
 
60
74
  [,sh]
61
75
  ----
62
- gem update pls
76
+ brew install rdavid/tap/pls
63
77
  ----
64
78
 
65
79
  == Usage
@@ -67,8 +81,8 @@ Use this command to update the package:
67
81
  [,sh]
68
82
  ----
69
83
  pls [options]
70
- -p, --pac package Package name.
71
- -v, --version Shows version.
84
+ -p, --pac package Sets the package name.
85
+ -v, --version Shows the version.
72
86
  ----
73
87
 
74
88
  == Example
@@ -78,6 +92,141 @@ Use this command to update the package:
78
92
  pls -p express
79
93
  ----
80
94
 
95
+ ifdef::pages-build[]
96
+ ++++
97
+ <div id="term-demo">
98
+ <div class="window">
99
+ <div class="titlebar">
100
+ <div class="dots">
101
+ <span class="dot red"></span>
102
+ <span class="dot yellow"></span>
103
+ <span class="dot green"></span>
104
+ </div>
105
+ <span class="tab">bin/pls &mdash; pls -p express</span>
106
+ </div>
107
+ <div class="term-body">
108
+ <div class="row">
109
+ <span class="gutter"><span class="badge">1</span></span>
110
+ <span class="prompt"><span class="sym">$</span> pls -p express</span>
111
+ </div>
112
+ <div class="row">
113
+ <span class="gutter"></span>
114
+ <span class="pkg">express</span>
115
+ </div>
116
+ <div class="row">
117
+ <span class="gutter"></span>
118
+ <span class="pkg">&#32;&#32;accepts</span>
119
+ </div>
120
+ <div class="row">
121
+ <span class="gutter"></span>
122
+ <span class="pkg">&#32;&#32;&#32;&#32;mime-types</span>
123
+ </div>
124
+ <div class="row">
125
+ <span class="gutter"><span class="badge">2</span></span>
126
+ <span class="pkg">&#32;&#32;&#32;&#32;&#32;&#32;mime-db</span>
127
+ </div>
128
+ <div class="row">
129
+ <span class="gutter"></span>
130
+ <span class="pkg">&#32;&#32;&#32;&#32;negotiator</span>
131
+ </div>
132
+ <div class="row">
133
+ <span class="gutter"><span class="badge">3</span></span>
134
+ <span class="pkg">&#32;&#32;body-parser</span>
135
+ </div>
136
+ <div class="row">
137
+ <span class="gutter"></span>
138
+ <span class="pkg">&#32;&#32;&#32;&#32;debug</span>
139
+ </div>
140
+ <div class="row">
141
+ <span class="gutter"></span>
142
+ <span class="pkg">&#32;&#32;&#32;&#32;&#32;&#32;ms</span>
143
+ </div>
144
+ <div class="row">
145
+ <span class="gutter"></span>
146
+ <span class="pkg">&#32;&#32;&#32;&#32;qs</span>
147
+ </div>
148
+ <div class="row">
149
+ <span class="gutter"></span>
150
+ <span class="pkg">&#32;&#32;send</span>
151
+ </div>
152
+ <div class="row">
153
+ <span class="gutter"><span class="badge">4</span></span>
154
+ <span class="pkg cached">&#32;&#32;&#32;&#32;mime-types</span>
155
+ </div>
156
+ <div class="row">
157
+ <span class="gutter"></span>
158
+ <span class="pkg">&#32;&#32;&#32;&#32;fresh</span>
159
+ </div>
160
+ <div class="row">
161
+ <span class="gutter"><span class="badge">5</span></span>
162
+ <span class="ok">Done in 2 seconds.</span>
163
+ </div>
164
+ </div>
165
+ </div>
166
+ <div class="legend">
167
+ <h3>What the numbers point at</h3>
168
+ <ol>
169
+ <li>
170
+ <span class="num">1</span>
171
+ <p>No subcommands to learn &mdash; a single <code>-p</code> flag prints the whole tree to stdout.</p>
172
+ </li>
173
+ <li>
174
+ <span class="num">2</span>
175
+ <p>Every dependency is indented two spaces per depth level, drawn by <code>Reporter#out</code>'s recursive <code>del + 2</code> calls.</p>
176
+ </li>
177
+ <li>
178
+ <span class="num">3</span>
179
+ <p><code>accepts</code>, <code>body-parser</code>, and <code>send</code> are express's direct dependencies &mdash; <code>Pls#build_dep</code> spawns one thread per key, so all three resolve concurrently.</p>
180
+ </li>
181
+ <li>
182
+ <span class="num">4</span>
183
+ <p><code>mime-types</code> shows up under both <code>accepts</code> and <code>send</code>, but <code>Pls#build</code> only calls the npm registry for it once &mdash; the second line comes straight from the in-memory cache.</p>
184
+ </li>
185
+ <li>
186
+ <span class="num">5</span>
187
+ <p>The only line <code>Reporter#do</code> adds after the tree &mdash; total wall-clock time for the run.</p>
188
+ </li>
189
+ </ol>
190
+ </div>
191
+ </div>
192
+ ++++
193
+ endif::[]
194
+
195
+ ifndef::pages-build[]
196
+ [,sh]
197
+ ----
198
+ express
199
+ accepts
200
+ mime-types
201
+ mime-db
202
+ negotiator
203
+ body-parser
204
+ debug
205
+ ms
206
+ qs
207
+ send
208
+ mime-types
209
+ fresh
210
+ Done in 2 seconds.
211
+ ----
212
+ endif::[]
213
+
81
214
  == License
82
215
  `pls` is copyright {url-cv}[David Rabkin] and available under a
83
216
  {url-license}[Zero-Clause BSD license].
217
+
218
+ ifdef::pages-build[]
219
+ ++++
220
+ <footer id="site-footer">
221
+ <div class="footer-left">
222
+ <img src="favicon.svg" alt="" width="20" height="20">
223
+ <span>pls by <a href="http://cv.rabkin.co.il" target="_blank" rel="noopener">David Rabkin</a></span>
224
+ </div>
225
+ <div class="footer-links">
226
+ <a href="https://github.com/rdavid/pls" target="_blank" rel="noopener">GitHub</a>
227
+ <a href="https://rubygems.org/gems/pls" target="_blank" rel="noopener">RubyGems</a>
228
+ <a href="https://github.com/rdavid/pls/blob/master/LICENSES/0BSD.txt" target="_blank" rel="noopener">0BSD License</a>
229
+ </div>
230
+ </footer>
231
+ ++++
232
+ endif::[]
data/Rakefile CHANGED
@@ -4,7 +4,22 @@
4
4
  # SPDX-FileCopyrightText: 2021-2026 David Rabkin
5
5
  # SPDX-License-Identifier: 0BSD
6
6
 
7
- require 'bundler/gem_tasks'
7
+ require 'rake/clean'
8
+ require 'bundler/gem_helper'
9
+
10
+ CLOBBER.include 'pkg'
11
+
12
+ module Bundler
13
+ # Bundler hardcodes the release tag as "v#{version}", this project
14
+ # tags releases with the bare version number instead.
15
+ class GemHelper
16
+ def version_tag
17
+ version.to_s
18
+ end
19
+ end
20
+ end
21
+
22
+ Bundler::GemHelper.install_tasks
8
23
 
9
24
  task default: %w[test]
10
25
 
@@ -7,16 +7,16 @@
7
7
  require 'optparse'
8
8
 
9
9
  module Pls
10
- # Handles input parameters.
10
+ # Parses command-line options for the package name and version flags.
11
11
  class Configurator
12
12
  attr_reader :files
13
13
 
14
14
  DIC = [
15
- ['-p', '--pac package', 'Package name.', String, :pac]
15
+ ['-p', '--pac package', 'Sets the package name.', String, :pac]
16
16
  ].freeze
17
17
 
18
18
  def add(opt)
19
- opt.on('-v', '--version', 'Show version.') do
19
+ opt.on('-v', '--version', 'Shows the version.') do
20
20
  puts "#{File.basename($PROGRAM_NAME)} #{VERSION} #{DATE}"
21
21
  exit
22
22
  end
@@ -30,7 +30,7 @@ module Pls
30
30
  DIC.each { |f, p, d, t, k| o.on(f, p, t, d) { |i| @options[k] = i } }
31
31
  add(o)
32
32
  end.parse!
33
- raise 'Please specify a package name with the -p flag.' if pac.nil?
33
+ raise 'Specify a package name with the -p flag.' if pac.nil?
34
34
  end
35
35
 
36
36
  def pac
data/lib/pls/pls.rb CHANGED
@@ -10,8 +10,9 @@ require_relative 'configurator'
10
10
  require_relative 'reporter'
11
11
 
12
12
  module Pls
13
- # The data structure is a hash: the key is the package name, the value is
14
- # an array of hashes, for example:
13
+ # Builds the dependency tree of an npm package.
14
+ # Each tree is a hash that maps a package name to an array of subtrees.
15
+ # For example:
15
16
  # {
16
17
  # aaa => [
17
18
  # bbb => [],
@@ -32,7 +33,7 @@ module Pls
32
33
  def read_http(pac)
33
34
  url = "#{@cfg.url}/#{pac}/latest"
34
35
  res = HTTParty.get(url)
35
- raise "Unable to continue with #{url}." unless res.code == 200
36
+ raise "Unable to fetch #{url}." unless res.code == 200
36
37
 
37
38
  res.body
38
39
  end
@@ -51,7 +52,7 @@ module Pls
51
52
  arr
52
53
  end
53
54
 
54
- # Consider adding time-based invalidation for cached data.
55
+ # Cached data never expires, so time-based invalidation could help.
55
56
  def read_cache(pac)
56
57
  arr = []
57
58
  @mut_dat.synchronize { arr = @dat[pac] }
data/lib/pls/reporter.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  # SPDX-License-Identifier: 0BSD
6
6
 
7
7
  module Pls
8
- # Formats and prints output data.
8
+ # Prints an indented dependency tree and the elapsed run time.
9
9
  class Reporter
10
10
  def initialize
11
11
  @beg = Time.now.to_i
data/lib/pls/version.rb CHANGED
@@ -5,6 +5,6 @@
5
5
  # SPDX-License-Identifier: 0BSD
6
6
 
7
7
  module Pls
8
- VERSION = '1.0.4'
9
- DATE = '2026-07-15'
8
+ VERSION = '1.0.6'
9
+ DATE = '2026-10-20'
10
10
  end
data/pls.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.version = Pls::VERSION
16
16
  s.summary = 'Package lister'
17
17
  s.description = <<-HERE
18
- Prints dependent package names.
18
+ Prints the full dependency tree of an npm package.
19
19
  HERE
20
20
  s.license = '0BSD'
21
21
  s.author = 'David Rabkin'
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pls
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rabkin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-07-15 00:00:00.000000000 Z
11
+ date: 2026-10-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: " Prints dependent package names.\n"
13
+ description: " Prints the full dependency tree of an npm package.\n"
14
14
  email: david@rabkin.co.il
15
15
  executables:
16
16
  - pls