Skip to content

Commit

Permalink
fix(@angular-devkit/schematics): replace template line endings with p…
Browse files Browse the repository at this point in the history
…latform 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)
  • Loading branch information
alan-agius4 committed Jan 3, 2024
1 parent eec44d0 commit 88d6ca4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/angular_devkit/schematics/src/rules/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

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

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

return {
path,
Expand Down

0 comments on commit 88d6ca4

Please sign in to comment.