squared 0.6.11 → 0.7.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 +69 -41
- data/README.md +242 -204
- data/lib/squared/common/format.rb +7 -10
- data/lib/squared/common/prompt.rb +23 -24
- data/lib/squared/common/shell.rb +16 -17
- data/lib/squared/common/system.rb +29 -20
- data/lib/squared/common/utils.rb +43 -54
- data/lib/squared/config.rb +17 -16
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +290 -175
- data/lib/squared/workspace/project/base.rb +553 -455
- data/lib/squared/workspace/project/docker.rb +162 -155
- data/lib/squared/workspace/project/git.rb +190 -155
- data/lib/squared/workspace/project/node.rb +110 -116
- data/lib/squared/workspace/project/python.rb +243 -153
- data/lib/squared/workspace/project/ruby.rb +403 -291
- data/lib/squared/workspace/project/support/class.rb +13 -7
- data/lib/squared/workspace/project/support/optionpartition.rb +70 -55
- data/lib/squared/workspace/project/support/utils.rb +68 -0
- data/lib/squared/workspace/project.rb +0 -7
- data/lib/squared/workspace/repo.rb +234 -169
- data/lib/squared/workspace/series.rb +91 -86
- data/lib/squared/workspace/support/base.rb +15 -1
- metadata +2 -1
|
@@ -5,7 +5,7 @@ module Squared
|
|
|
5
5
|
module Project
|
|
6
6
|
class Node < Git
|
|
7
7
|
OPT_NPM = {
|
|
8
|
-
common: %w[dry-run=!?
|
|
8
|
+
common: %w[dry-run=!? loglevel=b include-workspace-root=!? workspaces=!? w|workspace=v].freeze,
|
|
9
9
|
install: %w[package-lock-only=!? prefer-dedupe=!? E|save-exact=!? before=q cpu=b libc=b os=b].freeze,
|
|
10
10
|
install_a: %w[audit=! bin-links=! foreground-scripts=!? fund=! ignore-scripts=!? install-links=!?
|
|
11
11
|
package-lock=! strict-peer-deps=!? include=b install-strategy=b omit=b].freeze,
|
|
@@ -149,11 +149,11 @@ module Squared
|
|
|
149
149
|
'pack' => nil
|
|
150
150
|
})
|
|
151
151
|
|
|
152
|
-
def initialize(*,
|
|
152
|
+
def initialize(*, ts: 'tsconfig.json', asdf: 'nodejs', **kwargs)
|
|
153
153
|
super
|
|
154
154
|
if @pass.include?(Node.ref)
|
|
155
155
|
initialize_ref Node.ref
|
|
156
|
-
initialize_logger
|
|
156
|
+
initialize_logger kwargs[:log]
|
|
157
157
|
else
|
|
158
158
|
initialize_build(Node.ref, prod: prod?, **kwargs)
|
|
159
159
|
initialize_env(**kwargs)
|
|
@@ -161,7 +161,7 @@ module Squared
|
|
|
161
161
|
@dependname = 'package.json'
|
|
162
162
|
dependfile_set [@dependname]
|
|
163
163
|
@tsfile = basepath! ts
|
|
164
|
-
@pm = { __: init }
|
|
164
|
+
@pm = { __: kwargs[:init] }
|
|
165
165
|
end
|
|
166
166
|
|
|
167
167
|
def ref
|
|
@@ -201,23 +201,24 @@ module Squared
|
|
|
201
201
|
format_list(list, "run[#{indexchar}N]", 'scripts', grep: args.extras, from: dependfile)
|
|
202
202
|
else
|
|
203
203
|
args = param_guard(action, 'script', args: args.to_a)
|
|
204
|
-
opts = []
|
|
205
|
-
args.each do |val|
|
|
204
|
+
opts = args.each_with_object([]) do |val, out|
|
|
206
205
|
if (n, extra = indexitem(val))
|
|
207
206
|
if (item = list[n.pred])
|
|
208
207
|
run compose([item.first, extra].compact.join(' '), script: true)
|
|
209
208
|
elsif exception
|
|
210
209
|
indexerror n, list
|
|
211
210
|
else
|
|
212
|
-
|
|
211
|
+
log.warn "run script #{n} of #{list.size}".subhint('out of range')
|
|
212
|
+
next
|
|
213
213
|
end
|
|
214
214
|
else
|
|
215
|
-
|
|
215
|
+
out << val
|
|
216
216
|
end
|
|
217
217
|
end
|
|
218
218
|
next if opts.empty?
|
|
219
219
|
|
|
220
|
-
|
|
220
|
+
yarn = dependtype(:yarn)
|
|
221
|
+
list = if yarn > 0
|
|
221
222
|
yarn == 1 ? OPT_YARN[:run] + OPT_YARN[:common] : OPT_BERRY[:run]
|
|
222
223
|
elsif pnpm?
|
|
223
224
|
pnpmopts :run, :common_filter
|
|
@@ -260,14 +261,20 @@ module Squared
|
|
|
260
261
|
run(from: :exec)
|
|
261
262
|
end
|
|
262
263
|
when 'nvm'
|
|
263
|
-
next unless ENV['NVM_DIR']
|
|
264
|
+
next unless ENV['NVM_DIR'] && !workspace.windows?
|
|
264
265
|
|
|
265
|
-
format_desc action, nil, 'version
|
|
266
|
+
format_desc action, nil, 'version?,args*'
|
|
266
267
|
task action, [:version] do |_, args|
|
|
267
|
-
|
|
268
|
+
path = ->(s) { File.join(ENV['NVM_DIR'], s) }
|
|
269
|
+
unless (version = args.version)
|
|
270
|
+
cmd = ". #{path.call('nvm.sh')} && nvm list --no-colors --no-alias"
|
|
271
|
+
version = pwd_set(from: :nvm) do
|
|
272
|
+
choice_index('Select a version', IO.popen(cmd).map { |line| line[/\s(v\S+)/, 1] }, series: true)
|
|
273
|
+
end
|
|
274
|
+
end
|
|
268
275
|
args = args.extras
|
|
269
276
|
args << readline('Enter command', force: true) if args.empty?
|
|
270
|
-
args.unshift(
|
|
277
|
+
args.unshift(path.call('nvm-exec'))
|
|
271
278
|
run(args.join(' '), { 'NODE_VERSION' => version }, banner: false, from: :nvm)
|
|
272
279
|
end
|
|
273
280
|
when 'pack'
|
|
@@ -423,11 +430,12 @@ module Squared
|
|
|
423
430
|
begin
|
|
424
431
|
unless packed
|
|
425
432
|
require 'open3'
|
|
426
|
-
|
|
427
|
-
|
|
433
|
+
cmd = session_output 'npm', 'pack --dry-run --no-color', npmname
|
|
434
|
+
files = pwd_set(cmd, from: :'npm:pack') do
|
|
435
|
+
Open3.capture2e(cmd.to_s)
|
|
428
436
|
.first
|
|
429
437
|
.scan(/^npm notice \d+(?:\.\d+)?[a-z]+ (.+)$/i)
|
|
430
|
-
.map
|
|
438
|
+
.map { |item| Pathname.new(item.first) }
|
|
431
439
|
.select(&:exist?)
|
|
432
440
|
end.concat(Array(files))
|
|
433
441
|
packed = true
|
|
@@ -435,21 +443,21 @@ module Squared
|
|
|
435
443
|
base = dest.join(into, npmname)
|
|
436
444
|
base.mkpath
|
|
437
445
|
log.info "cp npm:#{npmname} #{base}"
|
|
438
|
-
subdir = []
|
|
439
446
|
errors = 0
|
|
440
|
-
files.
|
|
441
|
-
s, d = file.is_a?(Array) ? file : [file
|
|
447
|
+
subdir = files.each_with_object([]) do |file, out|
|
|
448
|
+
s, d = file.is_a?(Array) ? file : [file] * 2
|
|
442
449
|
dest = base + d
|
|
443
|
-
|
|
450
|
+
target = dest.dirname
|
|
451
|
+
unless out.include?(dirname = target.to_s)
|
|
444
452
|
target.mkpath
|
|
445
|
-
|
|
453
|
+
out << dirname
|
|
446
454
|
end
|
|
447
455
|
FileUtils.cp(basepath(s), dest, verbose: !silent?)
|
|
448
|
-
rescue
|
|
449
|
-
print_error e
|
|
456
|
+
rescue => e
|
|
457
|
+
print_error(Logger::ERROR, e, subject: name)
|
|
450
458
|
errors += 1
|
|
451
459
|
end
|
|
452
|
-
rescue
|
|
460
|
+
rescue => e
|
|
453
461
|
on_error e, :copy
|
|
454
462
|
else
|
|
455
463
|
puts message(base, subdir.size, files.size - errors) unless silent?
|
|
@@ -469,9 +477,8 @@ module Squared
|
|
|
469
477
|
begin
|
|
470
478
|
doc = JSON.parse(file.read)
|
|
471
479
|
doc['name']
|
|
472
|
-
rescue
|
|
473
|
-
|
|
474
|
-
raise if exception
|
|
480
|
+
rescue => e
|
|
481
|
+
print_error(Logger::ERROR, e, subject: proj.name)
|
|
475
482
|
end
|
|
476
483
|
end
|
|
477
484
|
if sub
|
|
@@ -486,8 +493,8 @@ module Squared
|
|
|
486
493
|
target.each do |src, to|
|
|
487
494
|
glob.each { |val| log.info "cp #{from + val} #{to}" }
|
|
488
495
|
copy_dir(src, to, glob, create: create, link: link, force: force, pass: pass, verbose: !silent?)
|
|
489
|
-
rescue
|
|
490
|
-
on_error e
|
|
496
|
+
rescue => e
|
|
497
|
+
on_error e
|
|
491
498
|
end
|
|
492
499
|
end
|
|
493
500
|
on :last, :copy
|
|
@@ -499,7 +506,7 @@ module Squared
|
|
|
499
506
|
super
|
|
500
507
|
elsif outdated?
|
|
501
508
|
workspace.rev_clear(name, sync: sync)
|
|
502
|
-
return update if !flag && env('NODE_UPDATE')
|
|
509
|
+
return update if !flag && (env('UPDATE') || env('NODE_UPDATE'))
|
|
503
510
|
|
|
504
511
|
add = flag == :add
|
|
505
512
|
if add
|
|
@@ -526,39 +533,35 @@ module Squared
|
|
|
526
533
|
rm = lambda do |target|
|
|
527
534
|
return if remove.empty?
|
|
528
535
|
|
|
529
|
-
run(target.temp(*remove).sub!(/ (?:add|install) /, ' remove '),
|
|
536
|
+
run(target.temp(*remove).sub!(/ (?:add|install) /, ' remove '), sync: sync, from: :remove)
|
|
530
537
|
end
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
538
|
+
yarn = dependtype(:yarn)
|
|
539
|
+
if yarn > 0
|
|
540
|
+
cmd = session('yarn', flag || 'install')
|
|
541
|
+
append_loglevel
|
|
542
|
+
if yarn == 1
|
|
543
|
+
cmd << '--ignore-engines' if option('ignore-engines')
|
|
544
|
+
cmd << '--ignore-scripts' if option('ignore-scripts')
|
|
545
|
+
cmd << '--force' if option('force')
|
|
534
546
|
else
|
|
535
|
-
cmd
|
|
547
|
+
cmd << '--mode=skip-build' if option('ignore-scripts')
|
|
548
|
+
cmd << '--check-cache' if !flag && option('force')
|
|
549
|
+
end
|
|
550
|
+
if nolockfile?('yarn')
|
|
551
|
+
cmd << '--no-lockfile'
|
|
552
|
+
elsif option('ci')
|
|
536
553
|
if yarn == 1
|
|
537
|
-
cmd << '--
|
|
538
|
-
|
|
539
|
-
cmd << '--
|
|
540
|
-
cmd << '--force' if option('force')
|
|
541
|
-
else
|
|
542
|
-
cmd << '--mode=skip-build' if option('ignore-scripts')
|
|
543
|
-
cmd << '--check-cache' if !flag && option('force')
|
|
544
|
-
end
|
|
545
|
-
if nolockfile?('yarn')
|
|
546
|
-
cmd << '--no-lockfile'
|
|
547
|
-
elsif option('ci')
|
|
548
|
-
if yarn == 1
|
|
549
|
-
cmd << '--frozen-lockfile'
|
|
550
|
-
elsif !flag
|
|
551
|
-
cmd << '--immutable' << '--refresh-lockfile'
|
|
552
|
-
end
|
|
553
|
-
end
|
|
554
|
-
if add
|
|
555
|
-
cmd << '-W' if yarn == 1 && !option('w', 'ignore-workspace-root-check', equals: '0')
|
|
556
|
-
rm.call(cmd)
|
|
557
|
-
om.call(cmd)
|
|
558
|
-
cmd << '--exact' if exact
|
|
554
|
+
cmd << '--frozen-lockfile'
|
|
555
|
+
elsif !flag
|
|
556
|
+
cmd << '--immutable' << '--refresh-lockfile'
|
|
559
557
|
end
|
|
560
558
|
end
|
|
561
|
-
|
|
559
|
+
if add
|
|
560
|
+
cmd << '-W' if yarn == 1 && option('w', 'ignore-workspace-root-check', notequals: '0')
|
|
561
|
+
rm.call(cmd)
|
|
562
|
+
om.call(cmd)
|
|
563
|
+
cmd << '--exact' if exact
|
|
564
|
+
end
|
|
562
565
|
elsif pnpm?
|
|
563
566
|
cmd = session('pnpm', flag || 'install')
|
|
564
567
|
append_nocolor
|
|
@@ -569,7 +572,6 @@ module Squared
|
|
|
569
572
|
cmd << '--save-exact' if exact
|
|
570
573
|
option('allow-build') { |val| cmd << quote_option('allow-build', val) }
|
|
571
574
|
else
|
|
572
|
-
cmd << '--prod' if prod?
|
|
573
575
|
append_platform
|
|
574
576
|
end
|
|
575
577
|
option('public-hoist-pattern') do |val|
|
|
@@ -594,8 +596,6 @@ module Squared
|
|
|
594
596
|
if omit
|
|
595
597
|
cmd << "--omit=#{save || omit}"
|
|
596
598
|
save = nil
|
|
597
|
-
elsif !add && prod?
|
|
598
|
-
cmd << '--include=prod'
|
|
599
599
|
end
|
|
600
600
|
unless ci
|
|
601
601
|
if add
|
|
@@ -614,7 +614,7 @@ module Squared
|
|
|
614
614
|
|
|
615
615
|
cmd.merge(packages.quote!)
|
|
616
616
|
end
|
|
617
|
-
run(from: flag || :depend
|
|
617
|
+
run(sync: sync, from: flag || :depend)
|
|
618
618
|
end
|
|
619
619
|
end
|
|
620
620
|
|
|
@@ -628,14 +628,14 @@ module Squared
|
|
|
628
628
|
banner = format_banner(cmd.temp(('--dry-run' if dryrun)))
|
|
629
629
|
print_item banner if sync
|
|
630
630
|
begin
|
|
631
|
-
data = pwd_set(dryrun: dryrun) { `#{cmd.temp('--json --loglevel=error')}` }
|
|
631
|
+
data = pwd_set(cmd, dryrun: dryrun) { `#{cmd.temp('--json --loglevel=error')}` }
|
|
632
632
|
doc = dependfile.read
|
|
633
633
|
json = JSON.parse(doc)
|
|
634
634
|
dep1 = json['dependencies'] || {}
|
|
635
635
|
dep2 = json['devDependencies'] || {}
|
|
636
636
|
target = json['name']
|
|
637
|
-
rescue
|
|
638
|
-
on_error(e,
|
|
637
|
+
rescue => e
|
|
638
|
+
on_error(e, dryrun: dryrun)
|
|
639
639
|
return
|
|
640
640
|
end
|
|
641
641
|
found = []
|
|
@@ -866,7 +866,7 @@ module Squared
|
|
|
866
866
|
end
|
|
867
867
|
return
|
|
868
868
|
end
|
|
869
|
-
return print_error(
|
|
869
|
+
return print_error("version: #{dependname}", subject: name, hint: 'not found') unless version
|
|
870
870
|
|
|
871
871
|
cmd = session 'npm', 'publish'
|
|
872
872
|
cmd << basic_option('otp', otp) if otp ||= option('otp')
|
|
@@ -889,8 +889,9 @@ module Squared
|
|
|
889
889
|
else
|
|
890
890
|
require 'open3'
|
|
891
891
|
on :first, from
|
|
892
|
-
pwd_set(
|
|
893
|
-
|
|
892
|
+
pwd_set(cmd, dryrun: dryrun) do
|
|
893
|
+
cmd = session_done cmd
|
|
894
|
+
Open3.popen2e(cmd) do |_, out|
|
|
894
895
|
write_lines(out, banner: format_banner(cmd),
|
|
895
896
|
sub: npmnotice(opt_style(color(:bright_blue), /^(.+)(Tarball .+)$/, 2)))
|
|
896
897
|
end
|
|
@@ -935,7 +936,7 @@ module Squared
|
|
|
935
936
|
end, cmd, project: self)
|
|
936
937
|
if yarn == 1 && flag != :reinstall
|
|
937
938
|
op << '--no-lockfile' if nolockfile?('yarn')
|
|
938
|
-
op << '--ignore-engines'
|
|
939
|
+
op << '--ignore-engines' if option('ignore-engines')
|
|
939
940
|
end
|
|
940
941
|
else
|
|
941
942
|
args = if pnpm?
|
|
@@ -950,22 +951,18 @@ module Squared
|
|
|
950
951
|
flag = :install
|
|
951
952
|
end
|
|
952
953
|
flags = [flag]
|
|
953
|
-
unless flag == :rebuild
|
|
954
|
-
|
|
955
|
-
|
|
954
|
+
flags << :install_a unless flag == :rebuild
|
|
955
|
+
unless flag == :dedupe
|
|
956
|
+
flags << :common_filter
|
|
957
|
+
unless flag == :add
|
|
958
|
+
flags << :install_b
|
|
959
|
+
flags << :common_cpu unless flag == :update
|
|
960
|
+
end
|
|
956
961
|
end
|
|
962
|
+
no = OPT_PNPM[:no][flag]
|
|
957
963
|
[
|
|
958
964
|
opts,
|
|
959
|
-
flags
|
|
960
|
-
unless flag == :dedupe
|
|
961
|
-
out << :common_filter
|
|
962
|
-
unless flag == :add
|
|
963
|
-
out << :install_b
|
|
964
|
-
out << :common_cpu unless flag == :update
|
|
965
|
-
end
|
|
966
|
-
end
|
|
967
|
-
pnpmopts(*out)
|
|
968
|
-
end,
|
|
965
|
+
pnpmopts(*flags),
|
|
969
966
|
session('pnpm', flag)
|
|
970
967
|
]
|
|
971
968
|
else
|
|
@@ -987,12 +984,12 @@ module Squared
|
|
|
987
984
|
unless flag == :dedupe
|
|
988
985
|
%w[save ignore-scripts strict-peer-deps].each do |key|
|
|
989
986
|
option(key, prefix: 'npm', ignore: false) do |val|
|
|
990
|
-
opts << case val
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
987
|
+
opts << basic_option(key, case val
|
|
988
|
+
when '0', 'false'
|
|
989
|
+
false
|
|
990
|
+
else
|
|
991
|
+
true
|
|
992
|
+
end)
|
|
996
993
|
end
|
|
997
994
|
end
|
|
998
995
|
flags << :install_b
|
|
@@ -1024,15 +1021,14 @@ module Squared
|
|
|
1024
1021
|
op.found << (spec == 2 && (n = opt.index('@')) ? opt[0, n] : opt)
|
|
1025
1022
|
end
|
|
1026
1023
|
end
|
|
1027
|
-
op.swap
|
|
1028
|
-
.concat(packages)
|
|
1024
|
+
op.swap.concat(packages)
|
|
1029
1025
|
raise_error ArgumentError, 'no packages to add' if op.empty? && spec == 1
|
|
1030
1026
|
op.append(quote: true)
|
|
1031
1027
|
.clear(errors: true)
|
|
1032
1028
|
else
|
|
1033
1029
|
op.clear
|
|
1034
1030
|
end
|
|
1035
|
-
run(from: from ||
|
|
1031
|
+
run(from: from || symjoin('package', flag))
|
|
1036
1032
|
end
|
|
1037
1033
|
|
|
1038
1034
|
def bump(flag, val = nil)
|
|
@@ -1062,8 +1058,8 @@ module Squared
|
|
|
1062
1058
|
else
|
|
1063
1059
|
raise_error 'version not found', hint: dependfile
|
|
1064
1060
|
end
|
|
1065
|
-
rescue
|
|
1066
|
-
on_error(e,
|
|
1061
|
+
rescue => e
|
|
1062
|
+
on_error(e, dryrun: dryrun?)
|
|
1067
1063
|
end
|
|
1068
1064
|
|
|
1069
1065
|
def pack(opts = [])
|
|
@@ -1123,11 +1119,9 @@ module Squared
|
|
|
1123
1119
|
print_run(cmd, banner, **kwargs)
|
|
1124
1120
|
session 'npx', cmd
|
|
1125
1121
|
start = time_epoch if kwargs.fetch(:verbose, verbose? && !stdin?)
|
|
1126
|
-
run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception), from: from)
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
print_status(name, subject: 'tsc', start: start, from: :completed)
|
|
1130
|
-
end
|
|
1122
|
+
ret = run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: from)
|
|
1123
|
+
print_status(name, subject: 'tsc', start: start) if success?(ret, banner, start.nil?) && start
|
|
1124
|
+
ret
|
|
1131
1125
|
end
|
|
1132
1126
|
|
|
1133
1127
|
def compose(target, opts = nil, script: false, args: nil, from: nil, **)
|
|
@@ -1247,7 +1241,7 @@ module Squared
|
|
|
1247
1241
|
private
|
|
1248
1242
|
|
|
1249
1243
|
def read_package(key = 'packageManager', update: false)
|
|
1250
|
-
|
|
1244
|
+
unless !update && @pm.key?(key)
|
|
1251
1245
|
doc = JSON.parse(dependfile.read)
|
|
1252
1246
|
@pm[key] = case key
|
|
1253
1247
|
when 'packageManager'
|
|
@@ -1264,7 +1258,7 @@ module Squared
|
|
|
1264
1258
|
@pm[:_] = true
|
|
1265
1259
|
end
|
|
1266
1260
|
end
|
|
1267
|
-
rescue
|
|
1261
|
+
rescue => e
|
|
1268
1262
|
log.debug e
|
|
1269
1263
|
@pm[key] = nil
|
|
1270
1264
|
else
|
|
@@ -1307,7 +1301,7 @@ module Squared
|
|
|
1307
1301
|
else
|
|
1308
1302
|
1
|
|
1309
1303
|
end
|
|
1310
|
-
rescue
|
|
1304
|
+
rescue => e
|
|
1311
1305
|
return 0 if exist
|
|
1312
1306
|
|
|
1313
1307
|
log.debug e
|
|
@@ -1326,7 +1320,7 @@ module Squared
|
|
|
1326
1320
|
else
|
|
1327
1321
|
4
|
|
1328
1322
|
end
|
|
1329
|
-
rescue
|
|
1323
|
+
rescue => e
|
|
1330
1324
|
if exist
|
|
1331
1325
|
%w[pnpm-lock.yaml pnpm-workspace.yaml].any? { |val| exist?(val) } ? 4 : 0
|
|
1332
1326
|
else
|
|
@@ -1337,14 +1331,14 @@ module Squared
|
|
|
1337
1331
|
|
|
1338
1332
|
def remove_modules(prefix = dependbin)
|
|
1339
1333
|
modules = basepath 'node_modules'
|
|
1340
|
-
return false unless modules.directory? &&
|
|
1334
|
+
return false unless modules.directory? && (option('y', prefix: prefix) || confirm_basic('Remove?', modules))
|
|
1341
1335
|
|
|
1342
1336
|
modules.rmtree
|
|
1343
1337
|
rescue Timeout::Error => e
|
|
1344
1338
|
puts
|
|
1345
1339
|
print_error(e, hint: modules, pass: true)
|
|
1346
1340
|
exit 1
|
|
1347
|
-
rescue
|
|
1341
|
+
rescue => e
|
|
1348
1342
|
print_error(e, pass: true)
|
|
1349
1343
|
false
|
|
1350
1344
|
else
|
|
@@ -1425,23 +1419,23 @@ module Squared
|
|
|
1425
1419
|
end
|
|
1426
1420
|
|
|
1427
1421
|
def lockfile(delete = false)
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
if
|
|
1422
|
+
ret = basepath(if yarn?
|
|
1423
|
+
'yarn.lock'
|
|
1424
|
+
else
|
|
1425
|
+
pnpm? ? 'pnpm-lock.yaml' : 'package-lock.json'
|
|
1426
|
+
end)
|
|
1427
|
+
if ret.exist?
|
|
1434
1428
|
if delete
|
|
1435
|
-
|
|
1429
|
+
ret.delete
|
|
1436
1430
|
return
|
|
1437
1431
|
end
|
|
1438
|
-
|
|
1439
|
-
elsif (
|
|
1440
|
-
|
|
1432
|
+
ret
|
|
1433
|
+
elsif (ret = rootpath(ret.basename, ascend: dependroot)).exist?
|
|
1434
|
+
ret
|
|
1441
1435
|
end
|
|
1442
|
-
rescue
|
|
1436
|
+
rescue => e
|
|
1443
1437
|
log.debug e
|
|
1444
|
-
|
|
1438
|
+
ret
|
|
1445
1439
|
end
|
|
1446
1440
|
|
|
1447
1441
|
def nolockfile?(prefix = dependbin)
|