UNPKG

crootfast

Version:

大前端工程化命令行脚手架

44 lines (37 loc) 1.44 kB
const fs = require('fs'); const { getwebpropath } = require('./index'); const { pathJoin, getclipath } = require('../../../../common/utils/path'); // const { pathJoin, getclipath } = require("../../common/utils/index"); function frameConfigPath(frame) { return pathJoin(`webPackServer/config/${frame}/index`, getclipath('.')); }; function resolveIndexHtml(frame, appname) { const projectIndexHTMLPath = pathJoin(`apps/${frame}/${appname}/public`, getwebpropath('.')); const projectIndexHTML = pathJoin(`apps/${frame}/${appname}/public/index.html`, getwebpropath('.')); // console.log(projectIndexHTMLPath, projectIndexHTML); if (fs.existsSync(projectIndexHTMLPath) && fs.existsSync(projectIndexHTML)) { return projectIndexHTML; } if (!fs.existsSync(projectIndexHTMLPath)) { throw `apps/${frame}/${appname}中缺少 public 文件夹。`; } if (!fs.existsSync(projectIndexHTMLPath)) { throw `apps/${frame}/${appname}/public 中缺少 index.html 文件。`; } }; function resolveAppnameDir(frame, appname) { return pathJoin(`apps/${frame}/${appname}`, getwebpropath('.')); }; function resolveClientShare() { return pathJoin(`shared`, getwebpropath('.')); }; function resolveReactFrame() { return pathJoin(`node_modules/.pnpm/react-dom@18.2.0_react@18.2.0`, getclipath('./')) } module.exports = { frameConfigPath, resolveIndexHtml, resolveAppnameDir, resolveClientShare, resolveReactFrame };