# https://classic.yarnpkg.com/ package manager for nodejs

[buildout]
extends =
  ../nodejs/buildout.cfg

[yarn]
<= yarn-1.22.10

[yarn-1.22.10]
<= yarn-wrapper
yarn-download = ${yarn-download-1.22.10:location}

[yarn-1.17.3]
<= yarn-wrapper
yarn-download = ${yarn-download-1.17.3:location}

[yarn-1.16.0]
<= yarn-wrapper
yarn-download = ${yarn-download-1.16.0:location}

[yarn-1.3.2]
<= yarn-wrapper
yarn-download = ${yarn-download-1.3.2:location}

[yarn-wrapper]
recipe = slapos.recipe.build
shared = true
content =
  #!/bin/sh
  PATH=${nodejs:location}/bin/:$PATH
  exec ${:yarn-download}/bin/yarn $@
install =
  import os
  bin = os.path.join(options['location'], 'bin')
  os.makedirs(bin)
  with open(os.path.join(bin, 'yarn'), 'w') as f:
    os.fchmod(f.fileno(), 0o755)
    f.write(options['content'])

[yarn-download]
recipe = slapos.recipe.build:download-unpacked
shared = true
url = https://github.com/yarnpkg/yarn/releases/download/v${:version}/yarn-v${:version}.tar.gz

[yarn-download-1.22.10]
<= yarn-download
version = 1.22.10
md5sum = 52e8dbe9d0cb90683dd3ee2ebf2becb8

[yarn-download-1.17.3]
<= yarn-download
version = 1.17.3
md5sum = 4a02e1687a150113ad6b0215f9afdb3e

[yarn-download-1.3.2]
<= yarn-download
version = 1.3.2
md5sum = db82fa09c996e9318f2f1d2ab99228f9

[yarn-download-1.16.0]
<= yarn-download
version = 1.16.0
md5sum = 46790033c23803387890f545e4040690
