Skip to content

Commit 4ebfe03

Browse files
committed
feat(@angular/cli): drop support for Node.js 12
Node.js v12 will become EOL on 2022-04-30. As a result, Angular CLI v14 will no longer support Node.js v12. BREAKING CHANGE: Support for Node.js v12 has been removed as it will become EOL on 2022-04-30. Please use Node.js v14.15 or later.
1 parent ef75362 commit 4ebfe03

File tree

17 files changed

+42
-253
lines changed

17 files changed

+42
-253
lines changed

constants.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Engine versions to stamp in a release package.json
2-
RELEASE_ENGINES_NODE = "^12.20.0 || ^14.15.0 || >=16.10.0"
2+
RELEASE_ENGINES_NODE = "^14.15.0 || >=16.10.0"
33
RELEASE_ENGINES_NPM = "^6.11.0 || ^7.5.6 || >=8.0.0"
44
RELEASE_ENGINES_YARN = ">= 1.13.0"
55

docs/DEVELOPER.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ To get started locally, follow these instructions:
66

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

lib/packages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function loadPackageJson(p: string) {
8585
// Overwrite engines to a common default.
8686
case 'engines':
8787
pkg['engines'] = {
88-
'node': '^12.20.0 || ^14.15.0 || >=16.10.0',
88+
'node': '^14.15.0 || >=16.10.0',
8989
'npm': '^6.11.0 || ^7.5.6 || >=8.0.0',
9090
'yarn': '>= 1.13.0',
9191
};

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"url": "https://github.com/angular/angular-cli.git"
4141
},
4242
"engines": {
43-
"node": "^12.20.0 || ^14.15.0 || ^16.10.0",
43+
"node": "^14.15.0 || ^16.10.0",
4444
"yarn": ">=1.21.1 <2",
4545
"npm": "Please use yarn instead of NPM to install dependencies"
4646
},
@@ -104,7 +104,7 @@
104104
"@types/karma": "^6.3.0",
105105
"@types/loader-utils": "^2.0.0",
106106
"@types/minimatch": "3.0.5",
107-
"@types/node": "~12.12.6",
107+
"@types/node": "^14.15.0",
108108
"@types/node-fetch": "^2.1.6",
109109
"@types/npm-package-arg": "^6.1.0",
110110
"@types/parse5-html-rewriting-stream": "^5.1.2",

packages/angular/cli/bin/ng.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,17 @@ if (version[0] % 2 === 1 && version[0] > 16) {
3636

3737
require('./bootstrap');
3838
} else if (
39-
version[0] < 12 ||
40-
version[0] === 13 ||
39+
version[0] < 14 ||
4140
version[0] === 15 ||
42-
(version[0] === 12 && version[1] < 20) ||
4341
(version[0] === 14 && version[1] < 15) ||
4442
(version[0] === 16 && version[1] < 10)
4543
) {
46-
// Error and exit if less than 12.20 or 13.x or less than 14.15 or 15.x or less than 16.10
44+
// Error and exit if less than 14.15 or 15.x or less than 16.10
4745
console.error(
4846
'Node.js version ' +
4947
process.version +
5048
' detected.\n' +
51-
'The Angular CLI requires a minimum Node.js version of either v12.20, v14.15, or v16.10.\n\n' +
49+
'The Angular CLI requires a minimum Node.js version of either v14.15, or v16.10.\n\n' +
5250
'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n',
5351
);
5452

packages/angular/cli/commands/update-impl.ts

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -635,32 +635,11 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
635635
try {
636636
// Remove existing node modules directory to provide a stronger guarantee that packages
637637
// will be hoisted into the correct locations.
638-
639-
// The below should be removed and replaced with just `rm` when support for Node.Js 12 is removed.
640-
const { rm, rmdir } = fs.promises as typeof fs.promises & {
641-
rm?: (
642-
path: fs.PathLike,
643-
options?: {
644-
force?: boolean;
645-
maxRetries?: number;
646-
recursive?: boolean;
647-
retryDelay?: number;
648-
},
649-
) => Promise<void>;
650-
};
651-
652-
if (rm) {
653-
await rm(path.join(this.context.root, 'node_modules'), {
654-
force: true,
655-
recursive: true,
656-
maxRetries: 3,
657-
});
658-
} else {
659-
await rmdir(path.join(this.context.root, 'node_modules'), {
660-
recursive: true,
661-
maxRetries: 3,
662-
});
663-
}
638+
await fs.promises.rm(path.join(this.context.root, 'node_modules'), {
639+
force: true,
640+
recursive: true,
641+
maxRetries: 3,
642+
});
664643
} catch {}
665644

666645
const result = await installAllPackages(

packages/angular/cli/lib/cli/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ const isDebug = debugEnv !== undefined && debugEnv !== '0' && debugEnv.toLowerCa
2222
/* eslint-disable no-console */
2323
export default async function (options: { testing?: boolean; cliArgs: string[] }) {
2424
// This node version check ensures that the requirements of the project instance of the CLI are met
25-
const version = process.versions.node.split('.').map((part) => Number(part));
26-
if (version[0] < 12 || (version[0] === 12 && version[1] < 20)) {
25+
const [major, minor] = process.versions.node.split('.').map((part) => Number(part));
26+
if (major < 14 || (major === 14 && minor < 15)) {
2727
process.stderr.write(
2828
`Node.js version ${process.version} detected.\n` +
29-
'The Angular CLI requires a minimum v12.20.\n\n' +
29+
'The Angular CLI requires a minimum v14.15.\n\n' +
3030
'Please update your Node.js version or visit https://nodejs.org/ for additional instructions.\n',
3131
);
3232

packages/angular_devkit/build_angular/src/utils/delete-output-dir.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,5 @@ export function deleteOutputDir(root: string, outputPath: string): void {
1818
throw new Error('Output path MUST not be project root directory!');
1919
}
2020

21-
// The below should be removed and replace with just `rmSync` when support for Node.Js 12 is removed.
22-
const { rmSync, rmdirSync } = fs as typeof fs & {
23-
rmSync?: (
24-
path: fs.PathLike,
25-
options?: {
26-
force?: boolean;
27-
maxRetries?: number;
28-
recursive?: boolean;
29-
retryDelay?: number;
30-
},
31-
) => void;
32-
};
33-
34-
if (rmSync) {
35-
rmSync(resolvedOutputPath, { force: true, recursive: true, maxRetries: 3 });
36-
} else {
37-
rmdirSync(resolvedOutputPath, { recursive: true, maxRetries: 3 });
38-
}
21+
fs.rmSync(resolvedOutputPath, { force: true, recursive: true, maxRetries: 3 });
3922
}

packages/angular_devkit/build_angular/src/utils/i18n-options.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -279,25 +279,8 @@ function findLocaleDataPath(locale: string, resolver: (locale: string) => string
279279

280280
/** Remove temporary directory used for i18n processing. */
281281
function deleteTempDirectory(tempPath: string): void {
282-
// The below should be removed and replaced with just `rmSync` when support for Node.Js 12 is removed.
283-
const { rmSync, rmdirSync } = fs as typeof fs & {
284-
rmSync?: (
285-
path: fs.PathLike,
286-
options?: {
287-
force?: boolean;
288-
maxRetries?: number;
289-
recursive?: boolean;
290-
retryDelay?: number;
291-
},
292-
) => void;
293-
};
294-
295282
try {
296-
if (rmSync) {
297-
rmSync(tempPath, { force: true, recursive: true, maxRetries: 3 });
298-
} else {
299-
rmdirSync(tempPath, { recursive: true, maxRetries: 3 });
300-
}
283+
fs.rmSync(tempPath, { force: true, recursive: true, maxRetries: 3 });
301284
} catch {}
302285
}
303286

packages/angular_devkit/build_angular/src/utils/purge-cache.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,12 @@ export async function purgeStaleBuildCache(context: BuilderContext): Promise<voi
2525
return;
2626
}
2727

28-
// The below should be removed and replaced with just `rm` when support for Node.Js 12 is removed.
29-
const { rm, rmdir } = fsPromises as typeof fsPromises & {
30-
rm?: (
31-
path: PathLike,
32-
options?: {
33-
force?: boolean;
34-
maxRetries?: number;
35-
recursive?: boolean;
36-
retryDelay?: number;
37-
},
38-
) => Promise<void>;
39-
};
40-
4128
const entriesToDelete = (await fsPromises.readdir(basePath, { withFileTypes: true }))
4229
.filter((d) => join(basePath, d.name) !== path && d.isDirectory())
4330
.map((d) => {
4431
const subPath = join(basePath, d.name);
4532
try {
46-
return rm
47-
? rm(subPath, { force: true, recursive: true, maxRetries: 3 })
48-
: rmdir(subPath, { recursive: true, maxRetries: 3 });
33+
return fsPromises.rm(subPath, { force: true, recursive: true, maxRetries: 3 });
4934
} catch {}
5035
});
5136

0 commit comments

Comments
 (0)