1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > linux环境 前端开发环境搭建 Linux运维知识之linux 前端环境搭建

linux环境 前端开发环境搭建 Linux运维知识之linux 前端环境搭建

时间:2023-06-23 21:04:31

相关推荐

linux环境 前端开发环境搭建 Linux运维知识之linux 前端环境搭建

本文主要向大家介绍了Linux运维知识之linux 前端环境搭建,通过具体的内容向大家展现,希望对大家学习Linux运维知识有所帮助。

1.下载node.js

2.在linux里使用wget命令

wget/dist/latest-v6.x/node-v6.12.3-linux-x64.tar.gz

3.解压缩

tar-xzvfnode-v6.12.3-linux-x64.tar.gz

4.将node移到/usr/local目录下

cd/usr/local

mv~/node-v6.12.3-linux-x64./

5.添加环境变量

vim/etc/profile

6.添加node路径

NODE_HOME=/usr/local/node-v6.12.3-linux-x64

PATH=$PATH:$JAVA_HOME/bin:$NODE_HOME/bin

exportPATHJAVA_HOMECLASSPATHNODE_HOME

7.重新加载文件

source/etc/profile

8.安装webpack

npminstallwebpack-g

9.创建git代码目录

10.安装git

yum-yinstallgit

11.拉代码

gitclone

12.进入项目文件夹,安装依赖

npminstall--registry=https://registry.

13.打包这里执行

npmrunmydist

14.创建生产文件夹

cd/

mkdirproduct

cdproduct

#前端项目目录

mkdirfrontend

cdfrontend

#项目目录

mkdirmall-fe

15.将dist文件复制到项目目录下

mv/developer/git-repository/mall-fe/dist/product/frontend/mall-fe/dist

16.编写自动化脚本将上面的发布过程自动化

在/developer目录下创建并编辑vimfe-deploy.sh

#

GIT_HOME=/developer/git-repository/

DEST_PATH=/product/frontend/

#cddir

if[!-n"$1"];

then

echo-e"pleaseentername!"

exit

fi

if[$1="mall-fe"];

then

echo-e"========Entermall-fe================"

cd$GIT_HOME$1

else

echo-e"notfound!"

exit

fi

#cleargitdist

echo-e"========ClearGitDist================"

rm-rf./dist

#git

echo-e"=======gitcheckoutmaster================"

gitcheckoutmaster

echo-e"=======gitpull================"

gitpull

echo-e"=======npminstall================"

npminstall--registry=https://registry.

#npmrunmydist

echo-e"=======npmrunmydist================"

npmrunmydist

if[-d"./dist"];

then

#backupdest

echo-e"================backupdist====================="

rm-rf$DEST_PATH$1/back/dist

mv$DEST_PATH$1/dist$DEST_PATH$1/back/dist

#copy

echo-e"=======copy================"

cp-R$GIT_HOME$1/dist$DEST_PATH$1

#echoresult

echo"=======DeploySuccess================"

else

echo"=======DeployError================"

fi

执行./fe-deploy.shmall-fe就可以进行自动化发布了

本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注系统运维Linux频道!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。