Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,14 @@ export function subscribeToWorkflow(
logs.push(`${colors.yellow('DELETE')} ${eventPath}`);
files.add(eventPath);
break;
case 'rename':
logs.push(`${colors.blue('RENAME')} ${eventPath} => ${removeLeadingSlash(event.to)}`);
files.add(eventPath);
case 'rename': {
const newFilename = removeLeadingSlash(event.to);

logs.push(`${colors.blue('RENAME')} ${eventPath} => ${newFilename}`);
files.add(newFilename);

break;
}
}
});

Expand Down
32 changes: 2 additions & 30 deletions packages/angular/cli/src/utilities/prettier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,12 @@
import { execFile } from 'node:child_process';
import { readFile } from 'node:fs/promises';
import { createRequire } from 'node:module';
import { dirname, extname, join } from 'node:path';
import { dirname, join } from 'node:path';
import { promisify } from 'node:util';

const execFileAsync = promisify(execFile);
let prettierCliPath: string | null | undefined;

/**
* File types that can be formatted using Prettier.
*/
const fileTypes: ReadonlySet<string> = new Set([
'.md',
'.ts',
'.html',
'.js',
'.mjs',
'.cjs',
'.json',
'.css',
'.less',
'.scss',
'.sass',
]);

/**
* Formats files using Prettier.
* @param cwd The current working directory.
Expand Down Expand Up @@ -59,20 +42,9 @@ export async function formatFiles(cwd: string, files: Set<string>): Promise<void
return;
}

const filesToFormat: string[] = [];
for (const file of files) {
if (fileTypes.has(extname(file))) {
filesToFormat.push(file);
}
}

if (!filesToFormat.length) {
return;
}

await execFileAsync(
process.execPath,
[prettierCliPath, '--write', '--no-error-on-unmatched-pattern', ...filesToFormat],
[prettierCliPath, '--write', '--no-error-on-unmatched-pattern', ...files],
{
cwd,
shell: false,
Expand Down