squared 0.4.12 → 0.5.0
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 +4 -4
- data/CHANGELOG.md +56 -0
- data/README.md +4 -4
- data/README.ruby.md +19 -12
- data/lib/squared/common/base.rb +5 -3
- data/lib/squared/common/format.rb +1 -1
- data/lib/squared/common/prompt.rb +35 -39
- data/lib/squared/common/shell.rb +27 -22
- data/lib/squared/common/system.rb +36 -32
- data/lib/squared/common/utils.rb +0 -12
- data/lib/squared/common.rb +2 -1
- data/lib/squared/config.rb +12 -11
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +17 -21
- data/lib/squared/workspace/project/base.rb +363 -220
- data/lib/squared/workspace/project/docker.rb +110 -68
- data/lib/squared/workspace/project/git.rb +82 -74
- data/lib/squared/workspace/project/node.rb +63 -21
- data/lib/squared/workspace/project/python.rb +138 -103
- data/lib/squared/workspace/project/ruby.rb +60 -43
- data/lib/squared/workspace/project/support/class.rb +81 -6
- data/lib/squared/workspace/project.rb +0 -10
- data/lib/squared/workspace/repo.rb +5 -5
- data/lib/squared/workspace/series.rb +8 -8
- data/lib/squared/workspace/support/data.rb +1 -0
- data/lib/squared/workspace.rb +1 -1
- data/squared.gemspec +1 -1
- metadata +2 -3
- data/lib/squared/common/class.rb +0 -110
@@ -91,13 +91,13 @@ module Squared
|
|
91
91
|
|
92
92
|
data = @revdoc
|
93
93
|
last = keys.pop
|
94
|
-
|
94
|
+
keys.each do |key|
|
95
95
|
if data[key].is_a?(Hash)
|
96
96
|
data = data[key]
|
97
97
|
elsif create
|
98
98
|
data = data[key] = {}
|
99
99
|
else
|
100
|
-
return
|
100
|
+
return nil
|
101
101
|
end
|
102
102
|
end
|
103
103
|
data[last] = val
|
@@ -157,13 +157,14 @@ module Squared
|
|
157
157
|
class Git < Base
|
158
158
|
OPT_GIT = {
|
159
159
|
common: %w[c=q bare glob-pathspecs icase-pathspecs literal-pathspecs no-optional-locks no-pager
|
160
|
-
no-replace-objects noglob-pathspecs paginate config-env=q exec-path=p
|
160
|
+
no-replace-objects noglob-pathspecs paginate attr-source=b config-env=q exec-path=p
|
161
|
+
namespace=p].freeze,
|
161
162
|
add: %w[A|all e|edit f|force ignore-errors ignore-missing ignore-removal i|interactive no-all
|
162
163
|
no-ignore-removal n|dry-run p|patch pathspec-file-nul renormalize sparse u|update v|verbose
|
163
164
|
chmod=b pathspec-from-file=p].freeze,
|
164
|
-
branch: %w[a|all create-reflog i|ignore-case q|quiet r|remotes v|verbose vv abbrev=i color=b
|
165
|
-
contains=b format=q merged=b no-contains=b no-merged=b points-at=b u|set-upstream-to=b
|
166
|
-
t|track=b].freeze,
|
165
|
+
branch: %w[a|all create-reflog i|ignore-case omit-empty q|quiet r|remotes v|verbose vv abbrev=i color=b
|
166
|
+
column=b contains=b format=q merged=b no-contains=b no-merged=b points-at=b u|set-upstream-to=b
|
167
|
+
sort=q t|track=b].freeze,
|
167
168
|
checkout: %w[l d|detach f|force ignore-other-worktrees ignore-skip-worktree-bits m|merge p|patch
|
168
169
|
pathspec-file-nul q|quiet ours theirs conflict=b orphan=b pathspec-from-file=p t|track=b].freeze,
|
169
170
|
diff: {
|
@@ -171,7 +172,8 @@ module Squared
|
|
171
172
|
show: %w[s exit-code histogram].freeze
|
172
173
|
}.freeze,
|
173
174
|
fetch: {
|
174
|
-
base: %w[multiple progress P|prune-tags refetch stdin u|update-head-ok
|
175
|
+
base: %w[multiple porcelain progress P|prune-tags refetch stdin u|update-head-ok
|
176
|
+
recurse-submodules-default=b].freeze,
|
175
177
|
pull: %w[4 6 n t a|append atomic dry-run f|force k|keep negotiate-only prefetch p|prune q|quiet
|
176
178
|
set-upstream unshallow update-shallow v|verbose deepen=i depth=i j|jobs=i negotiation-tip=q
|
177
179
|
recurse-submodules=v refmap=q o|server-option=q shallow-exclude=b shallow-since=v
|
@@ -196,9 +198,9 @@ module Squared
|
|
196
198
|
branches=q? committer=q decorate=b decorate-refs=q decorate-refs-exclude=q exclude=q
|
197
199
|
exclude-hidden=b glob=q grep=q grep-reflog=q n|max-count=i max-parents=i min-parents=i no-walk=b?
|
198
200
|
remotes=q? since=q since-as-filter=q skip=i tags=q? until=q].freeze,
|
199
|
-
format: %w[t children combined-all-paths oneline left-right no-diff-merges parents relative-date
|
200
|
-
show-signature date=q diff-merges=b encoding=b expand-tabs=i format=q
|
201
|
-
show-linear-break=q?].freeze,
|
201
|
+
format: %w[t children combined-all-paths dd oneline left-right no-diff-merges parents relative-date
|
202
|
+
show-notes-by-default show-signature date=q diff-merges=b encoding=b expand-tabs=i format=q
|
203
|
+
notes=b pretty=q? show-linear-break=q?].freeze,
|
202
204
|
diff: %w[p R u z B=bm? C=bm? l=im G=qm I=qm M=bm? O=qm S=qm U=im binary check compact-summary cumulative
|
203
205
|
find-copies-harder full-index W|function-context w|ignore-all-space ignore-blank-lines
|
204
206
|
ignore-cr-at-eol ignore-space-at-eol b|ignore-space-change D|irreversible-delete graph
|
@@ -228,12 +230,13 @@ module Squared
|
|
228
230
|
theirs W|worktree conflict=b pathspec-from-file=p s|source=b].freeze,
|
229
231
|
rev_parse: %w[absolute-git-dir all git-common-dir git-dir is-bare-repository is-inside-git-dir
|
230
232
|
is-inside-work-tree is-shallow-repository local-env-vars no-revs not q|quiet revs-only
|
231
|
-
shared-index-path show-cdup show-prefix show-superproject-working-tree
|
232
|
-
symbolic symbolic-full-name verify abbrev-ref=b? after=q before=q
|
233
|
-
disambiguate=b exclude=q exclude-hidden=b git-path=p glob=q
|
234
|
-
|
235
|
-
|
236
|
-
|
233
|
+
shared-index-path show-cdup show-prefix show-ref-format show-superproject-working-tree
|
234
|
+
show-toplevel sq sq-quote symbolic symbolic-full-name verify abbrev-ref=b? after=q before=q
|
235
|
+
branches=q? default=q disambiguate=b exclude=q exclude-hidden=b git-path=p glob=q
|
236
|
+
output-object-format=b path-format=b? prefix=q remotes=q? resolve-git-dir=p short=i?
|
237
|
+
show-object-format=b? since=q tags=q? until=q].freeze,
|
238
|
+
show: %w[t combined-all-paths no-diff-merges remerge-diff show-notes-by-default show-signature diff-merges=b
|
239
|
+
encoding=b expand-tabs=i notes=q show-notes=q?].freeze,
|
237
240
|
stash: {
|
238
241
|
common: %w[q|quiet].freeze,
|
239
242
|
push: %w[a|all u|include-untracked k|keep-index no-keep-index no-include-untracked pathspec-file-nul
|
@@ -242,8 +245,8 @@ module Squared
|
|
242
245
|
apply: %w[index].freeze
|
243
246
|
}.freeze,
|
244
247
|
status: %w[u|ignore-submodules=bm? ignored=b? untracked-files=b?],
|
245
|
-
tag: %w[n=im cleanup=b create-reflog i|ignore-case color=b? column=b contains=b? format=q merged=b?
|
246
|
-
no-contains=b? no-merged=b? points-at=q sort=q].freeze,
|
248
|
+
tag: %w[n=im cleanup=b create-reflog i|ignore-case omit-empty color=b? column=b contains=b? format=q merged=b?
|
249
|
+
no-contains=b? no-merged=b? points-at=q sort=q trailer=q].freeze,
|
247
250
|
no: {
|
248
251
|
branch: %w[color color-moved column track].freeze,
|
249
252
|
checkout: %w[overwrite-ignore guess overlay progress recurse-submodules track].freeze,
|
@@ -913,7 +916,7 @@ module Squared
|
|
913
916
|
cmd << '--autostash' if option('autostash')
|
914
917
|
else
|
915
918
|
cmd << '--autostash' if flag == :autostash
|
916
|
-
|
919
|
+
option('rebase', ignore: false) do |val|
|
917
920
|
cmd << case val
|
918
921
|
when '0', 'false'
|
919
922
|
'--no-rebase'
|
@@ -976,16 +979,26 @@ module Squared
|
|
976
979
|
|
977
980
|
cmd = git_session('clone', worktree: false)
|
978
981
|
opts = data[1].dup
|
979
|
-
|
982
|
+
option('depth', ignore: false) do |val|
|
980
983
|
if (n = val.to_i) > 0
|
981
984
|
opts[:depth] = n
|
982
985
|
else
|
983
986
|
opts.delete(:depth)
|
984
987
|
end
|
985
988
|
end
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
+
option('origin', ignore: false) { |val| opts[:origin] = val }
|
990
|
+
if (branch = option('branch', strict: true))
|
991
|
+
opts[:branch] = branch
|
992
|
+
opts.delete(:revision)
|
993
|
+
else
|
994
|
+
option('revision', strict: true) do |val|
|
995
|
+
opts[:revision] = val
|
996
|
+
opts.delete(:branch)
|
997
|
+
opts.delete(:mirror)
|
998
|
+
end
|
999
|
+
end
|
1000
|
+
option('local', strict: true) { |val| opts[:local] = val != '0' }
|
1001
|
+
option('bare') { |val| opts[:bare] = val }
|
989
1002
|
opts.delete(:'recurse-submodules') || opts.delete(:'no-recurse-submodules') if append_submodules(from: :clone)
|
990
1003
|
append_hash opts
|
991
1004
|
cmd << '--quiet' unless verbose
|
@@ -1037,7 +1050,7 @@ module Squared
|
|
1037
1050
|
cmd = git_session 'status'
|
1038
1051
|
cmd << (option('long') ? '--long' : '--short')
|
1039
1052
|
cmd << '--branch' if option('branch')
|
1040
|
-
|
1053
|
+
option('ignore-submodules', ignore: false) do |val|
|
1041
1054
|
cmd << basic_option('ignore-submodules', case val
|
1042
1055
|
when '0', 'none'
|
1043
1056
|
'none'
|
@@ -1058,7 +1071,7 @@ module Squared
|
|
1058
1071
|
{ pat: /^(.)([A-Z?!])(.+)$/, styles: r, index: 2 },
|
1059
1072
|
{ pat: /^([A-Z?!])(.+)$/, styles: g },
|
1060
1073
|
{ pat: /^(\?\?)(.+)$/, styles: r },
|
1061
|
-
{ pat: /^(## )(
|
1074
|
+
{ pat: /^(## )((?~\.{3}))(\.{3})(.+)$/, styles: [nil, g, nil, r], index: -1 }
|
1062
1075
|
]
|
1063
1076
|
else
|
1064
1077
|
[pat: /^(\t+)([a-z]+: +.+)$/, styles: r, index: 2]
|
@@ -1096,9 +1109,9 @@ module Squared
|
|
1096
1109
|
args = op.to_a
|
1097
1110
|
else
|
1098
1111
|
args = []
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1112
|
+
option('untracked-files', prefix: 'git') { |val| args << basic_option('untracked-files', val) }
|
1113
|
+
option('ignore-submodules', prefix: 'git') { |val| args << basic_option('ignore-submodules', val) }
|
1114
|
+
option('ignored', prefix: 'git') { |val| args << basic_option('ignored', val) }
|
1102
1115
|
end
|
1103
1116
|
if (cur = workspace.rev_entry(name)) && cur['revision'] == sha && !env('REVBUILD_FORCE')
|
1104
1117
|
files = status_digest(*args, **kwargs)
|
@@ -1221,7 +1234,7 @@ module Squared
|
|
1221
1234
|
list_result(ret, 'tags', from: from, grep: op.extras)
|
1222
1235
|
return
|
1223
1236
|
end
|
1224
|
-
remote ||= option
|
1237
|
+
remote ||= option 'remote'
|
1225
1238
|
source
|
1226
1239
|
git_spawn('push', flag == :delete ? '-d' : nil, remote, *refs.map { |val| shell_quote(val) }) if remote
|
1227
1240
|
end
|
@@ -1388,12 +1401,12 @@ module Squared
|
|
1388
1401
|
stdout = false
|
1389
1402
|
case flag
|
1390
1403
|
when :create
|
1391
|
-
|
1392
|
-
cmd << case
|
1404
|
+
option('track', ignore: false) do |val|
|
1405
|
+
cmd << case val
|
1393
1406
|
when '0', 'false'
|
1394
1407
|
'--no-track'
|
1395
1408
|
when 'direct', 'inherit'
|
1396
|
-
basic_option
|
1409
|
+
basic_option 'track', val
|
1397
1410
|
else
|
1398
1411
|
'--track'
|
1399
1412
|
end
|
@@ -1415,7 +1428,7 @@ module Squared
|
|
1415
1428
|
remote&.each do |val|
|
1416
1429
|
source git_output('push', '--delete', *val.split('/', 2).map { |s| shell_quote(s) })
|
1417
1430
|
end
|
1418
|
-
force, list = refs.partition { |val| val.
|
1431
|
+
force, list = refs.partition { |val| val.start_with?(/[~^]/) }
|
1419
1432
|
force.each do |val|
|
1420
1433
|
dr = val[0, 2]
|
1421
1434
|
d = dr.include?('^') ? '-D' : '-d'
|
@@ -1461,7 +1474,7 @@ module Squared
|
|
1461
1474
|
data = line.sub(/^\*\s+/, '').split(/\s+/)
|
1462
1475
|
a = sub_style(data[0], styles: theme[:inline])
|
1463
1476
|
b = sub_style(data[1], styles: theme[:extra])
|
1464
|
-
r = /\A(?:\[(
|
1477
|
+
r = /\A(?:\[((?~\]\s))\]\s)?(.+)\z/m.match(data[2..-1].join(' '))
|
1465
1478
|
if (r1 = r[1]) && r1 =~ /^(.+):(?: ([a-z]+) (\d+),)? ([a-z]+) (\d+)$/
|
1466
1479
|
write = ->(s1, s2) { "#{s1.capitalize.rjust(7)}: #{sub_style(s2, styles: theme[:warn])}" }
|
1467
1480
|
r1 = $1
|
@@ -1505,7 +1518,7 @@ module Squared
|
|
1505
1518
|
when 'y', 'Y', '1', 'true'
|
1506
1519
|
'--track'
|
1507
1520
|
when 'direct', 'inherit'
|
1508
|
-
basic_option
|
1521
|
+
basic_option 'track', track
|
1509
1522
|
end
|
1510
1523
|
when :detach, :merge
|
1511
1524
|
cmd << "--#{flag}"
|
@@ -1541,7 +1554,7 @@ module Squared
|
|
1541
1554
|
when 'oneline', 'short', 'medium', 'full', 'fuller', 'reference', 'email', 'raw'
|
1542
1555
|
cmd << basic_option('format', val)
|
1543
1556
|
else
|
1544
|
-
if format.
|
1557
|
+
if format.start_with?(/t?format:/) || format.include?('%')
|
1545
1558
|
cmd << quote_option('pretty', format)
|
1546
1559
|
else
|
1547
1560
|
opts << format
|
@@ -1629,7 +1642,7 @@ module Squared
|
|
1629
1642
|
op.swap(list + files)
|
1630
1643
|
end
|
1631
1644
|
end
|
1632
|
-
append_pathspec
|
1645
|
+
append_pathspec op.extras
|
1633
1646
|
verbose = flag == :add && !op.arg?('verbose')
|
1634
1647
|
print_success if success?(source) && verbose
|
1635
1648
|
return
|
@@ -1760,15 +1773,13 @@ module Squared
|
|
1760
1773
|
end
|
1761
1774
|
|
1762
1775
|
def list_result(size, type, grep: [], action: 'found', from: nil)
|
1763
|
-
if
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
puts empty_status("No #{type} were #{action}", 'grep', grep.join(', '))
|
1771
|
-
end
|
1776
|
+
if size == 0
|
1777
|
+
puts empty_status("No #{type} were #{action}", 'grep', grep.join(', '))
|
1778
|
+
elsif verbose
|
1779
|
+
styles = theme.fetch(:banner, []).reject { |s| s.to_s.end_with?('!') }
|
1780
|
+
styles << :bold if styles.size <= 1
|
1781
|
+
puts print_footer("#{size} #{size == 1 ? type.sub(/(?:(?<!l)e)?s\z/, '') : type}",
|
1782
|
+
sub: [pat: /^(\d+)(.+)$/, styles: styles])
|
1772
1783
|
end
|
1773
1784
|
on :last, from
|
1774
1785
|
end
|
@@ -1885,9 +1896,7 @@ module Squared
|
|
1885
1896
|
if session_arg?('pathspec-from-file', target: target)
|
1886
1897
|
option_clear files
|
1887
1898
|
else
|
1888
|
-
|
1889
|
-
files = split_escape val
|
1890
|
-
end
|
1899
|
+
option('pathspec', target: target) { |val| files = split_escape val } if files.empty?
|
1891
1900
|
files = projectmap(files, parent: parent, pass: pass)
|
1892
1901
|
if !files.empty?
|
1893
1902
|
target << '--' << files.join(' ')
|
@@ -1909,28 +1918,28 @@ module Squared
|
|
1909
1918
|
end
|
1910
1919
|
|
1911
1920
|
def append_submodules(target: @session, from: nil)
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1921
|
+
option('recurse-submodules', target: target, ignore: false) do |val|
|
1922
|
+
if from == :clone
|
1923
|
+
case val
|
1924
|
+
when '0', 'false'
|
1925
|
+
target << '--no-recurse-submodules'
|
1926
|
+
when '1', 'true'
|
1927
|
+
target << '--recurse-submodules'
|
1928
|
+
else
|
1929
|
+
projectmap(split_escape(val)).each do |path|
|
1930
|
+
target << basic_option('recurse-submodules', path)
|
1931
|
+
end
|
1923
1932
|
end
|
1933
|
+
else
|
1934
|
+
target << case val
|
1935
|
+
when 'no', '0', 'false'
|
1936
|
+
'--no-recurse-submodules'
|
1937
|
+
when 'yes', 'on-demand'
|
1938
|
+
"--recurse-submodules=#{val}"
|
1939
|
+
else
|
1940
|
+
'--recurse-submodules'
|
1941
|
+
end
|
1924
1942
|
end
|
1925
|
-
else
|
1926
|
-
target << case val
|
1927
|
-
when 'no', '0', 'false'
|
1928
|
-
'--no-recurse-submodules'
|
1929
|
-
when 'yes', 'on-demand'
|
1930
|
-
"--recurse-submodules=#{val}"
|
1931
|
-
else
|
1932
|
-
'--recurse-submodules'
|
1933
|
-
end
|
1934
1943
|
end
|
1935
1944
|
end
|
1936
1945
|
|
@@ -1975,22 +1984,21 @@ module Squared
|
|
1975
1984
|
def repotrack(origin, branch, quote: true)
|
1976
1985
|
i = origin.index('/')
|
1977
1986
|
branch = "#{branch}:#{origin[i + 1..-1]}" unless origin.end_with?("/#{branch}")
|
1978
|
-
|
1979
|
-
quote ? ret.map! { |val| shell_quote(val) } : ret
|
1987
|
+
[origin[0..i - 1], branch].tap { |ret| ret.map! { |val| shell_quote(val) } if quote }
|
1980
1988
|
end
|
1981
1989
|
|
1982
1990
|
def commithash(val)
|
1983
|
-
val[/\A:(\h{5,40})\z/, 1]
|
1991
|
+
val[/\A:(\h{5,40})\z/, 1]
|
1984
1992
|
end
|
1985
1993
|
|
1986
1994
|
def commithead(val)
|
1987
1995
|
return val unless (s = matchhead(val))
|
1988
1996
|
|
1989
|
-
s.
|
1997
|
+
s.start_with?(/\d/) ? "@~#{s}" : "@#{s}"
|
1990
1998
|
end
|
1991
1999
|
|
1992
2000
|
def matchhead(val)
|
1993
|
-
val
|
2001
|
+
val =~ /^(?:(?:HEAD|@)([~^]\d*)?|H(\d+))$/ ? $2 || $1 || '' : nil
|
1994
2002
|
end
|
1995
2003
|
|
1996
2004
|
def matchpathspec
|
@@ -12,6 +12,7 @@ module Squared
|
|
12
12
|
install_as: %w[foreground-scripts g|global no-save save save-bundle save-dev E|save-exact save-optional
|
13
13
|
save-peer S|save-prod].freeze,
|
14
14
|
run: %w[foreground-scripts if-present ignore-scripts script-shell=p].freeze,
|
15
|
+
exec: %w[c|call=q package=b].freeze,
|
15
16
|
pack: %w[json ignore-scripts pack-destination=p].freeze
|
16
17
|
}.freeze
|
17
18
|
OPT_PNPM = {
|
@@ -30,6 +31,7 @@ module Squared
|
|
30
31
|
dedupe: %w[check].freeze,
|
31
32
|
run: %w[if-present no-bail parallel r|recursive report-summary reporter-hide-prefix resume-from sequential
|
32
33
|
stream use-stderr].freeze,
|
34
|
+
exec: %w[no-reporter-hide-prefix parallel r|recursive report-summary resume-from c|shell-mode].freeze,
|
33
35
|
pack: %w[json pack-destination=p pack-gzip-level=i].freeze
|
34
36
|
}.freeze
|
35
37
|
OPT_YARN = {
|
@@ -91,6 +93,8 @@ module Squared
|
|
91
93
|
'publish' => %i[latest tag].freeze,
|
92
94
|
'add' => nil,
|
93
95
|
'run' => nil,
|
96
|
+
'exec' => nil,
|
97
|
+
'nvm' => nil,
|
94
98
|
'pack' => nil
|
95
99
|
})
|
96
100
|
|
@@ -103,8 +107,8 @@ module Squared
|
|
103
107
|
initialize_build(Node.ref, prod: prod?, **kwargs)
|
104
108
|
initialize_env(**kwargs)
|
105
109
|
end
|
106
|
-
@pm = {}
|
107
110
|
@dependfile = @path + 'package.json'
|
111
|
+
@pm = {}
|
108
112
|
end
|
109
113
|
|
110
114
|
def ref
|
@@ -178,6 +182,46 @@ module Squared
|
|
178
182
|
run(from: :run)
|
179
183
|
end
|
180
184
|
end
|
185
|
+
when 'exec'
|
186
|
+
format_desc action, nil, 'pkg/cmd,opts*,args*'
|
187
|
+
task action, [:package] do |_, args|
|
188
|
+
if (package = args.package)
|
189
|
+
args = args.to_a.drop(1)
|
190
|
+
if pnpm?
|
191
|
+
pre = ->(ch) { "-#{ch}" if (ch = args.delete(ch)) }
|
192
|
+
cmd = session 'pnpm', pre.call('r'), pre.call('c'), 'exec'
|
193
|
+
list = OPT_PNPM[:exec] + OPT_PNPM[:filter] + OPT_PNPM[:common]
|
194
|
+
else
|
195
|
+
cmd = session 'npm', 'exec'
|
196
|
+
list = OPT_NPM[:exec] + OPT_NPM[:common]
|
197
|
+
end
|
198
|
+
op = OptionPartition.new(args, list, cmd, project: self)
|
199
|
+
if op.empty?
|
200
|
+
op << package
|
201
|
+
if (args = readline('Enter arguments', force: false))
|
202
|
+
op << '--' unless pnpm?
|
203
|
+
op << args
|
204
|
+
end
|
205
|
+
else
|
206
|
+
op << '--' unless pnpm?
|
207
|
+
op << package << op.join(' ')
|
208
|
+
end
|
209
|
+
else
|
210
|
+
session 'npm', 'exec', quote_option('c', readline('Enter command', force: true), double: true)
|
211
|
+
end
|
212
|
+
run(from: :exec)
|
213
|
+
end
|
214
|
+
when 'nvm'
|
215
|
+
next unless ENV['NVM_DIR']
|
216
|
+
|
217
|
+
format_desc action, nil, 'version,args*'
|
218
|
+
task action, [:version] do |_, args|
|
219
|
+
version = param_guard(action, 'version', args: args, key: :version)
|
220
|
+
args = args.to_a.drop(1)
|
221
|
+
args << readline('Enter command', force: true) if args.empty?
|
222
|
+
args.prepend(File.join(ENV['NVM_DIR'], 'nvm-exec'))
|
223
|
+
run(args.join(' '), { 'NODE_VERSION' => version }, banner: false, from: :nvm)
|
224
|
+
end
|
181
225
|
when 'pack'
|
182
226
|
format_desc action, nil, 'opts*'
|
183
227
|
task action do |_, args|
|
@@ -215,7 +259,7 @@ module Squared
|
|
215
259
|
format_desc(action, flag, 'otp?,dry-run?,public|restricted?', before: flag == :tag ? 'tag' : nil)
|
216
260
|
task flag do |_, args|
|
217
261
|
args = args.to_a
|
218
|
-
dryrun = true if args.delete('dry-run') || args.delete('
|
262
|
+
dryrun = true if args.delete('dry-run') || args.delete('d')
|
219
263
|
if args.delete('public') || args.delete('p')
|
220
264
|
access = 'public'
|
221
265
|
elsif args.delete('restricted') || args.delete('r')
|
@@ -307,12 +351,12 @@ module Squared
|
|
307
351
|
glob = as_a(glob || '**/*')
|
308
352
|
target = []
|
309
353
|
if workspace
|
310
|
-
|
311
|
-
next unless
|
354
|
+
from.glob('*').each do |entry|
|
355
|
+
next unless entry.directory?
|
312
356
|
|
313
|
-
sub = if (proj = @workspace.find(
|
357
|
+
sub = if (proj = @workspace.find(entry))
|
314
358
|
proj.packagename
|
315
|
-
elsif (file =
|
359
|
+
elsif (file = entry + 'package.json').exist?
|
316
360
|
begin
|
317
361
|
doc = JSON.parse(file.read)
|
318
362
|
rescue StandardError => e
|
@@ -323,9 +367,9 @@ module Squared
|
|
323
367
|
end
|
324
368
|
end
|
325
369
|
if sub
|
326
|
-
target << [
|
370
|
+
target << [entry, dest.join(into, sub)]
|
327
371
|
else
|
328
|
-
log.debug message("package.json in \"#{
|
372
|
+
log.debug message("package.json in \"#{entry}\"", hint: 'not found')
|
329
373
|
end
|
330
374
|
end
|
331
375
|
else
|
@@ -365,13 +409,12 @@ module Squared
|
|
365
409
|
elsif pnpm?
|
366
410
|
cmd = session 'pnpm'
|
367
411
|
if flag == :add
|
368
|
-
cmd << 'add'
|
369
|
-
cmd << "--save-#{save}"
|
412
|
+
cmd << 'add' << "--save-#{save}"
|
370
413
|
cmd << '--save-exact' if exact
|
371
414
|
else
|
372
415
|
cmd << 'install'
|
373
416
|
end
|
374
|
-
|
417
|
+
option('public-hoist-pattern', ignore: false) do |val|
|
375
418
|
split_escape(val).each { |opt| cmd << shell_option('public-hoist-pattern', opt) }
|
376
419
|
end
|
377
420
|
cmd << '--ignore-workspace' if env('NODE_WORKSPACES', equals: '0')
|
@@ -501,7 +544,7 @@ module Squared
|
|
501
544
|
found.each_with_index do |item, i|
|
502
545
|
a, b, c, d, e = item
|
503
546
|
f = inter && (rev != :major || e || semmajor?(item[5], item[6]))
|
504
|
-
if f && !confirm_outdated(a, c, (d / 2.0).ceil, lock: e)
|
547
|
+
if f && !confirm_outdated(a, c, (d / 2.0).ceil, b, lock: e, col1: col1)
|
505
548
|
cur = -1
|
506
549
|
else
|
507
550
|
cur = modified
|
@@ -527,7 +570,7 @@ module Squared
|
|
527
570
|
a = sub_style(a, styles: theme[:major])
|
528
571
|
sub_style(c, :bold, styles: color(:green))
|
529
572
|
else
|
530
|
-
sub_style(c, pat: SEM_VER, styles: color(:green), index: d)
|
573
|
+
sub_style(c, pat: SEM_VER, styles: color(d == 3 ? :green : :yellow), index: d)
|
531
574
|
end
|
532
575
|
puts "#{pad_ord.call(i, found)}. #{a + b + c}"
|
533
576
|
end
|
@@ -590,13 +633,12 @@ module Squared
|
|
590
633
|
end
|
591
634
|
unless sync
|
592
635
|
on :first, :publish unless dryrun
|
593
|
-
pwd_set(from: :publish
|
636
|
+
pwd_set(from: :publish) do
|
594
637
|
require 'open3'
|
595
|
-
banner = format_banner
|
638
|
+
banner = format_banner cmd.to_s
|
596
639
|
Open3.popen2e(cmd.done) do |_, out|
|
597
|
-
write_lines(out,
|
598
|
-
|
599
|
-
])
|
640
|
+
write_lines(out, sub: npmnotice + [pat: /^(.+)(Tarball .+)$/, styles: color(:blue), index: 2],
|
641
|
+
banner: banner)
|
600
642
|
end
|
601
643
|
end
|
602
644
|
on :last, :publish unless dryrun
|
@@ -749,9 +791,9 @@ module Squared
|
|
749
791
|
if script
|
750
792
|
ret = session dependbin, 'run'
|
751
793
|
raise_error("#{dependbin} run: given #{target}", hint: from) unless append_any(target, build: true)
|
752
|
-
append_any opts
|
794
|
+
append_any opts
|
753
795
|
append_loglevel
|
754
|
-
append_any(args, delim: true)
|
796
|
+
append_any(args, delim: true)
|
755
797
|
ret
|
756
798
|
else
|
757
799
|
case target
|
@@ -893,7 +935,7 @@ module Squared
|
|
893
935
|
end
|
894
936
|
|
895
937
|
def append_loglevel(target: @session)
|
896
|
-
level = env
|
938
|
+
level = env 'NODE_LOGLEVEL'
|
897
939
|
silent = !verbose || level == 'silent'
|
898
940
|
return unless silent || level
|
899
941
|
|