Skip to content

Commit 7488b9f

Browse files
committed
wip!
1 parent c0b8c80 commit 7488b9f

File tree

1 file changed

+4
-16
lines changed
  • packages/angular/cli/src/command-builder/utilities

1 file changed

+4
-16
lines changed

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

Lines changed: 4 additions & 16 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

@@ -48,42 +47,31 @@ export async function formatFiles(cwd: string, files: Set<string>): Promise<void
4847
const prettierPackageJson = JSON.parse(await readFile(prettierPath, 'utf-8')) as {
4948
bin: string;
5049
};
50+
5151
prettierCliPath = join(dirname(prettierPath), prettierPackageJson.bin);
5252
} catch {
5353
// Prettier is not installed.
5454
prettierCliPath = null;
5555
}
5656
}
5757

58-
console.log({ prettierCliPath });
5958
if (!prettierCliPath) {
6059
return;
6160
}
6261

6362
const filesToFormat: string[] = [];
6463
for (const file of files) {
6564
if (fileTypes.has(extname(file))) {
66-
filesToFormat.push(`"${file}"`);
65+
filesToFormat.push(file);
6766
}
6867
}
6968

7069
if (!filesToFormat.length) {
7170
return;
7271
}
7372

74-
console.log({ filesToFormat, cwd });
75-
76-
console.log(
77-
await execFileAsync(prettierCliPath, ['--check', ...filesToFormat], {
78-
cwd,
79-
shell: platform() === 'win32',
80-
}),
81-
);
82-
83-
const x = await execFileAsync(prettierCliPath, ['--write', ...filesToFormat], {
73+
await execFileAsync(process.execPath, [prettierCliPath, '--write', ...filesToFormat], {
8474
cwd,
85-
shell: platform() === 'win32',
75+
shell: false,
8676
});
87-
88-
console.log({ x });
8977
}

0 commit comments

Comments
 (0)