bundlewrap/bundles/nodejs/metadata.py

41 lines
997 B
Python
Raw Permalink Normal View History

2020-08-18 13:27:55 +00:00
defaults = {
'apt': {
2022-03-06 11:50:04 +00:00
'additional_update_commands': {
# update npm and yarn to latest version
'npm install -g npm@latest',
'npm install -g yarn@latest',
2022-03-06 11:50:04 +00:00
},
2020-08-18 13:27:55 +00:00
'packages': {
'nodejs': {
'triggers': {
'action:apt_execute_update_commands',
},
},
'npm': {
'installed': False,
'triggers': {
'action:apt_execute_update_commands',
},
},
2020-08-18 13:27:55 +00:00
},
},
}
@metadata_reactor.provides(
'apt/repos/nodejs/items',
)
def nodejs_from_version(metadata):
version = metadata.get('nodejs/version')
return {
'apt': {
'repos': {
'nodejs': {
'items': {
f'deb https://deb.nodesource.com/node_{version}.x nodistro main',
},
},
},
},
}