UNPKG

@reliverse/rse-sdk

Version:

@reliverse/rse-sdk without cli. @reliverse/rse-sdk allows you to create new plugins for @reliverse/rse CLI, interact with reliverse.org, and even extend your own CLI functionality (you may also try @reliverse/dler-sdk for this case).

22 lines (21 loc) 836 B
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); }