bundles/nodejs: everything changed, AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

This commit is contained in:
Franzi 2024-07-19 19:19:45 +02:00
parent 350c436e4d
commit 55a3e6675f
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 22 additions and 44 deletions

View file

@ -1,9 +0,0 @@
actions = {
'nodejs_install_yarn': {
'command': 'npm install -g yarn@latest',
'unless': 'test -e /usr/lib/node_modules/yarn',
'after': {
'pkg_apt:',
},
},
}

View file

@ -1,54 +1,41 @@
defaults = {
'apt': {
'additional_update_commands': {
# update npm to latest version
# update npm and yarn to latest version
'npm install -g npm@latest',
'npm install -g yarn@latest',
},
'packages': {
'nodejs': {},
'nodejs': {
'triggers': {
'action:apt_execute_update_commands',
},
},
'npm': {
'installed': False,
'triggers': {
'action:apt_execute_update_commands',
},
},
},
},
'nodejs': {
'version': 18,
},
}
VERSIONS_SHIPPED_BY_DEBIAN = {
10: 10,
11: 12,
12: 18,
13: 18,
}
@metadata_reactor.provides(
'apt/repos/nodejs/items',
'apt/additional_update_commands',
)
def nodejs_from_version(metadata):
version = metadata.get('nodejs/version')
if version != VERSIONS_SHIPPED_BY_DEBIAN[node.os_version[0]]:
return {
'apt': {
'additional_update_commands': {
# update npm to latest version
'npm install -g npm@latest',
},
'repos': {
'nodejs': {
'items': {
f'deb https://deb.nodesource.com/node_{version}.x {{os_release}} main',
f'deb-src https://deb.nodesource.com/node_{version}.x {{os_release}} main',
},
return {
'apt': {
'repos': {
'nodejs': {
'items': {
f'deb https://deb.nodesource.com/node_{version}.x nodistro main',
f'deb-src https://deb.nodesource.com/node_{version}.x nodistro main',
},
},
},
}
else:
return {
'apt': {
'packages': {
'npm': {},
},
},
}
},
}