2021-02-20 10:10:08 +00:00
|
|
|
from bundlewrap.metadata import metadata_to_json
|
2021-02-16 11:49:02 +00:00
|
|
|
|
2021-04-02 16:57:13 +00:00
|
|
|
repo.libs.tools.require_bundle(node, 'nodejs')
|
|
|
|
|
2021-02-16 11:49:02 +00:00
|
|
|
directories = {
|
2021-07-15 16:40:48 +00:00
|
|
|
'/opt/element-web': {}
|
2021-02-16 11:49:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
git_deploy = {
|
2021-07-15 16:40:48 +00:00
|
|
|
'/opt/element-web': {
|
2021-02-16 11:49:02 +00:00
|
|
|
'rev': node.metadata['element-web']['version'],
|
|
|
|
'repo': 'https://github.com/vector-im/element-web.git',
|
|
|
|
'triggers': {
|
|
|
|
'action:element-web_yarn',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
files = {
|
2021-07-15 16:40:48 +00:00
|
|
|
'/opt/element-web/webapp/config.json': {
|
2021-02-20 10:10:08 +00:00
|
|
|
'content': metadata_to_json(node.metadata['element-web']['config']),
|
2021-02-16 11:49:02 +00:00
|
|
|
'needs': {
|
|
|
|
'action:element-web_yarn',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2022-11-27 18:56:36 +00:00
|
|
|
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')
|
|
|
|
|
2021-02-16 11:49:02 +00:00
|
|
|
actions = {
|
|
|
|
'element-web_yarn': {
|
2021-11-09 17:08:31 +00:00
|
|
|
'command': ' && '.join([
|
2022-11-27 18:56:36 +00:00
|
|
|
*extra_install_cmds,
|
2021-11-09 17:08:31 +00:00
|
|
|
'cd /opt/element-web',
|
2022-04-03 06:16:35 +00:00
|
|
|
'yarn install --pure-lockfile --ignore-scripts',
|
|
|
|
'yarn build',
|
2021-11-09 17:08:31 +00:00
|
|
|
]),
|
2021-02-16 11:49:02 +00:00
|
|
|
'needs': {
|
2022-04-03 06:38:20 +00:00
|
|
|
'action:nodejs_install_yarn',
|
2021-05-14 18:01:19 +00:00
|
|
|
'pkg_apt:nodejs',
|
2021-02-16 11:49:02 +00:00
|
|
|
},
|
|
|
|
'triggered': True,
|
|
|
|
},
|
|
|
|
}
|