bundlewrap/bundles/element-web/items.py

48 lines
1.2 KiB
Python
Raw Normal View History

from bundlewrap.metadata import metadata_to_json
repo.libs.tools.require_bundle(node, 'nodejs')
directories = {
'/opt/element-web': {}
}
git_deploy = {
'/opt/element-web': {
'rev': node.metadata['element-web']['version'],
'repo': 'https://github.com/vector-im/element-web.git',
'triggers': {
'action:element-web_yarn',
},
},
}
files = {
'/opt/element-web/webapp/config.json': {
'content': metadata_to_json(node.metadata['element-web']['config']),
'needs': {
'action:element-web_yarn',
},
},
}
extra_install_cmds = []
if node.metadata.get('nodejs/version') >= 17:
# TODO verify this is still needed when upgrading to 1.12
extra_install_cmds.append('export NODE_OPTIONS=--openssl-legacy-provider')
actions = {
'element-web_yarn': {
'command': ' && '.join([
*extra_install_cmds,
'cd /opt/element-web',
'yarn install --pure-lockfile --ignore-scripts',
'yarn build',
]),
'needs': {
'action:nodejs_install_yarn',
'pkg_apt:nodejs',
},
'triggered': True,
},
}