UNPKG

@storm-software/k8s-tools

Version:

Tools for managing Kubernetes (k8s) infrastructure within a Nx workspace.

56 lines (53 loc) 1.25 kB
import { __require } from "./chunk-KBO64DJX.mjs"; // src/utils/prettier.ts async function resolveUserExistingPrettierConfig() { let prettier; try { prettier = __require("prettier"); } catch { return void 0; } if (!prettier) { return void 0; } try { const filepath = await prettier.resolveConfigFile(); if (!filepath) { return void 0; } const config = await prettier.resolveConfig(process.cwd(), { useCache: false, config: filepath }); if (!config) { return void 0; } return { sourceFilepath: filepath, config }; } catch { return void 0; } } function addToPrettierIgnore(tree, ignore) { const ignorePath = `${tree.root}/.prettierignore`; if (!tree.exists(ignorePath)) { tree.write(ignorePath, ignore.join("\n")); return; } try { const content = tree.read(ignorePath, "utf8") || ""; const lines = content.split("\n"); const newContent = [.../* @__PURE__ */ new Set([...lines, ...ignore])].join("\n"); tree.write(ignorePath, newContent); } catch (error) { throw new Error(`Failed to update .prettierignore file: ${String(error)}`); } } export { resolveUserExistingPrettierConfig, addToPrettierIgnore };