squared 0.7.8 → 0.8.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 +47 -19
- data/README.md +38 -35
- data/lib/squared/common/base.rb +0 -1
- data/lib/squared/common/format.rb +5 -14
- data/lib/squared/common/prompt.rb +25 -24
- data/lib/squared/common/shell.rb +11 -11
- data/lib/squared/common/system.rb +9 -19
- data/lib/squared/common/utils.rb +17 -13
- data/lib/squared/config.rb +3 -11
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +98 -24
- data/lib/squared/workspace/project/base.rb +73 -60
- data/lib/squared/workspace/project/docker.rb +38 -28
- data/lib/squared/workspace/project/git.rb +141 -52
- data/lib/squared/workspace/project/node.rb +161 -106
- data/lib/squared/workspace/project/python.rb +26 -28
- data/lib/squared/workspace/project/ruby.rb +38 -25
- data/lib/squared/workspace/project/support/class.rb +2 -2
- data/lib/squared/workspace/project/support/optionpartition.rb +7 -10
- data/lib/squared/workspace/project/support/utils.rb +10 -1
- data/lib/squared/workspace/repo.rb +5 -5
- data/lib/squared/workspace/series.rb +10 -2
- metadata +2 -2
|
@@ -159,13 +159,13 @@ module Squared
|
|
|
159
159
|
subtasks({
|
|
160
160
|
'package' => %i[install add update dedupe approve deny rebuild reinstall].freeze,
|
|
161
161
|
'outdated' => %i[major minor patch].freeze,
|
|
162
|
-
'
|
|
163
|
-
'publish' => %i[latest tag verify].freeze,
|
|
162
|
+
'publish' => %i[latest tag stage verify].freeze,
|
|
164
163
|
'tsc' => %i[project build].freeze,
|
|
165
164
|
'add' => nil,
|
|
166
165
|
'run' => nil,
|
|
167
166
|
'exec' => nil,
|
|
168
167
|
'nvm' => nil,
|
|
168
|
+
'bump' => nil,
|
|
169
169
|
'pack' => nil
|
|
170
170
|
})
|
|
171
171
|
|
|
@@ -297,6 +297,18 @@ module Squared
|
|
|
297
297
|
args.unshift(path.call('nvm-exec'))
|
|
298
298
|
run(args.join(' '), { 'NODE_VERSION' => version }, banner: false, from: :nvm)
|
|
299
299
|
end
|
|
300
|
+
when 'bump'
|
|
301
|
+
format_desc action, nil, 'version|pre?{major,minor,patch}|prerelease'
|
|
302
|
+
task action, [:version] do |_, args|
|
|
303
|
+
version = param_guard(action, 'to', args: args, key: :version)
|
|
304
|
+
if version.match?(/^((pre)?(major|minor|patch))|prerelease$/)
|
|
305
|
+
flag = version.to_sym
|
|
306
|
+
version = nil
|
|
307
|
+
else
|
|
308
|
+
flag = :version
|
|
309
|
+
end
|
|
310
|
+
bump flag, version
|
|
311
|
+
end
|
|
300
312
|
when 'pack'
|
|
301
313
|
format_desc action, nil, 'opts*'
|
|
302
314
|
task action do |_, args|
|
|
@@ -321,21 +333,6 @@ module Squared
|
|
|
321
333
|
task flag do |_, args|
|
|
322
334
|
package flag, args.to_a
|
|
323
335
|
end
|
|
324
|
-
when 'bump'
|
|
325
|
-
break unless version
|
|
326
|
-
|
|
327
|
-
if flag == :version
|
|
328
|
-
format_desc action, flag, 'version'
|
|
329
|
-
task flag, [:version] do |_, args|
|
|
330
|
-
version = param_guard(action, flag, args: args, key: :version)
|
|
331
|
-
bump flag, version
|
|
332
|
-
end
|
|
333
|
-
else
|
|
334
|
-
format_desc action, flag
|
|
335
|
-
task flag do
|
|
336
|
-
bump flag
|
|
337
|
-
end
|
|
338
|
-
end
|
|
339
336
|
when 'publish'
|
|
340
337
|
if flag == :verify
|
|
341
338
|
format_desc action, flag, 'version?,ext*'
|
|
@@ -348,22 +345,70 @@ module Squared
|
|
|
348
345
|
publish(flag, version: version, ext: ext)
|
|
349
346
|
end
|
|
350
347
|
else
|
|
351
|
-
format_desc(action, flag,
|
|
352
|
-
|
|
348
|
+
format_desc(action, flag,
|
|
349
|
+
"otp?,#{'registry?,' if flag == :stage}p/ublic|r/estricted?,d/ry-run?",
|
|
350
|
+
before: case flag
|
|
351
|
+
when :tag then 'tag'
|
|
352
|
+
when :stage then '{select=view,approve,reject,download}|publish=tag?'
|
|
353
|
+
end)
|
|
353
354
|
task flag do |_, args|
|
|
354
355
|
args = args.to_a
|
|
355
|
-
access =
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
356
|
+
access = nil
|
|
357
|
+
dryrun = nil
|
|
358
|
+
stage = []
|
|
359
|
+
parse = lambda do
|
|
360
|
+
access = if has_value!(args, 'r', 'restricted')
|
|
361
|
+
'restricted'
|
|
362
|
+
elsif has_value!(args, 'p', 'public')
|
|
363
|
+
'public'
|
|
364
|
+
end
|
|
365
|
+
dryrun = has_value!(args, 'd', 'dry-run')
|
|
366
|
+
end
|
|
367
|
+
case flag
|
|
368
|
+
when :stage
|
|
369
|
+
case args.first
|
|
370
|
+
when 'view', 'approve', 'reject', 'download'
|
|
371
|
+
out = pwd_set { `#{npm_output("stage list #{npmname} --json --loglevel=error")}` }
|
|
372
|
+
pad0 = 0
|
|
373
|
+
pad1 = 0
|
|
374
|
+
data = Array(parse_json(out, kind: Array)).map do |item|
|
|
375
|
+
ver = item['version']
|
|
376
|
+
tag = item['tag']
|
|
377
|
+
pad0 = [pad0, ver.size].max
|
|
378
|
+
pad1 = [pad1, tag.size].max
|
|
379
|
+
[ver, tag, item['id'], item['actor']]
|
|
380
|
+
end
|
|
381
|
+
if data.empty?
|
|
382
|
+
print_error('no staged releases', loglevel: Logger::INFO, subject: npmname)
|
|
383
|
+
exit 1
|
|
384
|
+
end
|
|
385
|
+
data.each do |item|
|
|
386
|
+
item[0] = item[0].rjust(pad0)
|
|
387
|
+
item[1] = item[1].rjust(pad1)
|
|
388
|
+
end
|
|
389
|
+
stage << args.shift
|
|
390
|
+
stage << choice_index('Select a release', data.map { |item| item.join(' ') },
|
|
391
|
+
column: /^(?:\S+\s+){2}(\S+)/)
|
|
392
|
+
if %w[approve reject].include?(stage.first)
|
|
393
|
+
otp = args.shift if args.first&.match?(/^\d+$/)
|
|
394
|
+
registry = args.first
|
|
395
|
+
option('otp', prefix: 'npm') { |val| otp = val }
|
|
396
|
+
option('registry', prefix: 'npm') { |val| registry = val }
|
|
397
|
+
end
|
|
398
|
+
else
|
|
399
|
+
stage << 'publish'
|
|
400
|
+
parse.call
|
|
401
|
+
tag, otp = args
|
|
402
|
+
end
|
|
403
|
+
when :latest
|
|
404
|
+
parse.call
|
|
362
405
|
otp = args.first
|
|
363
406
|
else
|
|
407
|
+
parse.call
|
|
364
408
|
tag, otp = param_guard(action, flag, args: args)
|
|
365
409
|
end
|
|
366
|
-
publish(flag, otp: otp, tag: tag, access: access,
|
|
410
|
+
publish(flag, otp: otp, tag: tag, access: access, stage: stage, registry: registry,
|
|
411
|
+
dryrun: dryrun)
|
|
367
412
|
end
|
|
368
413
|
end
|
|
369
414
|
when 'tsc'
|
|
@@ -420,7 +465,7 @@ module Squared
|
|
|
420
465
|
return if items.empty?
|
|
421
466
|
|
|
422
467
|
on :first, :copy
|
|
423
|
-
print_item unless @output[0] || silent? || task_invoked?(/^copy(
|
|
468
|
+
print_item unless @output[0] || silent? || task_invoked?(/^copy(:#{Node.ref}|$)/)
|
|
424
469
|
packed = false
|
|
425
470
|
items.each do |dir|
|
|
426
471
|
case dir
|
|
@@ -435,7 +480,7 @@ module Squared
|
|
|
435
480
|
@workspace.rev_clear(proj.name, sync: sync)
|
|
436
481
|
proj.path
|
|
437
482
|
else
|
|
438
|
-
log.warn message(
|
|
483
|
+
log.warn message('target not found', dir, hint: 'copy')
|
|
439
484
|
nil
|
|
440
485
|
end
|
|
441
486
|
when Hash
|
|
@@ -455,7 +500,7 @@ module Squared
|
|
|
455
500
|
dest = dir.path
|
|
456
501
|
@workspace.rev_clear(dir.name, sync: sync)
|
|
457
502
|
else
|
|
458
|
-
|
|
503
|
+
raise TypeError, message('unknown', dir, hint: 'copy')
|
|
459
504
|
end
|
|
460
505
|
next unless from && dest&.directory?
|
|
461
506
|
|
|
@@ -517,7 +562,7 @@ module Squared
|
|
|
517
562
|
if sub
|
|
518
563
|
target << [entry, dest.join(into, sub)]
|
|
519
564
|
else
|
|
520
|
-
log.debug message("#{dependname} in \"#{entry}\"", hint: '
|
|
565
|
+
log.debug message("missing #{dependname} in \"#{entry}\"", hint: 'copy')
|
|
521
566
|
end
|
|
522
567
|
end
|
|
523
568
|
else
|
|
@@ -566,7 +611,7 @@ module Squared
|
|
|
566
611
|
rm = lambda do |target|
|
|
567
612
|
return if remove.empty?
|
|
568
613
|
|
|
569
|
-
run(target.temp(*remove).sub!(/ (
|
|
614
|
+
run(target.temp(*remove).sub!(/ (add|install) /, ' remove '), sync: sync, from: :remove)
|
|
570
615
|
end
|
|
571
616
|
yarn = dependtype(:yarn)
|
|
572
617
|
if yarn > 0
|
|
@@ -583,7 +628,7 @@ module Squared
|
|
|
583
628
|
cmd << '--mode=skip-build' if option('ignore-scripts')
|
|
584
629
|
cmd << '--check-cache' if !flag && option('force')
|
|
585
630
|
end
|
|
586
|
-
if nolockfile?('yarn')
|
|
631
|
+
if nolockfile?(prefix: 'yarn')
|
|
587
632
|
cmd << '--no-lockfile'
|
|
588
633
|
elsif option('ci')
|
|
589
634
|
if yarn == 1
|
|
@@ -619,7 +664,7 @@ module Squared
|
|
|
619
664
|
cmd << '--ignore-workspace' if ws
|
|
620
665
|
cmd << if option('force')
|
|
621
666
|
'--force'
|
|
622
|
-
elsif nolockfile?('pnpm')
|
|
667
|
+
elsif nolockfile?(prefix: 'pnpm')
|
|
623
668
|
'--no-lockfile'
|
|
624
669
|
elsif option('ci')
|
|
625
670
|
'--frozen-lockfile'
|
|
@@ -661,7 +706,7 @@ module Squared
|
|
|
661
706
|
append_platform
|
|
662
707
|
end
|
|
663
708
|
end
|
|
664
|
-
cmd << '--package-lock=false' << 'save=false' if nolockfile?('npm')
|
|
709
|
+
cmd << '--package-lock=false' << 'save=false' if nolockfile?(prefix: 'npm')
|
|
665
710
|
cmd << '--ignore-scripts' if option('ignore-scripts')
|
|
666
711
|
end
|
|
667
712
|
if add
|
|
@@ -741,7 +786,7 @@ module Squared
|
|
|
741
786
|
end
|
|
742
787
|
next unless (current != want || file != want) && (want.match?(SEM_VER) || !file.match?(SEM_VER))
|
|
743
788
|
|
|
744
|
-
f = semscan
|
|
789
|
+
f = semscan(file, fill: !option('save-exact').nil?)
|
|
745
790
|
w = semscan want
|
|
746
791
|
a = f[0]
|
|
747
792
|
b = f[2]
|
|
@@ -751,8 +796,12 @@ module Squared
|
|
|
751
796
|
when :major
|
|
752
797
|
a == '0' ? c == '0' || c == '1' : true
|
|
753
798
|
when :minor
|
|
799
|
+
next unless f[4]
|
|
800
|
+
|
|
754
801
|
ch == '^' && (a == '0' ? c == '0' && b == d : a == c)
|
|
755
802
|
when :patch
|
|
803
|
+
next unless b && f[4]
|
|
804
|
+
|
|
756
805
|
a == c && b == d && f[4] != w[4]
|
|
757
806
|
end
|
|
758
807
|
if upgrade && !w[6]
|
|
@@ -764,7 +813,7 @@ module Squared
|
|
|
764
813
|
a == '0' ? 1 : 3
|
|
765
814
|
else
|
|
766
815
|
5
|
|
767
|
-
end, major,
|
|
816
|
+
end, major, semscan(file), w]
|
|
768
817
|
elsif !major
|
|
769
818
|
avail << [key, file, latest, latest != current]
|
|
770
819
|
end
|
|
@@ -912,18 +961,14 @@ module Squared
|
|
|
912
961
|
end
|
|
913
962
|
|
|
914
963
|
def publish(flag = nil, *, sync: invoked_sync?('publish', flag), otp: nil, tag: nil, access: nil, dryrun: nil,
|
|
915
|
-
version: nil, ext: [], workspace: false)
|
|
964
|
+
version: nil, stage: [], registry: nil, ext: [], workspace: false)
|
|
916
965
|
if read_package('private')
|
|
917
|
-
return if workspace
|
|
966
|
+
return if workspace || !stage.empty?
|
|
918
967
|
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
ws.each do |proj|
|
|
924
|
-
proj.publish(flag, sync: sync, otp: otp, tag: tag, access: access, dryrun: dryrun, version: version,
|
|
925
|
-
ext: ext, workspace: true)
|
|
926
|
-
end
|
|
968
|
+
from, accept = flag == :verify ? %w[verify Y] : %w[publish N]
|
|
969
|
+
each(accept: accept, ref: Node.ref, from: from) do |proj|
|
|
970
|
+
proj.publish(flag, sync: sync, otp: otp, tag: tag, access: access, dryrun: dryrun, version: version,
|
|
971
|
+
ext: ext, workspace: true)
|
|
927
972
|
end
|
|
928
973
|
elsif version ||= self.version
|
|
929
974
|
if flag == :verify
|
|
@@ -994,24 +1039,35 @@ module Squared
|
|
|
994
1039
|
end
|
|
995
1040
|
end
|
|
996
1041
|
else
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
when 'r', 'restricted'
|
|
1004
|
-
cmd << '--access=restricted'
|
|
1042
|
+
args = ['npm']
|
|
1043
|
+
if stage.empty?
|
|
1044
|
+
args << 'publish'
|
|
1045
|
+
else
|
|
1046
|
+
args << 'stage' << stage.shift
|
|
1047
|
+
args.concat(stage)
|
|
1005
1048
|
end
|
|
1006
|
-
|
|
1049
|
+
cmd = session(*args)
|
|
1050
|
+
if stage.empty?
|
|
1051
|
+
otp ||= option('otp')
|
|
1052
|
+
cmd << basic_option('tag', tag.tr(' ', '-')) if tag ||= option('tag')
|
|
1053
|
+
case access || option('access')
|
|
1054
|
+
when 'p', 'public'
|
|
1055
|
+
cmd << '--access=public'
|
|
1056
|
+
when 'r', 'restricted'
|
|
1057
|
+
cmd << '--access=restricted'
|
|
1058
|
+
end
|
|
1059
|
+
dryrun ||= dryrun?(prefix: 'npm')
|
|
1060
|
+
end
|
|
1061
|
+
cmd << basic_option('otp', otp) if otp
|
|
1062
|
+
cmd << quote_option('registry', registry) if registry
|
|
1007
1063
|
if dryrun
|
|
1008
1064
|
cmd << '--dry-run'
|
|
1009
1065
|
else
|
|
1010
|
-
from = :'npm:publish'
|
|
1011
1066
|
log.info cmd.to_s
|
|
1067
|
+
from = symjoin args.take(3)
|
|
1012
1068
|
end
|
|
1013
1069
|
if sync
|
|
1014
|
-
run(sync: sync, from: from, interactive: !dryrun && ['Publish', 'N', npmname])
|
|
1070
|
+
run(sync: sync, from: from, interactive: !dryrun && stage.empty? && ['Publish', 'N', npmname])
|
|
1015
1071
|
else
|
|
1016
1072
|
require 'open3'
|
|
1017
1073
|
on :first, from
|
|
@@ -1026,7 +1082,7 @@ module Squared
|
|
|
1026
1082
|
end
|
|
1027
1083
|
end
|
|
1028
1084
|
elsif !workspace
|
|
1029
|
-
print_error(
|
|
1085
|
+
print_error('version not found', subject: name, hint: dependname)
|
|
1030
1086
|
end
|
|
1031
1087
|
end
|
|
1032
1088
|
|
|
@@ -1045,7 +1101,7 @@ module Squared
|
|
|
1045
1101
|
end
|
|
1046
1102
|
when :reinstall
|
|
1047
1103
|
if yarn == 1
|
|
1048
|
-
remove_modules 'yarn' if opts.include?('force')
|
|
1104
|
+
remove_modules(prefix: 'yarn') if opts.include?('force')
|
|
1049
1105
|
elsif opts.delete('force')
|
|
1050
1106
|
opts << 'check-cache'
|
|
1051
1107
|
end
|
|
@@ -1066,7 +1122,7 @@ module Squared
|
|
|
1066
1122
|
end
|
|
1067
1123
|
end, cmd, project: self, strict: strict?)
|
|
1068
1124
|
if yarn == 1 && flag != :reinstall
|
|
1069
|
-
op << '--no-lockfile' if nolockfile?('yarn')
|
|
1125
|
+
op << '--no-lockfile' if nolockfile?(prefix: 'yarn')
|
|
1070
1126
|
op << '--ignore-engines' if option('ignore-engines')
|
|
1071
1127
|
end
|
|
1072
1128
|
else
|
|
@@ -1079,7 +1135,7 @@ module Squared
|
|
|
1079
1135
|
else
|
|
1080
1136
|
case flag
|
|
1081
1137
|
when :install, :update
|
|
1082
|
-
opts << 'no-lockfile' if nolockfile?('pnpm')
|
|
1138
|
+
opts << 'no-lockfile' if nolockfile?(prefix: 'pnpm')
|
|
1083
1139
|
spec = 0 if flag == :update
|
|
1084
1140
|
when :add
|
|
1085
1141
|
spec = 1
|
|
@@ -1109,13 +1165,13 @@ module Squared
|
|
|
1109
1165
|
else
|
|
1110
1166
|
case flag
|
|
1111
1167
|
when :install, :update
|
|
1112
|
-
opts.unshift('package-lock=false', 'save=false') if nolockfile?('npm')
|
|
1168
|
+
opts.unshift('package-lock=false', 'save=false') if nolockfile?(prefix: 'npm')
|
|
1113
1169
|
spec = flag == :install ? 0 : 2
|
|
1114
1170
|
when :add
|
|
1115
1171
|
spec = 1
|
|
1116
1172
|
flag = :install
|
|
1117
1173
|
when :reinstall
|
|
1118
|
-
remove_modules 'npm' if opts.delete('force')
|
|
1174
|
+
remove_modules(prefix: 'npm') if opts.delete('force')
|
|
1119
1175
|
opts.unshift('package-lock=false') if lockfile(true)
|
|
1120
1176
|
flag = :install
|
|
1121
1177
|
end
|
|
@@ -1176,35 +1232,41 @@ module Squared
|
|
|
1176
1232
|
run(from: from || symjoin('package', flag))
|
|
1177
1233
|
end
|
|
1178
1234
|
|
|
1179
|
-
def bump(flag, val = nil)
|
|
1180
|
-
|
|
1235
|
+
def bump(flag = :patch, val = nil, workspace: false)
|
|
1236
|
+
if read_package('private')
|
|
1237
|
+
return if workspace
|
|
1181
1238
|
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1239
|
+
each(accept: 'N', ref: Node.ref, from: 'bump') { |proj| proj.bump(flag, val, workspace: true) }
|
|
1240
|
+
elsif val ||= version && sembump(version, flag)
|
|
1241
|
+
begin
|
|
1242
|
+
doc = dependfile.read
|
|
1243
|
+
unless doc.sub!(/"version"\s*:\s*"#{version}"/, "\"version\": \"#{val}\"")
|
|
1244
|
+
raise message('version not found', hint: dependfile)
|
|
1245
|
+
end
|
|
1246
|
+
|
|
1247
|
+
unless dryrun?
|
|
1248
|
+
log.info "bump version #{version} to #{val.subhint(flag)}"
|
|
1249
|
+
on :first, :bump
|
|
1250
|
+
dependfile.write(doc)
|
|
1251
|
+
end
|
|
1252
|
+
if stdin?
|
|
1253
|
+
puts val
|
|
1254
|
+
elsif !silent?
|
|
1255
|
+
major = flag == :major
|
|
1256
|
+
emphasize("version: #{val}", title: name, border: borderstyle, sub: [
|
|
1257
|
+
headerstyle,
|
|
1258
|
+
opt_style(color(major ? :green : :yellow), /\A(version:)( )(\S+)(.*)\z/, 3),
|
|
1259
|
+
opt_style(theme[major ? :major : :active], /\A(version:)(.*)\z/)
|
|
1260
|
+
])
|
|
1261
|
+
end
|
|
1262
|
+
unless dryrun?
|
|
1263
|
+
commit(:add, [dependname], pass: true)
|
|
1264
|
+
on :last, :bump
|
|
1265
|
+
end
|
|
1266
|
+
rescue => e
|
|
1267
|
+
on_error(e, dryrun: dryrun?)
|
|
1202
1268
|
end
|
|
1203
|
-
else
|
|
1204
|
-
raise_error 'version not found', hint: dependfile
|
|
1205
1269
|
end
|
|
1206
|
-
rescue => e
|
|
1207
|
-
on_error(e, dryrun: dryrun?)
|
|
1208
1270
|
end
|
|
1209
1271
|
|
|
1210
1272
|
def pack(opts = [])
|
|
@@ -1276,7 +1338,8 @@ module Squared
|
|
|
1276
1338
|
|
|
1277
1339
|
if script
|
|
1278
1340
|
ret = session dependbin, 'run'
|
|
1279
|
-
|
|
1341
|
+
raise message(dependbin, 'run', target, hint: from) unless append_any(target, build: true)
|
|
1342
|
+
|
|
1280
1343
|
append_any opts if opts
|
|
1281
1344
|
append_loglevel
|
|
1282
1345
|
append_any(args, delim: true) if args
|
|
@@ -1290,7 +1353,7 @@ module Squared
|
|
|
1290
1353
|
when Enumerable
|
|
1291
1354
|
target.to_a.join(' ')
|
|
1292
1355
|
else
|
|
1293
|
-
|
|
1356
|
+
raise TypeError, message('unknown', target, hint: 'compose')
|
|
1294
1357
|
end
|
|
1295
1358
|
end
|
|
1296
1359
|
end
|
|
@@ -1390,11 +1453,7 @@ module Squared
|
|
|
1390
1453
|
end
|
|
1391
1454
|
|
|
1392
1455
|
def dependbin
|
|
1393
|
-
|
|
1394
|
-
'yarn'
|
|
1395
|
-
else
|
|
1396
|
-
pnpm? ? 'pnpm' : 'npm'
|
|
1397
|
-
end
|
|
1456
|
+
yarn? ? 'yarn' : pnpm? ? 'pnpm' : 'npm'
|
|
1398
1457
|
end
|
|
1399
1458
|
|
|
1400
1459
|
def version
|
|
@@ -1504,7 +1563,7 @@ module Squared
|
|
|
1504
1563
|
end
|
|
1505
1564
|
end
|
|
1506
1565
|
|
|
1507
|
-
def remove_modules(prefix
|
|
1566
|
+
def remove_modules(prefix: dependbin)
|
|
1508
1567
|
modules = basepath 'node_modules'
|
|
1509
1568
|
return false unless modules.directory? && confirm_basic('Remove?', modules, prefix: prefix)
|
|
1510
1569
|
|
|
@@ -1569,7 +1628,7 @@ module Squared
|
|
|
1569
1628
|
end
|
|
1570
1629
|
|
|
1571
1630
|
def dependroot
|
|
1572
|
-
dependname if parent&.has?('outdated', Node.ref)
|
|
1631
|
+
dependname if parent&.has?('outdated', ref: Node.ref)
|
|
1573
1632
|
end
|
|
1574
1633
|
|
|
1575
1634
|
def npmname
|
|
@@ -1594,11 +1653,7 @@ module Squared
|
|
|
1594
1653
|
end
|
|
1595
1654
|
|
|
1596
1655
|
def lockfile(delete = false)
|
|
1597
|
-
ret = basepath(
|
|
1598
|
-
'yarn.lock'
|
|
1599
|
-
else
|
|
1600
|
-
pnpm? ? 'pnpm-lock.yaml' : 'package-lock.json'
|
|
1601
|
-
end)
|
|
1656
|
+
ret = basepath(yarn? ? 'yarn.lock' : pnpm? ? 'pnpm-lock.yaml' : 'package-lock.json')
|
|
1602
1657
|
if ret.exist?
|
|
1603
1658
|
if delete
|
|
1604
1659
|
ret.delete
|
|
@@ -1617,11 +1672,11 @@ module Squared
|
|
|
1617
1672
|
@serve != false
|
|
1618
1673
|
end
|
|
1619
1674
|
|
|
1620
|
-
def nolockfile?(prefix
|
|
1675
|
+
def nolockfile?(prefix: dependbin)
|
|
1621
1676
|
option('package-lock', 'lockfile', prefix: prefix, equals: '0') || !option('no-lockfile', prefix: prefix).nil?
|
|
1622
1677
|
end
|
|
1623
1678
|
|
|
1624
|
-
def dryrun?(prefix
|
|
1679
|
+
def dryrun?(prefix: dependbin)
|
|
1625
1680
|
super(target: @session, prefix: prefix)
|
|
1626
1681
|
end
|
|
1627
1682
|
end
|