Skip to content

Commit 181b375

Browse files
committed
refactor(@schematics/angular): use built-in POSIX path utilities for replace-nguniversal-engines migration
The use of the custom path functions from `@angular-devkit/core` have been removed in favor of the built-in functions from Node.js. These provide equivalent functionality with an improvement in performance. The amount of custom code executed has also been reduced.
1 parent fab40ea commit 181b375

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

packages/schematics/angular/migrations/update-17/replace-nguniversal-engines.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import { dirname, normalize, relative } from '@angular-devkit/core';
109
import { DirEntry, Rule, chain } from '@angular-devkit/schematics';
10+
import { dirname, relative } from 'node:path/posix';
1111
import { addDependency } from '../../utility';
1212
import { getPackageJsonDependency, removePackageJsonDependency } from '../../utility/dependencies';
1313
import { latestVersions } from '../../utility/latest-versions';
@@ -95,10 +95,7 @@ export default function (): Rule {
9595
if (content.includes('@nguniversal/express-engine/tokens')) {
9696
hasExpressTokens ||= true;
9797

98-
let tokensFileRelativePath: string = relative(
99-
dirname(normalize(path)),
100-
normalize(tokensFilePath),
101-
);
98+
let tokensFileRelativePath: string = relative(dirname(path), tokensFilePath);
10299

103100
if (tokensFileRelativePath.charAt(0) !== '.') {
104101
tokensFileRelativePath = './' + tokensFileRelativePath;

0 commit comments

Comments
 (0)