UNPKG

@angular/cli

Version:
65 lines 2.65 kB
"use strict"; /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ Object.defineProperty(exports, "__esModule", { value: true }); exports.supportedNodeVersions = void 0; exports.isNodeVersionSupported = isNodeVersionSupported; exports.isNodeVersionMinSupported = isNodeVersionMinSupported; /** * @fileoverview This file contains the supported Node.js version for the Angular CLI. * @important This file must not import any other modules. */ /** * The supported Node.js version for the Angular CLI. */ const SUPPORTED_NODE_VERSIONS = '^22.22.3 || ^24.15.0 || >=26.0.0'; /** * The supported Node.js versions. */ exports.supportedNodeVersions = SUPPORTED_NODE_VERSIONS.replace(/[\^~<>=]/g, '') .split('||') .map((v) => v.trim()); /** * Checks if the current Node.js version is supported. * @returns `true` if the current Node.js version is supported, `false` otherwise. */ function isNodeVersionSupported() { if (SUPPORTED_NODE_VERSIONS.charAt(0) === '0') { // Unlike `pkg_npm`, `ts_library` which is used to run unit tests does not support substitutions. return true; } const [processMajor, processMinor, processPatch] = process.versions.node .split('.', 3) .map((part) => Number(part)); for (const version of exports.supportedNodeVersions) { const [major, minor, patch] = version.split('.', 3).map((part) => Number(part)); if ((major === processMajor && processMinor === minor && processPatch >= patch) || (major === processMajor && processMinor > minor)) { return true; } } return false; } /** * Checks if the current Node.js version is the minimum supported version. * @returns `true` if the current Node.js version is the minimum supported version, `false` otherwise. */ function isNodeVersionMinSupported() { if (SUPPORTED_NODE_VERSIONS.charAt(0) === '0') { // Unlike `pkg_npm`, `ts_library` which is used to run unit tests does not support substitutions. return true; } const [processMajor, processMinor, processPatch] = process.versions.node .split('.', 3) .map((part) => Number(part)); const [major, minor, patch] = exports.supportedNodeVersions[0].split('.', 3).map((part) => Number(part)); return (processMajor > major || (processMajor === major && processMinor > minor) || (processMajor === major && processMinor === minor && processPatch >= patch)); } //# sourceMappingURL=node-version.js.map