squared 0.5.7 → 0.5.9

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.
@@ -6,7 +6,7 @@ module Squared
6
6
  class Docker < Base
7
7
  COMPOSEFILE = %w[compose.yaml compose.yml docker-compose.yaml docker-compose.yml].freeze
8
8
  BAKEFILE = %w[docker-bake.json docker-bake.hcl docker-bake.override.json docker-bake.override.hcl].freeze
9
- DIR_DOCKER = (COMPOSEFILE + BAKEFILE).freeze
9
+ DIR_DOCKER = (COMPOSEFILE + BAKEFILE + ['Dockerfile']).freeze
10
10
  OPT_DOCKER = {
11
11
  common: %w[tls tlsverify config=p c|context=b D|debug H|host=q l|log-level=b tlscacert=p tlscert=p
12
12
  tlskey=p].freeze,
@@ -91,7 +91,7 @@ module Squared
91
91
  def config?(val)
92
92
  return false unless (val = as_path(val))
93
93
 
94
- val.join('Dockerfile').exist? || DIR_DOCKER.any? { |file| val.join(file).exist? }
94
+ DIR_DOCKER.any? { |file| val.join(file).exist? }
95
95
  end
96
96
  end
97
97
 
@@ -251,9 +251,11 @@ module Squared
251
251
  end
252
252
 
253
253
  def clean(*, sync: invoked_sync?('clean'), **)
254
- return super unless @clean.nil?
255
-
256
- image(:rm, sync: sync)
254
+ if runnable?(@clean)
255
+ super
256
+ else
257
+ image(:rm, sync: sync)
258
+ end
257
259
  end
258
260
 
259
261
  def compose(opts, flags = nil, script: false, args: nil, from: :run, **)
@@ -310,7 +312,7 @@ module Squared
310
312
  append_context
311
313
  when :bake, :compose
312
314
  option(from == :bake ? 'target' : 'service', ignore: false) do |a|
313
- ret.merge(split_escape(a).map! { |b| shell_escape(b) })
315
+ ret.merge(split_escape(a).map! { |b| shell_quote(b) })
314
316
  end
315
317
  end
316
318
  ret
@@ -412,7 +414,7 @@ module Squared
412
414
  args << k
413
415
  next
414
416
  when 'source', 'src', 'destination', 'dst', 'target', 'volume-subpath', 'image-path'
415
- v = path + v
417
+ v = basepath v
416
418
  v = shell_quote(v, option: false, force: false) if q == ''
417
419
  end
418
420
  args << "#{k}=#{q + v + q}"
@@ -586,16 +588,15 @@ module Squared
586
588
  end
587
589
 
588
590
  def dockerfile(val = nil)
589
- if val == 'Dockerfile'
590
- @file = false
591
- elsif val
591
+ if val
592
592
  @file = if val.is_a?(Array)
593
593
  val = val.select { |file| basepath(file).exist? }
594
594
  val.size > 1 ? val : val.first
595
- else
596
- val || DIR_DOCKER.find { |file| basepath(file).exist? }
595
+ elsif val == true
596
+ DIR_DOCKER.find { |file| basepath(file).exist? }
597
+ elsif val != 'Dockerfile'
598
+ val
597
599
  end
598
- @file ||= false
599
600
  end
600
601
  basepath((@file.is_a?(Array) ? @file.first : @file) || 'Dockerfile')
601
602
  end
@@ -604,9 +605,9 @@ module Squared
604
605
 
605
606
  def read_composefile(*keys, target: nil)
606
607
  require 'yaml'
607
- target = ENV['COMPOSE_FILE']&.split(workspace.windows? ? ';' : ':') if !target || target.empty?
608
+ target = ENV['COMPOSE_FILE']&.split(workspace.windows? ? ';' : ':') unless target && !target.empty?
608
609
  Array(target || dockerfile).each do |val|
609
- doc = YAML.load_file(path + val)
610
+ doc = YAML.load_file(basepath(val))
610
611
  if keys.empty?
611
612
  yield doc
612
613
  elsif (data = doc.dig(*keys))
@@ -648,17 +649,17 @@ module Squared
648
649
  end
649
650
 
650
651
  def append_file(type, target: @session)
651
- return if ENV['COMPOSE_FILE'] && compose?(type)
652
+ return if !@file || (ENV['COMPOSE_FILE'] && compose?(type))
652
653
 
653
654
  unless @file.is_a?(Array)
654
655
  case type
655
656
  when 2, 4
656
657
  return
657
658
  when 3
658
- return unless COMPOSEFILE.map { |val| path + val }.select(&:exist?).size > 1
659
+ return unless COMPOSEFILE.map { |val| basepath(val) }.select(&:exist?).size > 1
659
660
  end
660
661
  end
661
- files = Array(@file).map { |val| quote_option('file', path + val) }
662
+ files = Array(@file).map { |val| quote_option('file', basepath(val)) }
662
663
  if target.is_a?(Set)
663
664
  opts = target.to_a.insert(2, *files)
664
665
  target.clear.merge(opts)
@@ -839,7 +840,7 @@ module Squared
839
840
  end
840
841
 
841
842
  def contextdir(val = nil)
842
- val && projectpath?(val) ? shell_quote(path + val) : '.'
843
+ val && projectpath?(val) ? shell_quote(basepath(val)) : '.'
843
844
  end
844
845
 
845
846
  def tagjoin(*args, char: '/')
@@ -104,11 +104,11 @@ module Squared
104
104
  end
105
105
 
106
106
  def rev_timeutc(*keys)
107
- rev_entry(*keys, val: rev_timenow)
107
+ rev_entry(*keys, val: time_epoch)
108
108
  end
109
109
 
110
110
  def rev_timesince(*keys, clock: false)
111
- epoch = rev_timenow - rev_entry(*keys).to_i
111
+ epoch = time_epoch - rev_entry(*keys).to_i
112
112
  rescue StandardError
113
113
  nil
114
114
  else
@@ -162,7 +162,7 @@ module Squared
162
162
  add: %w[A|all e|edit f|force ignore-errors ignore-missing ignore-removal i|interactive no-all
163
163
  no-ignore-removal n|dry-run p|patch pathspec-file-nul renormalize sparse u|update v|verbose
164
164
  chmod=b pathspec-from-file=p].freeze,
165
- branch: %w[a|all create-reflog i|ignore-case omit-empty q|quiet r|remotes v|verbose vv abbrev=i color=b
165
+ branch: %w[a|all create-reflog i|ignore-case omit-empty q|quiet r|remotes v|verbose abbrev=i color=b
166
166
  column=b contains=b format=q merged=b no-contains=b no-merged=b points-at=b u|set-upstream-to=b
167
167
  sort=q t|track=b].freeze,
168
168
  checkout: %w[l d|detach f|force ignore-other-worktrees ignore-skip-worktree-bits m|merge p|patch
@@ -1236,10 +1236,10 @@ module Squared
1236
1236
  return
1237
1237
  end
1238
1238
  end
1239
- start = epochtime
1239
+ start = time_epoch
1240
1240
  build(@output, sync: sync, from: :'git:revbuild')
1241
1241
  rescue StandardError => e
1242
- warn log_message(Logger::WARN, e, pass: true) if warning?
1242
+ print_error(e, pass: true)
1243
1243
  else
1244
1244
  print_status(name, subject: 'revbuild', start: start, from: :completed)
1245
1245
  workspace.rev_write(name, { 'revision' => sha, 'files' => status_digest(*args, **kwargs) },
@@ -1472,8 +1472,11 @@ module Squared
1472
1472
  pu << '--force-with-lease' if amend
1473
1473
  pu.merge(repotrack(origin, branch))
1474
1474
  puts if pass
1475
+ adding = git_spawn 'diff --name-only --no-color'
1475
1476
  source op
1476
- if amend || !git_spawn('diff --cached --name-only --no-color').empty? || dryrun?
1477
+ cached = git_spawn 'diff --cached --name-only --no-color'
1478
+ if amend || !cached.empty? || dryrun?
1479
+ puts cached if adding.empty? && !cached.empty? && banner?
1477
1480
  source co
1478
1481
  source pu
1479
1482
  elsif banner?
@@ -1601,9 +1604,7 @@ module Squared
1601
1604
  end
1602
1605
  on :last, from
1603
1606
  end
1604
- if ret == 0
1605
- warn log_message(Logger::WARN, name, 'no ref found', subject: 'branch', hint: 'head', pass: true)
1606
- end
1607
+ print_error(name, 'no ref found', subject: 'branch', hint: 'head', pass: true) if ret == 0
1607
1608
  return
1608
1609
  end
1609
1610
  return unless success?(source(stdout: stdout))
@@ -1746,8 +1747,8 @@ module Squared
1746
1747
  end)
1747
1748
  case flag
1748
1749
  when :blame
1749
- raise_error 'no file found' unless (n = op.index { |s| (path + s).file? })
1750
- op << '--' << shell_quote(path + op.delete_at(n))
1750
+ raise_error 'no file found' unless (n = op.index { |s| basepath(s).file? })
1751
+ op << '--' << shell_quote(basepath(op.delete_at(n)))
1751
1752
  op.clear
1752
1753
  when :revert
1753
1754
  if VAL_GIT[:rebase][:send].any? { |val| op.arg?(val) }
@@ -1757,7 +1758,7 @@ module Squared
1757
1758
  else
1758
1759
  append_commit(*op.extras)
1759
1760
  end
1760
- when :add, :clean
1761
+ when :add
1761
1762
  if flag == :add && !op.arg?('pathspec-from-file')
1762
1763
  grep, list = op.partition { |val| OptionPartition.pattern?(val) }
1763
1764
  unless grep.empty? && !list.empty?
@@ -1784,8 +1785,8 @@ module Squared
1784
1785
  refs = projectmap op.extras
1785
1786
  raise_error 'no source/destination' unless refs.size > 1
1786
1787
  op.merge(refs)
1787
- when :rm
1788
- append_pathspec(op.extras, expect: true)
1788
+ when :rm, :clean
1789
+ append_pathspec(op.extras, expect: flag == :rm)
1789
1790
  end
1790
1791
  source(sync: false, stderr: true)
1791
1792
  end
@@ -1950,7 +1951,7 @@ module Squared
1950
1951
  next if !glob.empty? && glob.none? { |val| File.fnmatch?(val, file, File::FNM_DOTMATCH) }
1951
1952
  next if !pass.empty? && pass.any? { |val| File.fnmatch?(val, file, File::FNM_DOTMATCH) }
1952
1953
 
1953
- ret[file] = algorithm.hexdigest(File.read(path + file))
1954
+ ret[file] = algorithm.hexdigest(File.read(basepath(file)))
1954
1955
  end
1955
1956
  ret
1956
1957
  end
@@ -1982,7 +1983,7 @@ module Squared
1982
1983
  when 'recurse-submodules'
1983
1984
  op.append?($1, $2, type: :basic)
1984
1985
  when 'refspec'
1985
- refspec << shell_escape($2, quote: true)
1986
+ refspec << shell_quote($2)
1986
1987
  end
1987
1988
  elsif op.arg?('multiple')
1988
1989
  op.found << opt
@@ -2000,12 +2001,12 @@ module Squared
2000
2001
  end
2001
2002
  op.delete('--all')
2002
2003
  elsif op.arg?('multiple')
2003
- op.swap.merge(op.map! { |opt| shell_escape(opt, quote: true) })
2004
+ op.add_quote(*op.found)
2004
2005
  return
2005
2006
  elsif option('all')
2006
2007
  op << '--all'
2007
2008
  end
2008
- op.clear(errors: true, subject: flag.to_s) if flag
2009
+ op.clear(errors: true, subject: flag) if flag
2009
2010
  end
2010
2011
 
2011
2012
  def append_commit(*val, target: @session, head: false)
@@ -2141,7 +2142,7 @@ module Squared
2141
2142
  end
2142
2143
 
2143
2144
  def matchpathspec
2144
- [/\A[^a-z\d-]+/i, %r{\A[^=\\/*]*[\\/*]}]
2145
+ [/\A[^a-z\d-]+/i, %r{\A[^=\\/*]*[\\/*]}, /\A--\z/]
2145
2146
  end
2146
2147
 
2147
2148
  def messageopt
@@ -5,34 +5,34 @@ module Squared
5
5
  module Project
6
6
  class Node < Git
7
7
  OPT_NPM = {
8
- common: %w[dry-run=!? include-workspace-root=!? workspaces=!? w|workspace=v].freeze,
9
- install: %w[prefer-dedupe=!? package-lock-only=!? audit=! bin-links=! cpu=b fund=! libc=b os=b
10
- package-lock=!].freeze,
11
- install_base: %w[ignore-scripts=!? install-links=!? strict-peer-deps=!? include=b omit=b
12
- install-strategy=b].freeze,
8
+ common: %w[dry-run=!? include-workspace-root=!? loglevel=b workspaces=!? w|workspace=v].freeze,
9
+ install: %w[package-lock-only=!? prefer-dedupe=!? cpu=b libc=b os=b].freeze,
10
+ install_base: %w[audit=! bin-links=! fund=! ignore-scripts=!? install-links=!? package-lock=!
11
+ strict-peer-deps=!? include=b install-strategy=b omit=b].freeze,
13
12
  install_no: %w[audit bin-links fund package-lock].freeze,
14
- install_as: %w[no-save save-bundle save-dev save-optional save-peer save-prod foreground-scripts=!?
13
+ install_as: %w[no-save save-bundle save-dev save-optional save-peer save-prod before=q foreground-scripts=!?
15
14
  g|global=!? S|save=!? E|save-exact=!?].freeze,
16
15
  run: %w[foreground-scripts=!? if-present=!? ignore-scripts=!? script-shell=p].freeze,
17
16
  exec: %w[c|call=q package=b].freeze,
18
- pack: %w[json=!? pack-destination=p].freeze
17
+ pack: %w[ignore-scripts=!? json=!? pack-destination=p].freeze
19
18
  }.freeze
20
19
  OPT_PNPM = {
21
20
  common: %w[aggregate-output color no-color stream use-stderr C|dir=p loglevel=b w|workspace-root].freeze,
21
+ cpu: %w[cpu=b libc=b os=b].freeze,
22
22
  filter: %w[fail-if-no-match changed-files-ignore-pattern=q filter=q filter-prod=q test-pattern=q].freeze,
23
23
  install: %w[fix-lockfile force ignore-pnpmfile ignore-workspace lockfile-only merge-git-branch-lockfiles
24
- no-hoist no-lockfile no-optional prefer-frozen-lockfile resolution-only shamefully-hoist
25
- side-effects-cache side-effects-cache-readonly s|silent strict-peer-dependencies
24
+ optimistic-repeat-install no-hoist no-lockfile no-optional prefer-frozen-lockfile resolution-only
25
+ shamefully-hoist side-effects-cache side-effects-cache-readonly s|silent strict-peer-dependencies
26
26
  use-running-store-server use-store-server child-concurrency=i hoist-pattern=q lockfile-dir=p
27
27
  modules-dir=p network-concurrency=i package-import-method=b public-hoist-pattern=q
28
28
  reporter=b].freeze,
29
29
  install_base: %w[global-dir ignore-scripts offline prefer-offline store-dir=p virtual-store-dir=p].freeze,
30
30
  install_no: %w[frozen-lockfile verify-store-integrity].freeze,
31
31
  install_as: %w[D|dev global-dir no-optional P|prod r|recursive].freeze,
32
- update: %w[global interactive latest depth=i].freeze,
32
+ update: %w[g|global i|interactive L|latest depth=i].freeze,
33
33
  dedupe: %w[check].freeze,
34
- run: %w[if-present no-bail parallel r|recursive report-summary reporter-hide-prefix resume-from sequential
35
- stream use-stderr].freeze,
34
+ run: %w[if-present no-bail parallel r|recursive report-summary reporter-hide-prefix resume-from
35
+ sequential].freeze,
36
36
  exec: %w[no-reporter-hide-prefix parallel r|recursive report-summary resume-from c|shell-mode].freeze,
37
37
  pack: %w[json pack-destination=p pack-gzip-level=i].freeze
38
38
  }.freeze
@@ -109,7 +109,7 @@ module Squared
109
109
  initialize_build(Node.ref, prod: prod?, **kwargs)
110
110
  initialize_env(**kwargs)
111
111
  end
112
- @dependfile = @path + 'package.json'
112
+ @dependfile = basepath 'package.json'
113
113
  @pm = { __: init }
114
114
  end
115
115
 
@@ -232,7 +232,7 @@ module Squared
232
232
  flags.each do |flag|
233
233
  case action
234
234
  when 'outdated'
235
- format_desc(action, flag, %w[prune interactive dry-run].freeze, arg: 'opts?')
235
+ format_desc(action, flag, %w[update interactive dry-run], arg: 'opts?')
236
236
  task flag do |_, args|
237
237
  outdated flag, args.to_a
238
238
  end
@@ -268,11 +268,6 @@ module Squared
268
268
  otp = args.first
269
269
  else
270
270
  tag, otp = param_guard(action, flag, args: args)
271
- unless SEM_VER.match?(tag)
272
- a = sub_style(project, styles: theme[:active])
273
- b = sub_style(tag, styles: theme[:inline])
274
- exit 1 unless confirm("Publish #{a}@#{b}?", 'N')
275
- end
276
271
  end
277
272
  publish(flag, otp: otp, tag: tag, dryrun: dryrun, access: access)
278
273
  end
@@ -379,12 +374,10 @@ module Squared
379
374
  target.mkpath
380
375
  subdir << target.to_s
381
376
  end
382
- begin
383
- FileUtils.cp(path + s, dest, verbose: verbose.is_a?(Numeric) && verbose > 0)
384
- rescue StandardError => e
385
- print_error e
386
- errors += 1
387
- end
377
+ FileUtils.cp(basepath(s), dest, verbose: verbose.is_a?(Numeric) && verbose > 0)
378
+ rescue StandardError => e
379
+ print_error e
380
+ errors += 1
388
381
  end
389
382
  rescue StandardError => e
390
383
  on_error e, :copy
@@ -395,7 +388,7 @@ module Squared
395
388
  end
396
389
  glob = Array(glob || '**/*')
397
390
  target = []
398
- from = path + from
391
+ from = basepath from
399
392
  if workspace
400
393
  from.glob('*').each do |entry|
401
394
  next unless entry.directory?
@@ -423,11 +416,9 @@ module Squared
423
416
  end
424
417
  target.each do |src, to|
425
418
  glob.each { |val| log.info "cp #{from + val} #{to}" }
426
- begin
427
- copy_dir(src, to, glob, create: create, link: link, force: force, pass: pass, verbose: verbose)
428
- rescue StandardError => e
429
- on_error e, :copy
430
- end
419
+ copy_dir(src, to, glob, create: create, link: link, force: force, pass: pass, verbose: verbose)
420
+ rescue StandardError => e
421
+ on_error e, :copy
431
422
  end
432
423
  end
433
424
  on :last, :copy
@@ -469,6 +460,7 @@ module Squared
469
460
  cmd << '--save-exact' if exact
470
461
  else
471
462
  cmd << 'install'
463
+ append_platform
472
464
  end
473
465
  option('public-hoist-pattern', ignore: false) do |val|
474
466
  split_escape(val).each { |opt| cmd << shell_option('public-hoist-pattern', opt) }
@@ -480,7 +472,9 @@ module Squared
480
472
  if flag == :add
481
473
  cmd << "--save-#{save}"
482
474
  cmd << '--save-exact' if exact
483
- cmd.merge(packages.map { |pkg| shell_escape(pkg) })
475
+ cmd.merge(packages.map { |pkg| shell_quote(pkg) })
476
+ else
477
+ append_platform
484
478
  end
485
479
  cmd << '--workspaces=false' if env('NODE_WORKSPACES', equals: '0')
486
480
  cmd << '--package-lock=false' if option('package-lock', equals: '0')
@@ -630,10 +624,13 @@ module Squared
630
624
  footer.call(modified, found.size)
631
625
  elsif modified > 0
632
626
  modified = -1
633
- footer.call(0, found.size)
634
627
  File.write(dependfile, doc)
628
+ if opts.include?('update') || opts.include?('u') || option('update')
629
+ update
630
+ else
631
+ footer.call(0, found.size)
632
+ end
635
633
  commit(:add, refs: ['package.json'], pass: true)
636
- install if opts.include?('prune') || opts.include?('p')
637
634
  end
638
635
  elsif !avail.empty?
639
636
  col1 = size_col.call(avail, 0) + 4
@@ -659,18 +656,23 @@ module Squared
659
656
  end
660
657
 
661
658
  def update(*)
662
- package('update', from: :update)
659
+ package(:update, from: :update)
663
660
  end
664
661
 
665
662
  def publish(flag = nil, *, sync: invoked_sync?('publish', flag), otp: nil, tag: nil, access: nil, dryrun: nil)
666
- if !version || read_packagemanager(:private)
667
- warn log_message(Logger::WARN, 'invalid task "publish"', subject: name, hint: version ? 'private' : nil)
663
+ unless version && !read_packagemanager(:private)
664
+ print_error('invalid task "publish"', subject: name, hint: version ? 'private' : nil)
668
665
  return
669
666
  end
670
667
  cmd = session 'npm', 'publish'
671
668
  cmd << basic_option('otp', otp) if otp ||= option('otp')
672
- cmd << basic_option('tag', tag) if tag ||= option('tag')
673
- cmd << basic_option('access', access) if access ||= option('access')
669
+ cmd << basic_option('tag', tag.tr(' ', '-')) if tag ||= option('tag')
670
+ case access || option('access')
671
+ when 'p', 'public'
672
+ cmd << '--access=public'
673
+ when 'r', 'restricted'
674
+ cmd << '--access=restricted'
675
+ end
674
676
  dryrun ||= dryrun?('npm')
675
677
  if dryrun
676
678
  cmd << '--dry-run'
@@ -698,15 +700,16 @@ module Squared
698
700
  workspace.rev_clear(name)
699
701
  if (yarn = dependtype(:yarn)) > 0
700
702
  cmd = session 'yarn', if flag == :update
701
- flag = yarn == 1 ? 'upgrade' : 'up'
703
+ yarn == 1 ? 'upgrade' : 'up'
702
704
  else
703
- flag
705
+ yarn == 1 && flag == :dedupe ? 'install' : flag
704
706
  end
705
707
  op = OptionPartition.new(opts, if yarn == 1
706
- OPT_YARN.fetch(flag, []) + OPT_YARN[:common]
708
+ OPT_YARN.fetch(flag == :dedupe ? :install : flag, []) + OPT_YARN[:common]
707
709
  else
708
710
  OPT_BERRY[flag]
709
711
  end, cmd, project: self)
712
+ op << '--ignore-engines' if yarn == 1 && !option('ignore-engines', equals: '0')
710
713
  op.clear
711
714
  append_loglevel
712
715
  else
@@ -714,20 +717,20 @@ module Squared
714
717
  cmd = session 'pnpm', flag
715
718
  list = OPT_PNPM[:install_base] + OPT_PNPM.fetch(flag, []) + OPT_PNPM[:common]
716
719
  list.concat(OPT_PNPM[:install_as] + OPT_PNPM[:filter]) unless flag == :dedupe
720
+ list.concat(OPT_PNPM[:cpu]) unless flag == :update
717
721
  no = OPT_PNPM[:"#{flag}_no"]
718
722
  else
719
723
  cmd = session 'npm', flag
720
724
  list = OPT_NPM[:install_base] + OPT_NPM.fetch(flag, []) + OPT_NPM[:common]
721
725
  list.concat(OPT_NPM[:install_as]) unless flag == :dedupe
722
726
  no = OPT_NPM[:install_no]
723
- cmd << '--save=true' if option('save')
724
727
  end
725
728
  op = OptionPartition.new(opts, list, cmd, no: no, project: self)
726
729
  op.each do |opt|
727
730
  if opt =~ op.values
728
731
  case $1
729
732
  when 'w', 'workspace'
730
- op << ($2.match?(%r{[\\/]}) ? quote_option($1, path + $2) : shell_option($1, $2))
733
+ op << ($2.match?(%r{[\\/]}) ? quote_option($1, basepath($2)) : shell_option($1, $2))
731
734
  end
732
735
  elsif opt.include?('=')
733
736
  op.errors << opt
@@ -736,12 +739,13 @@ module Squared
736
739
  end
737
740
  end
738
741
  op.swap
742
+ append_platform if flag == :install
739
743
  append_nocolor
740
744
  append_loglevel
741
745
  if flag == :dedupe
742
746
  op.clear
743
747
  else
744
- op.append(escape: true)
748
+ op.append(quote: true)
745
749
  end
746
750
  op.clear(errors: true)
747
751
  end
@@ -819,7 +823,7 @@ module Squared
819
823
 
820
824
  case $1
821
825
  when 'w', 'workspace'
822
- op << ($2.match?(%r{[\\/]}) ? quote_option($1, path + $2) : shell_option($1, $2))
826
+ op << ($2.match?(%r{[\\/]}) ? quote_option($1, basepath($2)) : shell_option($1, $2))
823
827
  op.found << opt
824
828
  end
825
829
  end
@@ -937,6 +941,14 @@ module Squared
937
941
  respond_to?(meth) && __send__(meth) ? @pm[prog] : 0
938
942
  end
939
943
 
944
+ def dependbin
945
+ if yarn?
946
+ 'yarn'
947
+ else
948
+ pnpm? ? 'pnpm' : 'npm'
949
+ end
950
+ end
951
+
940
952
  def version
941
953
  @version ||= read_packagemanager(:version)
942
954
  end
@@ -1012,12 +1024,8 @@ module Squared
1012
1024
  end
1013
1025
  end
1014
1026
 
1015
- def dependbin
1016
- if yarn?
1017
- 'yarn'
1018
- else
1019
- pnpm? ? 'pnpm' : 'npm'
1020
- end
1027
+ def append_platform(target: @session)
1028
+ %w[cpu os libc].each { |name| option(name) { |val| target << basic_option(name, val) } }
1021
1029
  end
1022
1030
 
1023
1031
  def dependext