Skip to content

Commit 88d6ca4

Browse files
committed
fix(@angular-devkit/schematics): replace template line endings with platform specific
Currently, when using `ng new` on Windows, users will get a number of `LF will be replaced by CRLF the next time Git touches it` warnings. This commit, replaces the line endings in templates to be platform specific. Closes #26764 (cherry picked from commit 7e9bbe4)
1 parent eec44d0 commit 88d6ca4

File tree

1 file changed

+2
-2
lines changed
  • packages/angular_devkit/schematics/src/rules

1 file changed

+2
-2
lines changed

packages/angular_devkit/schematics/src/rules/template.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import { BaseException, normalize, template as templateImpl } from '@angular-devkit/core';
10-
import { TextDecoder } from 'util';
10+
import { EOL } from 'node:os';
1111
import { FileOperator, Rule } from '../engine/interface';
1212
import { FileEntry } from '../tree/interface';
1313
import { chain, composeFileOperators, forEach, when } from './base';
@@ -55,7 +55,7 @@ export function applyContentTemplate<T>(options: T): FileOperator {
5555
const { path, content } = entry;
5656

5757
try {
58-
const decodedContent = decoder.decode(content);
58+
const decodedContent = decoder.decode(content).replace(/\r?\n/g, EOL);
5959

6060
return {
6161
path,

0 commit comments

Comments
 (0)