UNPKG

constatic

Version:

Constatic is a CLI for creating and managing modern TypeScript projects, providing an organized structure and features that streamline development.

29 lines (27 loc) 641 B
// src/cli/config.ts import { cliLang, detectLanguage, equalsIgnoringCase } from "#helpers"; import Conf from "conf"; import path from "node:path"; class CLIConfig extends Conf { static init(name) { const conf = new this({ projectName: name, defaults: { "discord.bot.tokens": [], "presets.scripts": [], lang: detectLanguage() } }); cliLang.set(conf.get("lang")); return conf; } get dirname() { return path.dirname(this.path); } getToken(name) { return this.get("discord.bot.tokens", []).find((t) => equalsIgnoringCase(t.name, name)); } } export { CLIConfig };