@reliverse/rse
Version:
@reliverse/rse is your all-in-one companion for bootstrapping and improving any kind of projects (especially web apps built with frameworks like Next.js) — whether you're kicking off something new or upgrading an existing app. It is also a little AI-power
22 lines (21 loc) • 836 B
JavaScript
import path from "@reliverse/pathkit";
import fs from "@reliverse/relifso";
export async function hasConfigFiles(projectPath) {
try {
const files = await fs.readdir(projectPath);
return files.some(
(file) => (file.endsWith(".jsonc") || file.endsWith(".ts")) && !file.includes("mrse.")
);
} catch (_err) {
return false;
}
}
export async function isMrseProject(projectPath) {
const configPath = path.join(projectPath, ".config");
const mrseFolderPath = path.join(projectPath, ".config", "mrse");
const hasMrseConfig = await Promise.all([
fs.pathExists(path.join(configPath, "mrse.ts")),
fs.pathExists(path.join(configPath, "mrse.jsonc"))
]).then(([hasTs, hasJsonc]) => hasTs || hasJsonc);
return hasMrseConfig && await fs.pathExists(mrseFolderPath) && await hasConfigFiles(mrseFolderPath);
}