defaults = { 'apt': { 'additional_update_commands': { # update npm to latest version 'npm install -g npm@latest', 'npm install -g yarn@latest', }, 'packages': { 'nodejs': {}, }, }, } @metadata_reactor.provides( 'apt/repos/nodejs/items', ) def nodejs_from_version(metadata): version = metadata.get('nodejs/version', 18) return { 'apt': { 'repos': { 'node': { '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', }, }, }, }, }