UNPKG

@modern-js/utils

Version:

A Progressive React Framework for modern web development.

19 lines (18 loc) 746 B
import path from "path"; import { CONFIG_FILE_EXTENSIONS } from "../constants.mjs"; import { findExists } from "../fs.mjs"; export * from "./data.mjs"; export * from "./config.mjs"; const getServerConfig = async (appDirectory, configFile)=>{ const configFilePath = findExists(CONFIG_FILE_EXTENSIONS.map((extension)=>path.resolve(appDirectory, `${configFile}${extension}`))); return configFilePath; }; const getMeta = (metaName = 'modern-js')=>{ const meta = metaName.toLowerCase().split('-')[0]; return meta; }; const getTargetDir = (from, baseDir, targetBaseDir)=>{ const relativePath = path.relative(baseDir, from); return path.resolve(targetBaseDir, relativePath); }; export { getMeta, getServerConfig, getTargetDir };