bundles/nodejs: only install nodesource packages if debian does not ship that version
This commit is contained in:
parent
a929f24977
commit
46e00d6fc8
2 changed files with 32 additions and 12 deletions
|
@ -2,8 +2,8 @@ actions = {
|
||||||
'nodejs_install_yarn': {
|
'nodejs_install_yarn': {
|
||||||
'command': 'npm install -g yarn@latest',
|
'command': 'npm install -g yarn@latest',
|
||||||
'unless': 'test -e /usr/lib/node_modules/yarn',
|
'unless': 'test -e /usr/lib/node_modules/yarn',
|
||||||
'needs': {
|
'after': {
|
||||||
'pkg_apt:nodejs',
|
'pkg_apt:',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ defaults = {
|
||||||
'apt': {
|
'apt': {
|
||||||
'additional_update_commands': {
|
'additional_update_commands': {
|
||||||
# update npm to latest version
|
# update npm to latest version
|
||||||
'npm install -g npm@latest',
|
|
||||||
'npm install -g yarn@latest',
|
'npm install -g yarn@latest',
|
||||||
},
|
},
|
||||||
'packages': {
|
'packages': {
|
||||||
|
@ -14,20 +13,41 @@ defaults = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VERSIONS_SHIPPED_BY_DEBIAN = {
|
||||||
|
10: 10,
|
||||||
|
11: 12,
|
||||||
|
12: 18,
|
||||||
|
13: 18,
|
||||||
|
}
|
||||||
|
|
||||||
@metadata_reactor.provides(
|
@metadata_reactor.provides(
|
||||||
'apt/repos/nodejs/items',
|
'apt/repos/nodejs/items',
|
||||||
)
|
)
|
||||||
def nodejs_from_version(metadata):
|
def nodejs_from_version(metadata):
|
||||||
version = metadata.get('nodejs/version')
|
version = metadata.get('nodejs/version')
|
||||||
return {
|
|
||||||
'apt': {
|
if version != VERSIONS_SHIPPED_BY_DEBIAN[node.os_version[0]]:
|
||||||
'repos': {
|
return {
|
||||||
'nodejs': {
|
'apt': {
|
||||||
'items': {
|
'additional_update_commands': {
|
||||||
f'deb https://deb.nodesource.com/node_{version}.x {{os_release}} main',
|
# update npm to latest version
|
||||||
f'deb-src https://deb.nodesource.com/node_{version}.x {{os_release}} main',
|
'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',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
}
|
else:
|
||||||
|
return {
|
||||||
|
'apt': {
|
||||||
|
'packages': {
|
||||||
|
'npm': {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue