@visulima/tsconfig
Version:
Find and/or parse the tsconfig.json file from a directory path.
19 lines (16 loc) • 863 B
JavaScript
import { writeJsonSync, writeJson } from '@visulima/fs';
import { toPath } from '@visulima/fs/utils';
import { join } from '@visulima/path';
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
const writeTsConfig = /* @__PURE__ */ __name(async (tsConfig, options = {}) => {
const { cwd, ...writeOptions } = options;
const directory = toPath(cwd ?? process.cwd());
await writeJson(join(directory, "tsconfig.json"), tsConfig, writeOptions);
}, "writeTsConfig");
const writeTsConfigSync = /* @__PURE__ */ __name((tsConfig, options = {}) => {
const { cwd, ...writeOptions } = options;
const directory = toPath(cwd ?? process.cwd());
writeJsonSync(join(directory, "tsconfig.json"), tsConfig, writeOptions);
}, "writeTsConfigSync");
export { writeTsConfig, writeTsConfigSync };