squared 0.4.19 → 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 +62 -261
- data/README.md +1280 -647
- data/README.ruby.md +722 -0
- data/lib/squared/common/base.rb +8 -9
- data/lib/squared/common/format.rb +7 -16
- data/lib/squared/common/prompt.rb +38 -42
- data/lib/squared/common/shell.rb +10 -10
- data/lib/squared/common/system.rb +31 -35
- data/lib/squared/common/utils.rb +3 -28
- data/lib/squared/common.rb +2 -1
- data/lib/squared/config.rb +19 -19
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +55 -89
- data/lib/squared/workspace/project/base.rb +262 -403
- data/lib/squared/workspace/project/docker.rb +156 -183
- data/lib/squared/workspace/project/git.rb +337 -481
- data/lib/squared/workspace/project/node.rb +96 -141
- data/lib/squared/workspace/project/python.rb +73 -299
- data/lib/squared/workspace/project/ruby.rb +158 -238
- data/lib/squared/workspace/project/support/class.rb +79 -136
- data/lib/squared/workspace/project.rb +0 -10
- data/lib/squared/workspace/repo.rb +52 -93
- data/lib/squared/workspace/series.rb +16 -16
- data/lib/squared/workspace/support/data.rb +3 -2
- data/lib/squared/workspace/support.rb +0 -1
- data/lib/squared/workspace.rb +1 -1
- data/squared.gemspec +5 -5
- metadata +7 -8
- data/lib/squared/common/class.rb +0 -110
- data/lib/squared/workspace/support/base.rb +0 -17
@@ -94,10 +94,11 @@ module Squared
|
|
94
94
|
'add' => nil,
|
95
95
|
'run' => nil,
|
96
96
|
'exec' => nil,
|
97
|
+
'nvm' => nil,
|
97
98
|
'pack' => nil
|
98
99
|
})
|
99
100
|
|
100
|
-
def initialize(*,
|
101
|
+
def initialize(*, **kwargs)
|
101
102
|
super
|
102
103
|
if @pass.include?(Node.ref)
|
103
104
|
initialize_ref Node.ref
|
@@ -107,7 +108,7 @@ module Squared
|
|
107
108
|
initialize_env(**kwargs)
|
108
109
|
end
|
109
110
|
@dependfile = @path + 'package.json'
|
110
|
-
@pm = {
|
111
|
+
@pm = {}
|
111
112
|
end
|
112
113
|
|
113
114
|
def ref
|
@@ -116,11 +117,11 @@ module Squared
|
|
116
117
|
|
117
118
|
def populate(*, **)
|
118
119
|
super
|
119
|
-
return unless
|
120
|
+
return unless outdated? && ref?(Node.ref)
|
120
121
|
|
121
122
|
namespace name do
|
122
123
|
Node.subtasks do |action, flags|
|
123
|
-
next if
|
124
|
+
next if @pass.include?(action)
|
124
125
|
|
125
126
|
if flags.nil?
|
126
127
|
case action
|
@@ -134,7 +135,7 @@ module Squared
|
|
134
135
|
end
|
135
136
|
case save
|
136
137
|
when 'prod', 'dev', 'optional', 'peer'
|
137
|
-
packages = args.
|
138
|
+
packages = args.to_a.drop(1)
|
138
139
|
else
|
139
140
|
save = 'prod'
|
140
141
|
packages = args.to_a
|
@@ -145,10 +146,10 @@ module Squared
|
|
145
146
|
when 'run'
|
146
147
|
next if (list = read_scripts).empty?
|
147
148
|
|
148
|
-
format_desc action, nil,
|
149
|
+
format_desc action, nil, 'script,opts*|^index+|#,pattern*'
|
149
150
|
task action, [:script] do |_, args|
|
150
151
|
if args.script == '#'
|
151
|
-
format_list(list,
|
152
|
+
format_list(list, 'run[^N]', 'scripts', grep: args.extras, from: dependfile.to_s)
|
152
153
|
else
|
153
154
|
args = param_guard(action, 'script', args: args.to_a)
|
154
155
|
opts = []
|
@@ -185,7 +186,7 @@ module Squared
|
|
185
186
|
format_desc action, nil, 'pkg/cmd,opts*,args*'
|
186
187
|
task action, [:package] do |_, args|
|
187
188
|
if (package = args.package)
|
188
|
-
args = args.
|
189
|
+
args = args.to_a.drop(1)
|
189
190
|
if pnpm?
|
190
191
|
pre = ->(ch) { "-#{ch}" if (ch = args.delete(ch)) }
|
191
192
|
cmd = session 'pnpm', pre.call('r'), pre.call('c'), 'exec'
|
@@ -210,6 +211,17 @@ module Squared
|
|
210
211
|
end
|
211
212
|
run(from: :exec)
|
212
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
|
213
225
|
when 'pack'
|
214
226
|
format_desc action, nil, 'opts*'
|
215
227
|
task action do |_, args|
|
@@ -226,7 +238,7 @@ module Squared
|
|
226
238
|
outdated flag, args.to_a
|
227
239
|
end
|
228
240
|
when 'package'
|
229
|
-
format_desc(action, flag, 'opts*', after: flag == :dedupe ? nil : '
|
241
|
+
format_desc(action, flag, 'opts*', after: flag == :dedupe ? nil : 'names*')
|
230
242
|
task flag do |_, args|
|
231
243
|
package flag, args.to_a
|
232
244
|
end
|
@@ -247,7 +259,7 @@ module Squared
|
|
247
259
|
format_desc(action, flag, 'otp?,dry-run?,public|restricted?', before: flag == :tag ? 'tag' : nil)
|
248
260
|
task flag do |_, args|
|
249
261
|
args = args.to_a
|
250
|
-
dryrun = true if args.delete('dry-run') || args.delete('
|
262
|
+
dryrun = true if args.delete('dry-run') || args.delete('d')
|
251
263
|
if args.delete('public') || args.delete('p')
|
252
264
|
access = 'public'
|
253
265
|
elsif args.delete('restricted') || args.delete('r')
|
@@ -257,11 +269,6 @@ module Squared
|
|
257
269
|
otp = args.first
|
258
270
|
else
|
259
271
|
tag, otp = param_guard(action, flag, args: args)
|
260
|
-
unless SEM_VER.match?(tag)
|
261
|
-
a = sub_style(project, styles: theme[:active])
|
262
|
-
b = sub_style(tag, styles: theme[:inline])
|
263
|
-
exit 1 unless confirm("Publish #{a}@#{b}? [y/N] ", 'N')
|
264
|
-
end
|
265
272
|
end
|
266
273
|
publish(flag, otp: otp, tag: tag, dryrun: dryrun, access: access)
|
267
274
|
end
|
@@ -273,7 +280,7 @@ module Squared
|
|
273
280
|
end
|
274
281
|
end
|
275
282
|
|
276
|
-
def copy(from: 'build', into: 'node_modules', scope: nil, also: nil, create: nil,
|
283
|
+
def copy(from: 'build', into: 'node_modules', scope: nil, also: nil, create: nil, workspace: false,
|
277
284
|
link: false, force: false, override: false, sync: invoked_sync?('copy'), **kwargs)
|
278
285
|
glob = kwargs[:include]
|
279
286
|
pass = kwargs[:exclude]
|
@@ -282,7 +289,6 @@ module Squared
|
|
282
289
|
|
283
290
|
from = @copy[:from] if @copy.key?(:from)
|
284
291
|
into = @copy[:into] if @copy.key?(:into)
|
285
|
-
files = @copy[:files] if @copy.key?(:files)
|
286
292
|
workspace = @copy[:workspace] if @copy.key?(:workspace)
|
287
293
|
link = @copy[:link] if @copy.key?(:link)
|
288
294
|
force = @copy[:force] if @copy.key?(:force)
|
@@ -304,7 +310,6 @@ module Squared
|
|
304
310
|
|
305
311
|
on :first, :copy
|
306
312
|
print_item unless @output[0] || !verbose || task_invoked?(/^copy(?::#{Node.ref}|$)/)
|
307
|
-
packed = false
|
308
313
|
items.each do |dir|
|
309
314
|
case dir
|
310
315
|
when Pathname
|
@@ -342,56 +347,16 @@ module Squared
|
|
342
347
|
end
|
343
348
|
next unless from && dest&.directory?
|
344
349
|
|
345
|
-
if from == :npm
|
346
|
-
begin
|
347
|
-
unless packed
|
348
|
-
require 'open3'
|
349
|
-
files = pwd_set do
|
350
|
-
Open3.capture2e(session_output('npm', 'pack --dry-run --no-color', npmname).to_s)
|
351
|
-
.first
|
352
|
-
.scan(/^npm notice \d+(?:\.\d+)?[a-z]+ (.+)$/i)
|
353
|
-
.map { |item| Pathname.new(item.first) }
|
354
|
-
.select(&:exist?)
|
355
|
-
end
|
356
|
-
.concat(Array(files))
|
357
|
-
packed = true
|
358
|
-
end
|
359
|
-
to = dest.join(into, npmname)
|
360
|
-
to.mkpath
|
361
|
-
log.info "cp npm:#{npmname} #{to}"
|
362
|
-
subdir = []
|
363
|
-
errors = 0
|
364
|
-
files.each do |file|
|
365
|
-
s, d = file.is_a?(Array) ? file : [file, file]
|
366
|
-
dest = to + d
|
367
|
-
unless subdir.include?((target = dest.dirname).to_s)
|
368
|
-
target.mkpath
|
369
|
-
subdir << target.to_s
|
370
|
-
end
|
371
|
-
begin
|
372
|
-
FileUtils.cp(path + s, dest, verbose: verbose.is_a?(Numeric) && verbose > 0)
|
373
|
-
rescue StandardError => e
|
374
|
-
print_error e
|
375
|
-
errors += 1
|
376
|
-
end
|
377
|
-
end
|
378
|
-
rescue StandardError => e
|
379
|
-
on_error e, :copy
|
380
|
-
else
|
381
|
-
puts message(to, subdir.size, files.size - errors) if verbose
|
382
|
-
end
|
383
|
-
next
|
384
|
-
end
|
385
|
-
glob = Array(glob || '**/*')
|
386
|
-
target = []
|
387
350
|
from = path + from
|
351
|
+
glob = as_a(glob || '**/*')
|
352
|
+
target = []
|
388
353
|
if workspace
|
389
|
-
|
390
|
-
next unless
|
354
|
+
from.glob('*').each do |entry|
|
355
|
+
next unless entry.directory?
|
391
356
|
|
392
|
-
sub = if (proj = @workspace.find(
|
357
|
+
sub = if (proj = @workspace.find(entry))
|
393
358
|
proj.packagename
|
394
|
-
elsif (file =
|
359
|
+
elsif (file = entry + 'package.json').exist?
|
395
360
|
begin
|
396
361
|
doc = JSON.parse(file.read)
|
397
362
|
rescue StandardError => e
|
@@ -402,20 +367,22 @@ module Squared
|
|
402
367
|
end
|
403
368
|
end
|
404
369
|
if sub
|
405
|
-
target << [
|
370
|
+
target << [entry, dest.join(into, sub)]
|
406
371
|
else
|
407
|
-
log.debug message("package.json in \"#{
|
372
|
+
log.debug message("package.json in \"#{entry}\"", hint: 'not found')
|
408
373
|
end
|
409
374
|
end
|
410
375
|
else
|
411
|
-
target << [from, dest.join(into, scope ||
|
376
|
+
target << [from, dest.join(into, scope || project)]
|
412
377
|
end
|
413
378
|
target.each do |src, to|
|
414
379
|
glob.each { |val| log.info "cp #{from + val} #{to}" }
|
415
380
|
begin
|
416
381
|
copy_dir(src, to, glob, create: create, link: link, force: force, pass: pass, verbose: verbose)
|
417
382
|
rescue StandardError => e
|
418
|
-
|
383
|
+
log.error e
|
384
|
+
ret = on(:error, :copy, e)
|
385
|
+
raise if exception && ret != true
|
419
386
|
end
|
420
387
|
end
|
421
388
|
end
|
@@ -429,19 +396,7 @@ module Squared
|
|
429
396
|
workspace.rev_clear(name, sync: sync)
|
430
397
|
return update if !flag && env('NODE_UPDATE')
|
431
398
|
|
432
|
-
|
433
|
-
yarn = pnpm ? 0 : dependtype(:yarn)
|
434
|
-
if @pm[:__] && !pnpm && yarn == 0
|
435
|
-
case @pm[:__]
|
436
|
-
when 'pnpm'
|
437
|
-
pnpm = true
|
438
|
-
when 'yarn'
|
439
|
-
yarn = 1
|
440
|
-
when 'berry'
|
441
|
-
yarn = 2
|
442
|
-
end
|
443
|
-
end
|
444
|
-
if yarn > 0
|
399
|
+
if (yarn = dependtype(:yarn)) > 0
|
445
400
|
cmd = session 'yarn'
|
446
401
|
if flag == :add
|
447
402
|
cmd << 'add'
|
@@ -451,7 +406,7 @@ module Squared
|
|
451
406
|
cmd << 'install'
|
452
407
|
cmd << '--ignore-engines' if yarn == 1 && !option('ignore-engines', equals: '0')
|
453
408
|
end
|
454
|
-
elsif pnpm
|
409
|
+
elsif pnpm?
|
455
410
|
cmd = session 'pnpm'
|
456
411
|
if flag == :add
|
457
412
|
cmd << 'add' << "--save-#{save}"
|
@@ -459,7 +414,7 @@ module Squared
|
|
459
414
|
else
|
460
415
|
cmd << 'install'
|
461
416
|
end
|
462
|
-
|
417
|
+
option('public-hoist-pattern', ignore: false) do |val|
|
463
418
|
split_escape(val).each { |opt| cmd << shell_option('public-hoist-pattern', opt) }
|
464
419
|
end
|
465
420
|
cmd << '--ignore-workspace' if env('NODE_WORKSPACES', equals: '0')
|
@@ -493,14 +448,19 @@ module Squared
|
|
493
448
|
log.info cmd.to_s
|
494
449
|
on :first, :outdated
|
495
450
|
end
|
496
|
-
banner = format_banner(cmd.temp(dryrun ? '--dry-run' : nil))
|
451
|
+
banner = format_banner(cmd.temp(dryrun ? ' --dry-run' : nil))
|
497
452
|
print_item banner if sync
|
498
453
|
begin
|
499
454
|
data = pwd_set { `#{cmd.temp('--json', '--loglevel=error')}` }
|
500
455
|
doc = dependfile.read
|
501
456
|
json = JSON.parse(doc)
|
502
457
|
rescue StandardError => e
|
503
|
-
|
458
|
+
log.error e
|
459
|
+
unless dryrun
|
460
|
+
ret = on(:error, :outdated, e)
|
461
|
+
raise if exception && ret != true
|
462
|
+
end
|
463
|
+
warn log_message(Logger::WARN, e, pass: true) if warning?
|
504
464
|
return
|
505
465
|
else
|
506
466
|
dep1 = json['dependencies'] || {}
|
@@ -584,7 +544,7 @@ module Squared
|
|
584
544
|
found.each_with_index do |item, i|
|
585
545
|
a, b, c, d, e = item
|
586
546
|
f = inter && (rev != :major || e || semmajor?(item[5], item[6]))
|
587
|
-
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)
|
588
548
|
cur = -1
|
589
549
|
else
|
590
550
|
cur = modified
|
@@ -648,42 +608,49 @@ module Squared
|
|
648
608
|
end
|
649
609
|
|
650
610
|
def update(*)
|
651
|
-
package
|
611
|
+
package 'update'
|
652
612
|
end
|
653
613
|
|
654
|
-
def publish(flag = nil, *, sync: invoked_sync?('publish', flag), otp: nil, tag: nil,
|
655
|
-
if
|
656
|
-
|
614
|
+
def publish(flag = nil, *, sync: invoked_sync?('publish', flag), otp: nil, tag: nil, dryrun: nil, access: nil)
|
615
|
+
if read_packagemanager(:private)
|
616
|
+
if warning?
|
617
|
+
warn log_message(Logger::WARN, 'invalid task "publish"', subject: name, hint: 'private', pass: true)
|
618
|
+
end
|
657
619
|
return
|
658
620
|
end
|
621
|
+
return unless version
|
622
|
+
|
659
623
|
cmd = session 'npm', 'publish'
|
624
|
+
dryrun = dryrun?('npm') if dryrun.nil?
|
660
625
|
cmd << basic_option('otp', otp) if otp ||= option('otp')
|
661
626
|
cmd << basic_option('tag', tag) if tag ||= option('tag')
|
662
627
|
cmd << basic_option('access', access) if access ||= option('access')
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
write_lines(out, sub: npmnotice + [pat: /^(.+)(Tarball .+)$/, styles: color(:blue), index: 2],
|
679
|
-
banner: banner)
|
628
|
+
if verbose
|
629
|
+
if dryrun
|
630
|
+
cmd << '--dry-run'
|
631
|
+
else
|
632
|
+
log.info cmd.to_s
|
633
|
+
end
|
634
|
+
unless sync
|
635
|
+
on :first, :publish unless dryrun
|
636
|
+
pwd_set(from: :publish) do
|
637
|
+
require 'open3'
|
638
|
+
banner = format_banner cmd.to_s
|
639
|
+
Open3.popen2e(cmd.done) do |_, out|
|
640
|
+
write_lines(out, sub: npmnotice + [pat: /^(.+)(Tarball .+)$/, styles: color(:blue), index: 2],
|
641
|
+
banner: banner)
|
642
|
+
end
|
680
643
|
end
|
644
|
+
on :last, :publish unless dryrun
|
645
|
+
return
|
681
646
|
end
|
682
|
-
|
647
|
+
elsif dryrun
|
648
|
+
return
|
683
649
|
end
|
650
|
+
run(from: :publish, sync: sync)
|
684
651
|
end
|
685
652
|
|
686
|
-
def package(flag, opts = []
|
653
|
+
def package(flag, opts = [])
|
687
654
|
workspace.rev_clear(name)
|
688
655
|
if (yarn = dependtype(:yarn)) > 0
|
689
656
|
cmd = session 'yarn', if flag == :update
|
@@ -709,7 +676,6 @@ module Squared
|
|
709
676
|
list = OPT_NPM[:install_base] + OPT_NPM.fetch(flag, []) + OPT_NPM[:common]
|
710
677
|
list.concat(OPT_NPM[:install_as]) unless flag == :dedupe
|
711
678
|
no = OPT_NPM[:install_no]
|
712
|
-
cmd << '--save=true' if option('save')
|
713
679
|
end
|
714
680
|
op = OptionPartition.new(opts, list, cmd, no: no, project: self)
|
715
681
|
op.each do |opt|
|
@@ -734,7 +700,7 @@ module Squared
|
|
734
700
|
end
|
735
701
|
op.clear(errors: true)
|
736
702
|
end
|
737
|
-
run(from:
|
703
|
+
run(from: :"package:#{flag}")
|
738
704
|
end
|
739
705
|
|
740
706
|
def bump(flag, val = nil)
|
@@ -748,17 +714,14 @@ module Squared
|
|
748
714
|
when :major
|
749
715
|
if seg[0] != '0' || seg[2].nil?
|
750
716
|
seg[0] = seg[0].succ
|
751
|
-
seg[2] = '0'
|
752
717
|
else
|
753
718
|
seg[2] = seg[2].succ
|
754
719
|
end
|
755
|
-
seg[4] = '0'
|
756
720
|
when :minor
|
757
721
|
if seg[0] == '0'
|
758
722
|
seg[4] &&= seg[4].succ
|
759
723
|
else
|
760
724
|
seg[2] = seg[2].succ
|
761
|
-
seg[4] &&= '0'
|
762
725
|
end
|
763
726
|
when :patch
|
764
727
|
seg[4] &&= seg[4].succ
|
@@ -774,22 +737,24 @@ module Squared
|
|
774
737
|
log.info "bump version #{cur} to #{val} (#{flag})"
|
775
738
|
on :first, :bump
|
776
739
|
end
|
777
|
-
if
|
778
|
-
puts val
|
779
|
-
elsif verbose
|
740
|
+
if verbose
|
780
741
|
major = flag == :major
|
781
742
|
emphasize("version: #{val}", title: name, border: borderstyle, sub: [
|
782
743
|
headerstyle,
|
783
744
|
{ pat: /\A(version:)( )(\S+)(.*)\z/, styles: color(major ? :green : :yellow), index: 3 },
|
784
745
|
{ pat: /\A(version:)(.*)\z/, styles: theme[major ? :major : :active] }
|
785
746
|
])
|
747
|
+
elsif stdin?
|
748
|
+
puts val
|
786
749
|
end
|
787
750
|
on :last, :bump unless dryrun?
|
788
751
|
else
|
789
752
|
raise_error('version not found', hint: dependfile)
|
790
753
|
end
|
791
754
|
rescue StandardError => e
|
792
|
-
|
755
|
+
log.debug e
|
756
|
+
ret = on(:error, :bump, e)
|
757
|
+
raise if exception && ret != true
|
793
758
|
end
|
794
759
|
end
|
795
760
|
|
@@ -799,7 +764,7 @@ module Squared
|
|
799
764
|
cmd = session dependbin, 'pack'
|
800
765
|
if dependtype(:yarn) > 1
|
801
766
|
op = OptionPartition.new(opts, OPT_BERRY[:pack], cmd, project: self)
|
802
|
-
op
|
767
|
+
op << quote_option('out', Pathname.pwd + "#{project}-#{version}.tgz") unless op.arg?('out')
|
803
768
|
else
|
804
769
|
op = OptionPartition.new(opts, pnpm? ? OPT_PNPM[:pack] : OPT_NPM[:pack] + OPT_NPM[:common], cmd,
|
805
770
|
project: self)
|
@@ -814,7 +779,7 @@ module Squared
|
|
814
779
|
end
|
815
780
|
end
|
816
781
|
end
|
817
|
-
op
|
782
|
+
op << quote_option('pack-destination', Dir.pwd) unless op.arg?('pack-destination')
|
818
783
|
end
|
819
784
|
op.clear
|
820
785
|
run(from: :pack)
|
@@ -826,9 +791,9 @@ module Squared
|
|
826
791
|
if script
|
827
792
|
ret = session dependbin, 'run'
|
828
793
|
raise_error("#{dependbin} run: given #{target}", hint: from) unless append_any(target, build: true)
|
829
|
-
append_any opts
|
794
|
+
append_any opts
|
830
795
|
append_loglevel
|
831
|
-
append_any(args, delim: true)
|
796
|
+
append_any(args, delim: true)
|
832
797
|
ret
|
833
798
|
else
|
834
799
|
case target
|
@@ -928,17 +893,13 @@ module Squared
|
|
928
893
|
end
|
929
894
|
|
930
895
|
def version
|
931
|
-
@version
|
896
|
+
super || (@version = read_packagemanager(:version))
|
932
897
|
end
|
933
898
|
|
934
899
|
def packagename
|
935
900
|
read_packagemanager :name
|
936
901
|
end
|
937
902
|
|
938
|
-
def scripts
|
939
|
-
@scripts ||= read_scripts.to_h
|
940
|
-
end
|
941
|
-
|
942
903
|
private
|
943
904
|
|
944
905
|
def read_packagemanager(key = nil, version: nil, update: false)
|
@@ -956,11 +917,9 @@ module Squared
|
|
956
917
|
@pm[:_] = false
|
957
918
|
nil
|
958
919
|
else
|
959
|
-
if key
|
960
|
-
|
961
|
-
|
962
|
-
ret
|
963
|
-
end
|
920
|
+
return @pm[key] if key
|
921
|
+
|
922
|
+
!(ret = @pm[:_]) || (version && ret[ret.index('@') + 1..-1] < version) ? nil : ret
|
964
923
|
end
|
965
924
|
|
966
925
|
def read_install
|
@@ -976,7 +935,7 @@ module Squared
|
|
976
935
|
end
|
977
936
|
|
978
937
|
def append_loglevel(target: @session)
|
979
|
-
level = env
|
938
|
+
level = env 'NODE_LOGLEVEL'
|
980
939
|
silent = !verbose || level == 'silent'
|
981
940
|
return unless silent || level
|
982
941
|
|
@@ -1007,6 +966,10 @@ module Squared
|
|
1007
966
|
end
|
1008
967
|
end
|
1009
968
|
|
969
|
+
def dryrun?(prefix = dependbin, **)
|
970
|
+
super || !option('dry-run', prefix: prefix).nil?
|
971
|
+
end
|
972
|
+
|
1010
973
|
def dependbin
|
1011
974
|
if yarn?
|
1012
975
|
'yarn'
|
@@ -1019,10 +982,6 @@ module Squared
|
|
1019
982
|
'package.json' if parent&.has?('outdated', Node.ref)
|
1020
983
|
end
|
1021
984
|
|
1022
|
-
def npmname
|
1023
|
-
packagename || project
|
1024
|
-
end
|
1025
|
-
|
1026
985
|
def npmnotice
|
1027
986
|
[
|
1028
987
|
{ pat: /^(npm error )(code|\d+)(.+)$/, styles: color(:cyan), index: 2 },
|
@@ -1031,10 +990,6 @@ module Squared
|
|
1031
990
|
{ pat: /^(npm )(.+)$/, styles: :bold }
|
1032
991
|
]
|
1033
992
|
end
|
1034
|
-
|
1035
|
-
def dryrun?(prefix = dependbin, **)
|
1036
|
-
super || !option('dry-run', prefix: prefix).nil?
|
1037
|
-
end
|
1038
993
|
end
|
1039
994
|
|
1040
995
|
Application.implement Node
|