mirror of
https://github.com/sern-handler/cli
synced 2026-06-13 19:32:31 +00:00
* high hopes * s * plugin calling * add * eol * more progress * fmt * step 1 * refactor out * /internal route * prg * write handler * consolidate * fix version gen * prototype * out * fix merge * bundle presence and event modules * extrapolate into plugin * pluginify and simplify * fix up typing gen for process env and watch mode * watch * add nonpromptable plugins install * fix regression and clean up publish script * ea
28 lines
669 B
TypeScript
28 lines
669 B
TypeScript
import { findUp } from 'find-up';
|
|
import { readFile } from 'node:fs/promises';
|
|
import assert from 'node:assert';
|
|
|
|
|
|
export async function getConfig(): Promise<SernConfig> {
|
|
const sernLocation = await findUp('sern.config.json');
|
|
assert(sernLocation, "Can't find sern.config.json");
|
|
|
|
const output = JSON.parse(await readFile(sernLocation, 'utf8')) as SernConfig;
|
|
|
|
assert(output, "Can't read your sern.config.json.");
|
|
|
|
return output;
|
|
}
|
|
export interface SernConfig {
|
|
language: 'typescript' | 'javascript';
|
|
defaultPrefix?: string;
|
|
paths: {
|
|
base: string;
|
|
commands: string;
|
|
events?: string;
|
|
};
|
|
build?: {
|
|
|
|
}
|
|
}
|