seia.js
Version:
Lightweight SSR framework for React Server Components
28 lines (27 loc) • 802 B
JavaScript
import { readFile } from 'node:fs/promises';
import { join } from 'node:path';
import { cwd } from 'node:process';
import { Command } from '@oclif/core';
import { parse } from 'toml';
import { resolveSeiaConfig } from './config.js';
export class SeiaCommand extends Command {
static enableJsonFlag = true;
resolvedConfig;
async init() {
await super.init();
let configString;
try {
configString = (await readFile(join(cwd(), 'seia.toml'))).toString();
} catch {
configString = '';
}
const rawConfig = parse(configString);
this.resolvedConfig = resolveSeiaConfig(rawConfig);
}
async catch(error) {
return super.catch(error);
}
async finally(_) {
return super.finally(_);
}
}