UNPKG

@storm-software/k8s-tools

Version:

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

56 lines (49 loc) 1.43 kB
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _chunkRECJ3G6Fjs = require('./chunk-RECJ3G6F.js'); // src/utils/prettier.ts async function resolveUserExistingPrettierConfig() { let prettier; try { prettier = _chunkRECJ3G6Fjs.__require.call(void 0, "prettier"); } catch (e) { 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 (e2) { 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)}`); } } exports.resolveUserExistingPrettierConfig = resolveUserExistingPrettierConfig; exports.addToPrettierIgnore = addToPrettierIgnore;