@jsverse/transloco-keys-manager
Version:
Extract translatable keys from projects that uses Transloco
23 lines • 776 B
JavaScript
import { writeFileSync } from 'node:fs';
import { readFile } from '../../utils/file.utils.js';
export async function runPrettier(filePaths) {
try {
const prettier = await import('prettier');
const options = await prettier.resolveConfig(filePaths[0]);
if (options) {
for (const filePath of filePaths) {
const formatted = await prettier.format(readFile(filePath), {
...options,
filepath: filePath,
});
writeFileSync(filePath, formatted);
}
}
}
catch (e) {
if (e.code !== 'MODULE_NOT_FOUND') {
console.warn('Failed to run prettier', e.message);
}
}
}
//# sourceMappingURL=run-prettier.js.map