tis-nodejs icon

Node.js

Silent install package for Node.js

26.13.1-1
Development
Development

  • package: tis-nodejs
  • name: Node.js
  • version: 26.13.1-1
  • categories: Development
  • maintainer: WAPT Team,Tranquil IT,Jimmy PELÉ,Pierre Cosson,Stan SALOMON
  • editor: OpenJS Foundation
  • licence: opensource_free,cpe:/a:mit:x11_license,wapt_public
  • locale: all
  • target_os: debian(>=11),ubuntu(>=20),redhat_based(>=8)
  • impacted_process: node
  • architecture: x64
  • signature_date:
  • size: 62.91 Mo
  • homepage : https://nodejs.org/

package           : tis-nodejs
version           : 26.13.1-1
architecture      : x64
section           : base
priority          : optional
name              : Node.js
categories        : Development
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ,Pierre Cosson,Stan SALOMON
description       : Node.js is an open-source, cross-platform, JavaScript runtime environment that executes JavaScript code outside a web browser.
depends           : 
conflicts         : 
maturity          : PROD
locale            : all
target_os         : debian(>=11),ubuntu(>=20),redhat_based(>=8)
min_wapt_version  : 2.5
sources           : https://nodejs.org/en/download/current/
installed_size    : 
impacted_process  : node
description_fr    : Node.js est un environnement d'exécution JavaScript open-source, multiplateforme, qui exécute du code JavaScript en dehors d'un navigateur Web.
description_pl    : Node.js to open-source'owe, wieloplatformowe środowisko uruchomieniowe JavaScript, które wykonuje kod JavaScript poza przeglądarką internetową.
description_de    : Node.js ist eine quelloffene, plattformübergreifende JavaScript-Laufzeitumgebung, die JavaScript-Code außerhalb eines Webbrowsers ausführt.
description_es    : Node.js es un entorno de ejecución de JavaScript de código abierto y multiplataforma que ejecuta código JavaScript fuera de un navegador web.
description_pt    : Node.js é um ambiente de código aberto, multi-plataforma, JavaScript runtime que executa o código JavaScript fora de um navegador web.
description_it    : Node.js è un ambiente runtime JavaScript open-source e multipiattaforma che esegue codice JavaScript al di fuori di un browser web.
description_nl    : Node.js is een open-source, cross-platform, JavaScript runtime omgeving die JavaScript code uitvoert buiten een web browser.
description_ru    : Node.js - это кроссплатформенная среда выполнения JavaScript с открытым исходным кодом, которая выполняет код JavaScript вне веб-браузера.
audit_schedule    : 
editor            : OpenJS Foundation
keywords          : javascript,js,node,open,code
licence           : opensource_free,cpe:/a:mit:x11_license,wapt_public
homepage          : https://nodejs.org/
package_uuid      : 95952b38-16f6-477b-b4bb-bd6bc68590f4
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : https://github.com/nodejs/node/blob/master/CHANGELOG.md
min_os_version    : 
max_os_version    : 
icon_sha256sum    : 77ad7394671d64dc6a1045c837364be28fabdc7dfa7299d29b76fe1c4c2d7769
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature_date    : 2026-11-18T18:12:37.000000
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes
signature         : U8jZyZJJu7NqKYxAx02uIaHmad92B2Q8TMbNDRGHNPMXNLgnWkwoLTD/LLssmD45itd+18jQmYDOSd0rB9J3XZshinBl8q5zMPb5zVua0Cx3rwgqXtdq1IA1l2a3RAPsTaBRAbEthhKZ+eR3eE1BveM+yU+WFZw8RKJ6AUaxAsmyQ/A3z2T6XznkCdIZ/Ejmxhj8l9+X/v9Mwxi4XfYLkhN9Bouf8TTXU0jokTHpL6/RlFMWQ99koTzXSqf4IvCEUWlQRxf6psxG+1aL4YOAIIiIPEncsmGO62MvL+MhVXdRvgeXbrWCO3GaY38pWUC54oDJJWdzQUgbTv7fUEWcIw==

from setuphelpers import *
import tarfile

app_path = "/opt/nodejs"
bin_dir = "/usr/local/bin"

def extract_tar(filename, path="."):
    with tarfile.open(filename, "r:gz") as tar:
        tar.extractall(path)

def install():
    archive_file = glob.glob("node-v*-linux-*.tar.gz")[0]
    temp_extract_folder = makepath(basedir, "nodejs")

    # Delete older version
    if isdir(app_path):
        remove_tree(app_path)

    extract_tar(archive_file, path=temp_extract_folder)

    folder_app = glob.glob(f"{temp_extract_folder}/*")[0]

    copytree2(folder_app, app_path)

    # Creating symlinks for all commands in the bin folder
    for command in os.listdir(f"{app_path}/bin"):
        link = f"{bin_dir}/{command}"
        if isfile(link) or os.path.islink(link):
            print(f"Removing existing symlink {link}")
            remove_file(link)
        print(f"Creating {command} alias in path")
        os.symlink(f"{app_path}/bin/{command}", link)

    # Delete extracted folder
    if isdir(temp_extract_folder):
        remove_tree(temp_extract_folder)


def uninstall():
    # Removing of symlink
    if isdir(f"{app_path}/bin"):
        for command in os.listdir(f"{app_path}/bin"):
            link = f"{bin_dir}/{command}"
            if os.path.islink(link) and os.readlink(link).startswith(app_path):
                remove_file(link)
 
    # Removing of the software
    if isdir(app_path):
        remove_tree(app_path)


def audit():
    version = control.get_software_version()
    try:
        installed = run(f"{bin_dir}/node --version").strip().lstrip("v")
    except Exception as e:
        print(f"node does not start: {e}")
        return "ERROR"
    if installed != version:
        print(f"Installed version {installed} != package version {version}")
        return "ERROR"
    return "OK"

from setuphelpers import *
from setupdevhelpers import *
import waptlicences

def update_package():
    # Declaring local variables
    package_updated = False
    proxies = get_proxies()

    os_dict = {
        "windows-x64": "-x64.msi",
        "windows-arm64": "-arm64.msi",
        "debian(>=11),ubuntu(>=20),redhat_based(>=8)-x64": "-linux-x64.tar.gz",
        "debian(>=11),ubuntu(>=20),redhat_based(>=8)-arm64": "-linux-arm64.tar.gz",
        "darwin-all": ".pkg"
    }

    os_type = control.target_os + "-" + ensure_list(control.architecture)[0]

    if not proxies:
        proxies = get_proxies_from_wapt_console()

    data = wgets(f"https://nodejs.org/download/release/index.json", proxies=proxies, as_json=True)
    latest_stable = next(item for item in data if "-" not in item.get("version", ""))

    version = latest_stable["version"].replace("v", "")
    # https://nodejs.org/download/release/v26.13.0/node-v26.13.0-x64.msi
    download_url = f"https://nodejs.org/download/release/v{version}/node-v{version}{os_dict[os_type]}"
    latest_bin = download_url.rsplit("/", 1)[-1]
    latest_bin_extension = latest_bin.rsplit(".", 1)[-1]

    if not isfile(latest_bin):
        print(f"Downloading: {latest_bin}")
        wget(download_url, latest_bin, proxies=proxies)
    else:
        print(f"Binary is present: {latest_bin}")

    if control.target_os == "windows":
        # Check signature bin (only windows)
        expected_issuer = "OpenJS Foundation"
        sign_name = waptlicences.check_msi_signature(latest_bin)[0]
        if sign_name != expected_issuer:
            error('Bad issuer %s != %s ' % (sign_name,expected_issuer))

    # Deleting outdated binaries
    for f in glob.glob(f"*.{latest_bin_extension}"):
        if f != latest_bin:
            remove_file(f)

    # Changing version of the package
    if Version(version) > Version(control.get_software_version()):
        print(f"Software version updated (from: {control.get_software_version()} to: {Version(version)})")
        package_updated = True
    else:
        print(f"Software version up-to-date ({Version(version)})")
        
    control.set_software_version(version)
    control.save_control_to_wapt()

    # Validating or not update-package-sources
    return package_updated

38d056ab130f7bf7c481c12636a4e9959de36561d3dfcbe54c6e3571bc0c1dc3 : WAPT/certificate.crt
6f1421443c25aa363a2bacea4a11313b47075ec46cb8da15316d6e9817c20ba9 : WAPT/control
77ad7394671d64dc6a1045c837364be28fabdc7dfa7299d29b76fe1c4c2d7769 : WAPT/icon.png
aba481f490cc9d43fe130b3413bdf1fddec044cd7bf9ec7a7b4c07ab29ec8303 : luti.json
518674de2b621728a5e4486f5fb3b7d2900bb3cc4aa97969edaa463db99f9778 : node-v26.13.1-linux-x64.tar.gz
eb068b0991a2592667f09c8253e4934355c0c431e526c8452ddd6a303aff2473 : setup.py
978153607791a3e9d1ae1311a01c2cbd19e2523f4cf7fa43f18f63060c1aab7a : update_package.py