centos7本地部署element-plus
element-plus官网实在是太不稳定了,所以自己搭建了一套在本地,流程如下:
-
环境安装
yum install git yum install nodejs npm install -g pnpm
-
从gitee拉取代码
wget -P /opt/element-plus https://gitee.com/element-plus/element-plus/repository/archive/dev.zip 这代表代码的压缩文件被下载到了/opt/element-plus,解压此压缩包 cd /opt/element-plus unzip dev.zip 得到了element-plus-dev源代码 cd /element-plus-dev/docs 安装依赖包 pnpm install
-
打包发布
先本地化一下语言,npm run gen-locale 再执行打包命令,npm run build 一般这个时候会报错,内存溢出,89691 ms: Mark-sweep 902.2 (931.7) -> 898.0 (932.4) MB, 511.4 / 0.1 ms (average mu = 0.217, current mu = 0.132) allocation failure scavenge might not succeed 解决方法如下:npm install -g increase-memory-limit 在项目目录doc路径下:increase-memory-limit 然后再打包就可以完成,生产的dist文件夹在docs/.vitepress/dist 把这个dist挂到nginx,即可丝滑访问
-
从gitee持续拉取,获取最新版文档
(1) 编写shell脚本vim /opt/element-plus/deploy.sh 并添加执行权限,chmod 777 deploy.sh
#!/bin/bash rm -rf /opt/element-plus/dev.zip rm -rf /opt/element-plus/element-plus-dev/ wget -P /opt/element-plus https://gitee.com/element-plus/element-plus/repository/archive/dev.zip cd /opt/element-plus unzip dev.zip cd /opt/element-plus/element-plus-dev/docs pnpm install increase-memory-limit npm run gen-locale npm run build
(2) 配置定时任务
检查有没有crontab服务,`systemctl status crond.service`, 如果有,设置开机自动运行,`systemctl enable crond.service` 如果没有,`yum install crontabs`,完了也enable一下,开机自启动 配置定时拉取任务,`crontab -e` `0 1 * * * sh /opt/element-plus/deploy.sh`
-
完工
遗憾就是发布出来的是英文版的,中文版还不知道怎么弄
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?