feat(@angular/cli): drop support for Node.js versions older than 14.20

Node.js 14.20 and newer support generating UUID using the crypto module. See: https://nodejs.org/docs/latest-v14.x/api/crypto.html#crypto_crypto_randomuuid_options

BREAKING CHANGE: Node.js versions older than 14.20 are no longer supported.
This commit is contained in:
Alan Agius 2022-10-04 13:29:03 +00:00 committed by Charles
parent 676a0b3649
commit 4b623461a4
14 changed files with 24 additions and 27 deletions

View File

@ -23,9 +23,9 @@ parameters:
## IMPORTANT ## IMPORTANT
# Windows needs its own cache key because binaries in node_modules are different. # Windows needs its own cache key because binaries in node_modules are different.
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI. # See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
var_1: &cache_key v1-angular_devkit-14.19-{{ checksum "yarn.lock" }} var_1: &cache_key v1-angular_devkit-14.20-{{ checksum "yarn.lock" }}
var_1_win: &cache_key_win v1-angular_devkit-win-16.10-{{ checksum "yarn.lock" }} var_1_win: &cache_key_win v1-angular_devkit-win-16.10-{{ checksum "yarn.lock" }}
var_3: &default_nodeversion '14.19' var_3: &default_nodeversion '14.20'
var_3_major: &default_nodeversion_major '14' var_3_major: &default_nodeversion_major '14'
# The major version of node toolchains. See tools/toolchain_info.bzl # The major version of node toolchains. See tools/toolchain_info.bzl
# NOTE: entries in this array may be repeated elsewhere in the file, find them before adding more # NOTE: entries in this array may be repeated elsewhere in the file, find them before adding more
@ -404,7 +404,7 @@ workflows:
- e2e-tests: - e2e-tests:
name: e2e-cli-<< matrix.subset >> name: e2e-cli-<< matrix.subset >>
nodeversion: '14.15' nodeversion: '14.20'
matrix: matrix:
parameters: parameters:
subset: *all_e2e_subsets subset: *all_e2e_subsets
@ -421,7 +421,7 @@ workflows:
matrix: matrix:
alias: e2e-cli alias: e2e-cli
parameters: parameters:
nodeversion: ['14.15', '16.10'] nodeversion: ['14.20', '16.10']
subset: *all_e2e_subsets subset: *all_e2e_subsets
requires: requires:
- build - build

2
.nvmrc
View File

@ -1 +1 @@
14.17.0 14.20.0

View File

@ -53,7 +53,7 @@ load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
nodejs_register_toolchains( nodejs_register_toolchains(
name = "nodejs", name = "nodejs",
node_version = "14.17.1", node_version = "14.20.0",
) )
load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install") load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
@ -91,7 +91,7 @@ register_jq_toolchains(version = "1.6")
nodejs_register_toolchains( nodejs_register_toolchains(
name = "node14", name = "node14",
node_version = "14.17.1", node_version = "14.20.0",
) )
nodejs_register_toolchains( nodejs_register_toolchains(

View File

@ -1,5 +1,5 @@
# Engine versions to stamp in a release package.json # Engine versions to stamp in a release package.json
RELEASE_ENGINES_NODE = "^14.15.0 || >=16.10.0" RELEASE_ENGINES_NODE = "^14.20.0 || >=16.10.0"
RELEASE_ENGINES_NPM = "^6.11.0 || ^7.5.6 || >=8.0.0" RELEASE_ENGINES_NPM = "^6.11.0 || ^7.5.6 || >=8.0.0"
RELEASE_ENGINES_YARN = ">= 1.13.0" RELEASE_ENGINES_YARN = ">= 1.13.0"

View File

@ -6,7 +6,7 @@ To get started locally, follow these instructions:
1. If you haven't done it already, [make a fork of this repo](https://github.com/angular/angular-cli/fork). 1. If you haven't done it already, [make a fork of this repo](https://github.com/angular/angular-cli/fork).
1. Clone to your local computer using `git`. 1. Clone to your local computer using `git`.
1. Make sure that you have Node `v14.15`, or `v16.10` installed. See instructions [here](https://nodejs.org/en/download/). 1. Make sure that you have Node `v14.20`, or `v16.10` installed. See instructions [here](https://nodejs.org/en/download/).
1. Make sure that you have `yarn` installed; see instructions [here](https://yarnpkg.com/lang/en/docs/install/). 1. Make sure that you have `yarn` installed; see instructions [here](https://yarnpkg.com/lang/en/docs/install/).
1. Run `yarn` (no arguments) from the root of your clone of this project to install dependencies. 1. Run `yarn` (no arguments) from the root of your clone of this project to install dependencies.

View File

@ -85,7 +85,7 @@ function loadPackageJson(p: string) {
// Overwrite engines to a common default. // Overwrite engines to a common default.
case 'engines': case 'engines':
pkg['engines'] = { pkg['engines'] = {
'node': '^14.15.0 || >=16.10.0', 'node': '^14.20.0 || >=16.10.0',
'npm': '^6.11.0 || ^7.5.6 || >=8.0.0', 'npm': '^6.11.0 || ^7.5.6 || >=8.0.0',
'yarn': '>= 1.13.0', 'yarn': '>= 1.13.0',
}; };

View File

@ -41,7 +41,7 @@
"url": "https://github.com/angular/angular-cli.git" "url": "https://github.com/angular/angular-cli.git"
}, },
"engines": { "engines": {
"node": "^14.15.0 || ^16.10.0", "node": "^14.20.0 || ^16.10.0",
"yarn": ">=1.21.1 <2", "yarn": ">=1.21.1 <2",
"npm": "Please use yarn instead of NPM to install dependencies" "npm": "Please use yarn instead of NPM to install dependencies"
}, },
@ -120,7 +120,6 @@
"@types/semver": "^7.3.12", "@types/semver": "^7.3.12",
"@types/tar": "^6.1.2", "@types/tar": "^6.1.2",
"@types/text-table": "^0.2.1", "@types/text-table": "^0.2.1",
"@types/uuid": "^8.0.0",
"@types/yargs": "^17.0.8", "@types/yargs": "^17.0.8",
"@types/yargs-parser": "^21.0.0", "@types/yargs-parser": "^21.0.0",
"@types/yarnpkg__lockfile": "^1.1.5", "@types/yarnpkg__lockfile": "^1.1.5",

View File

@ -64,7 +64,6 @@ ts_library(
"@npm//@types/pacote", "@npm//@types/pacote",
"@npm//@types/resolve", "@npm//@types/resolve",
"@npm//@types/semver", "@npm//@types/semver",
"@npm//@types/uuid",
"@npm//@types/yargs", "@npm//@types/yargs",
"@npm//@types/yarnpkg__lockfile", "@npm//@types/yarnpkg__lockfile",
"@npm//@yarnpkg/lockfile", "@npm//@yarnpkg/lockfile",

View File

@ -41,12 +41,12 @@ if (version[0] % 2 === 1 && version[0] > 16) {
(version[0] === 14 && version[1] < 15) || (version[0] === 14 && version[1] < 15) ||
(version[0] === 16 && version[1] < 10) (version[0] === 16 && version[1] < 10)
) { ) {
// Error and exit if less than 14.15 or 15.x or less than 16.10 // Error and exit if less than 14.20 or 15.x or less than 16.10
console.error( console.error(
'Node.js version ' + 'Node.js version ' +
process.version + process.version +
' detected.\n' + ' detected.\n' +
'The Angular CLI requires a minimum Node.js version of either v14.15, or v16.10.\n\n' + 'The Angular CLI requires a minimum Node.js version of either v14.20, or v16.10.\n\n' +
'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n', 'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n',
); );

View File

@ -40,7 +40,6 @@
"resolve": "1.22.1", "resolve": "1.22.1",
"semver": "7.3.7", "semver": "7.3.7",
"symbol-observable": "4.0.0", "symbol-observable": "4.0.0",
"uuid": "9.0.0",
"yargs": "17.6.0" "yargs": "17.6.0"
}, },
"devDependencies": { "devDependencies": {

View File

@ -7,8 +7,8 @@
*/ */
import { analytics, json, tags } from '@angular-devkit/core'; import { analytics, json, tags } from '@angular-devkit/core';
import { randomUUID } from 'crypto';
import debug from 'debug'; import debug from 'debug';
import { v4 as uuidV4 } from 'uuid';
import { colors } from '../utilities/color'; import { colors } from '../utilities/color';
import { getWorkspace } from '../utilities/config'; import { getWorkspace } from '../utilities/config';
import { analyticsDisabled, analyticsShareDisabled } from '../utilities/environment-options'; import { analyticsDisabled, analyticsShareDisabled } from '../utilities/environment-options';
@ -78,7 +78,7 @@ export async function setAnalyticsConfig(global: boolean, value: string | boolea
throw new Error(`Invalid config found at ${workspace.filePath}. CLI should be an object.`); throw new Error(`Invalid config found at ${workspace.filePath}. CLI should be an object.`);
} }
cli.analytics = value === true ? uuidV4() : value; cli.analytics = value === true ? randomUUID() : value;
await workspace.save(); await workspace.save();
analyticsDebug('done'); analyticsDebug('done');
} }

View File

@ -7,8 +7,8 @@
*/ */
import { JsonValue } from '@angular-devkit/core'; import { JsonValue } from '@angular-devkit/core';
import { randomUUID } from 'crypto';
import { join } from 'path'; import { join } from 'path';
import { v4 as uuidV4 } from 'uuid';
import { Argv } from 'yargs'; import { Argv } from 'yargs';
import { import {
CommandModule, CommandModule,
@ -104,7 +104,7 @@ export class ConfigCommandModule
throw new CommandModuleError('Confguration file cannot be found.'); throw new CommandModuleError('Confguration file cannot be found.');
} }
const normalizeUUIDValue = (v: string | undefined) => (v === '' ? uuidV4() : `${v}`); const normalizeUUIDValue = (v: string | undefined) => (v === '' ? randomUUID() : `${v}`);
const value = const value =
options.jsonPath === 'cli.analyticsSharing.uuid' options.jsonPath === 'cli.analyticsSharing.uuid'

View File

@ -35,7 +35,7 @@
} }
}, },
"engines": { "engines": {
"node": "^14.15.0 || >=16.10.0", "node": "^14.20.0 || >=16.10.0",
"npm": "^6.11.0 || ^7.5.6 || >=8.0.0", "npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
"yarn": ">= 1.13.0" "yarn": ">= 1.13.0"
} }

View File

@ -2661,7 +2661,7 @@
dependencies: dependencies:
source-map "^0.6.1" source-map "^0.6.1"
"@types/uuid@^8.0.0", "@types/uuid@^8.3.1": "@types/uuid@^8.3.1":
version "8.3.4" version "8.3.4"
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.4.tgz#bd86a43617df0594787d38b735f55c805becf1bc" resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.4.tgz#bd86a43617df0594787d38b735f55c805becf1bc"
integrity sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw== integrity sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==
@ -11176,11 +11176,6 @@ utils-merge@1.0.1:
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==
uuid@9.0.0, uuid@^9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==
uuid@^3.3.2: uuid@^3.3.2:
version "3.4.0" version "3.4.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
@ -11191,6 +11186,11 @@ uuid@^8.3.2:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
uuid@^9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==
v8-compile-cache-lib@^3.0.1: v8-compile-cache-lib@^3.0.1:
version "3.0.1" version "3.0.1"
resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf"