Skip to content

Commit fe06d29

Browse files
committed
refactor(@angular/cli): execute Prettier using node and remove unnecessary arguments and shell option
This fixes the formatting on Windows.
1 parent 80c572b commit fe06d29

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

packages/angular/cli/src/command-builder/utilities/prettier.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import { execFile } from 'node:child_process';
1010
import { readFile } from 'node:fs/promises';
1111
import { createRequire } from 'node:module';
12-
import { platform } from 'node:os';
1312
import { dirname, extname, join } from 'node:path';
1413
import { promisify } from 'node:util';
1514

@@ -72,11 +71,11 @@ export async function formatFiles(cwd: string, files: Set<string>): Promise<void
7271
}
7372

7473
await execFileAsync(
75-
prettierCliPath,
76-
['--write', '--no-error-on-unmatched-pattern', ...filesToFormat],
74+
process.execPath,
75+
[prettierCliPath, '--write', '--no-error-on-unmatched-pattern', ...filesToFormat],
7776
{
7877
cwd,
79-
shell: platform() === 'win32',
78+
shell: false,
8079
},
8180
);
8281
}

packages/schematics/angular/workspace/files/.prettierrc renamed to packages/schematics/angular/workspace/files/.prettierrc.template

File renamed without changes.

0 commit comments

Comments
 (0)