tis-nodejs-lts icon

Node.js LTS

Paquet d’installation silencieuse pour Node.js LTS

22.15.0-0

  • package: tis-nodejs-lts
  • name: Node.js LTS
  • version: 22.15.0-0
  • categories: Development
  • maintainer: WAPT Team,Tranquil IT,Jimmy PELÉ,Pierre Cosson
  • editor: OpenJS Foundation
  • licence: opensource_free,cpe:/a:mit:x11_license,wapt_public
  • locale: all
  • target_os: macos
  • impacted_process: node
  • architecture: arm
  • signature_date:
  • size: 24.61 Mo
  • installed_size: 83.45 Mo
  • homepage : https://nodejs.org/

package           : tis-nodejs-lts
version           : 22.15.0-0
architecture      : arm
section           : base
priority          : optional
name              : Node.js LTS
categories        : Development
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ,Pierre Cosson
description       : Node.js is an open-source, cross-platform, JavaScript runtime environment that executes JavaScript code outside a web browser. LTS version
depends           : 
conflicts         : 
maturity          : PROD
locale            : all
target_os         : macos
min_wapt_version  : 2.3
sources           : https://nodejs.org/en/download/current/
installed_size    : 83446606
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. Version LTS
description_pl    : Node.js to open-source'owe, wieloplatformowe środowisko uruchomieniowe JavaScript, które wykonuje kod JavaScript poza przeglądarką internetową. Wersja LTS
description_de    : Node.js ist eine quelloffene, plattformübergreifende JavaScript-Laufzeitumgebung, die JavaScript-Code außerhalb eines Webbrowsers ausführt. LTS-Version
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. Versión LTS
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. Versão LTS
description_it    : Node.js è un ambiente runtime JavaScript open-source e multipiattaforma che esegue codice JavaScript al di fuori di un browser web. Versione LTS
description_nl    : Node.js is een open-source, cross-platform, JavaScript runtime omgeving die JavaScript code uitvoert buiten een web browser. LTS-versie
description_ru    : Node.js - это кроссплатформенная среда выполнения JavaScript с открытым исходным кодом, которая выполняет код JavaScript вне веб-браузера. Версия LTS
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      : fec1b351-eb7c-435d-b6e4-154704d2c5bd
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : https://github.com/nodejs/node/blob/master/CHANGELOG.md
min_os_version    : 6.3
max_os_version    : 
icon_sha256sum    : 77ad7394671d64dc6a1045c837364be28fabdc7dfa7299d29b76fe1c4c2d7769
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature_date    : 2025-04-28T09:04:55.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         : LklU9AuO6DvU7iZgiiTUlI/ROabYszLtkzrrorNUYTaxhce5SjlbVxejVLhSV5yuOnusWa4st3YAINciWZJ6ALTLzEgKfetrYC2uVtfLyqRx1xiW3QKKpHx6FVpKA4p8KsmH6la8xoMFLeheGyYswlbP1mgyptAoXU9psWSh4JsAb+nUv3z+MU/Bk6vNmuPGFzIY+UzK0/dxNw0bfx8MLgTIqT2b1nrBp5WtV8U/UCo4RSPNTSqR1zPLSRPlSlrwq8pYGdbmpvNOCSA7g86Zn47kgAmX2JN4yierjxAQ4w25OGdvT+DtqxHFH5OKCLHLz9qOw91OaMYekfIlT6BF7A==

# -*- coding: utf-8 -*-
from setuphelpers import *
import tarfile

app_name = "nodejs"
bin_path = makepath("/", "usr", "local", "bin")
app_path = "/opt/nodejs"

def extract_tar_gz(filename, path="."):
    with tarfile.open(filename, "r:xz") as tar:
        result = tar.extractall(path)

def install():
    archive_name = glob.glob("node-v*-darwin-arm64.tar.xz")[0]

    archive_len = len(archive_name) - len('.tar.xz')
    extracted_folder = archive_name[:archive_len]

    # Removing of symlink
    if isfile(makepath(bin_path, "node" )):
        remove_file(makepath(bin_path, "node" ))

    if isfile(makepath(bin_path, "npm" )):
        remove_file(makepath(bin_path, "npm" ))  

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

    #Extracting archive to app_path
    print(f"Extracting: {archive_name}")
    extract_tar_gz(archive_name, path= app_path)

    #Path to node and npm files 
    node_app = makepath(app_path, extracted_folder, "bin", "node")
    npm_app = makepath(app_path, extracted_folder, "lib", "node_modules", "npm", "bin", "npm-cli.js")

    # Creating symbolic links of node and npm-cli.js to /usr/local/bin
    print(f"Creating alias in path")
    os.symlink(node_app, makepath(bin_path, "node"))
    os.symlink(npm_app, makepath(bin_path, "npm"))

def uninstall():

    # Removing of symlink
    if isfile(makepath(bin_path, "node" )):
        remove_file(makepath(bin_path, "node" ))

    if isfile(makepath(bin_path, "npm" )):
        remove_file(makepath(bin_path, "npm" ))    

    # Removing app directory
    if isdir(app_path):
        print(f"Removing application directory: {app_path}")
        remove_tree(app_path)

# -*- coding: utf-8 -*-
from setuphelpers import *
from setupdevhelpers import *
import bs4 as BeautifulSoup
from urllib.parse import urlparse, urljoin


def update_package():
    # Declaring local variables
    package_updated = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
        
    download_dict = {
        "windows-arm64": "-arm64.msi",
        "windows-x64": "-x64.msi",
        "windows-x86": "-x86.msi",
        "windows-all": "-x86.msi",
        "macos-x64": "-darwin-x64.tar.xz",
        "macos-arm": "-darwin-arm64.tar.xz",
        "linux-x64": "-linux-x64.tar.xz",
        "linux-arm64": "-linux-arm64.tar.xz ",
    }

    url = "https://nodejs.org"

    # Looking for last version
    print("URL used is: %s" % url)
    for bs_search in bs_find_all(url, "a", "href", proxies=proxies):
        if "nodejs.org/dist" in bs_search["href"]:
            url = bs_search["href"].rsplit("/", 1)[0]
            version = url.rsplit("/",1)[-1].replace("v","")
            break
    
    # Getting latest version information from official sources
    print("URL used is: %s" % url)
    links = bs_find_all(url,'a','href', proxies = proxies)
    to_download = download_dict[control.target_os + "-" + ensure_list(control.architecture)[0]]
    for link in links:
        if link['href'].endswith(to_download):
            download_url = url + "/" + link['href'].rsplit("/",1)[-1]
            latest_bin = link.text
            version = latest_bin.split("-")[1].replace("v", "")

    # Downloading latest binaries
    print("Latest %s version is: %s" % (control.name, version))
    print("Download URL is: %s" % download_url)
    if not isfile(latest_bin):
        print("Downloading: %s" % latest_bin)
        wget(download_url, latest_bin, proxies=proxies)
    else:
        print("Binary is present: %s" % latest_bin)

    for f in glob.glob(f'*{to_download}'):
        if f != latest_bin:
            remove_file(f)

    # Checking version from file
    if get_os_name() == "Windows" and "windows" in control.target_os.lower():
        version_from_file = get_version_from_binary(latest_bin)
        if Version(version_from_file, 4) == Version(version, 4):
            print(f"INFO: Binary file version ({version_from_file}) corresponds to online version ({version})")
        else:
            error(f"ERROR: Binary file version ({version_from_file}) do NOT corresponds to online version ({version})")

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

    # Validating or not update-package-sources
    return package_updated

    # # Changing version of the package and validating update-package-sources
    # return complete_control_version(control, version)


def bs_index_of_to_dict(url, **kwargs):
    r"""Parse html "Index of" web page with BeautifulSoup and get a dict of the result

    Args:
        url (str): url of the web page to parse

    Return:
        result: a dict of the index URLs

    """
    result = {}
    for elem in bs_find_all(url, "a", "href"):
        if not "://" in elem["href"]:
            # absolute_link = urljoin(url, url + "/" + elem["href"] if not url.endswith("/") else url + elem["href"])
            absolute_link = url + "/" + elem["href"] if not url.endswith("/") else url + elem["href"]
        else:
            absolute_link = elem["href"]
        key = elem.text
        if key.endswith("..>"):  # if key.endswith("..>"):
            key = elem["href"]
        result[key] = absolute_link
    return result


def is_url(x):
    try:
        result = urlparse(x)
        return all([result.scheme, result.netloc])
    except:
        return False


def bs_find_all(url, element, attribute=None, value=None, user_agent=None, proxies=None, features="html.parser", **kwargs):
    """
    Parse an HTML or XML web page with BeautifulSoup and retrieve a list of all matching results.

    Args:
        url (str): URL of the web page or string to parse.
        element (str): Searched element.
        attribute (str): Selected attribute of the element.
        value (str): Value of the selected attribute.
        user_agent (str): Specify a user-agent if needed.
        proxies (dict): Specify proxies if needed.
        features (str): BeautifulSoup feature to use.
        **kwargs: Additional parameters for the requests library.

    Returns:
        list: List of bs4.element.Tag objects representing the matching elements.

    Examples:
        >>> bs_find_all('https://www.w3.org/', 'a', 'title', 'Open Web Platform testing')[0]['href']
        'https://web-platform-tests.org/'

        >>> bs_find_all('https://www.w3.org/', 'span', 'class', 'alt-logo')[0].string
        'W3C'

    .. versionadded:: 2.0

    .. versionchanged:: 2.5
        Function can now parse string content of a page or reparse a "bs_result". It is now possible to parse a specific attribute.

    """
    url = str(url)
    if is_url(url):
        if user_agent:
            page = requests.get(url, proxies=proxies, headers={"User-Agent": user_agent}, **kwargs).text
        else:
            page = requests.get(url, proxies=proxies, **kwargs).text
    else:
        page = url
    soup = BeautifulSoup.BeautifulSoup(page, features=features)
    if value:
        return soup.find_all(element, {attribute: value})
    elif attribute:
        return soup.find_all(element, attrs={attribute: True})
    else:
        return soup.find_all(element)

38d056ab130f7bf7c481c12636a4e9959de36561d3dfcbe54c6e3571bc0c1dc3 : WAPT/certificate.crt
95f05a25ab7cbe5a4dcd33d374e041d0c731407ea9e553c1c833d5b5aec3709a : WAPT/control
77ad7394671d64dc6a1045c837364be28fabdc7dfa7299d29b76fe1c4c2d7769 : WAPT/icon.png
f5ba3cfa97ff763d946de341608a526a457fdbfcba6eeb2fc576f87888f3182d : luti.json
6e278a107d50da24b644dd26810a639a5f8ca67b55086e6b693caabcbb759912 : node-v22.15.0-darwin-arm64.tar.xz
5a3b4d9b3e19e26a41df1f388dca40e05d49d7179d030652a250b0e93e2ab4c4 : setup.py
06a7e587cf16f31f924f4bb43736f9b8549f273750efe9123855ae388b80884e : update_package.py