美文网首页
用.bat自动打包上传

用.bat自动打包上传

作者: 你的时间非常值钱 | 来源:发表于2019-10-10 10:07 被阅读0次
@echo off

call npm run build
git add .
if not %1% == '' (
  git commit -m'%1%' -n
) else (
  git commit -m'auto' -n
)

git push

echo close after 30 seconds
choice /t 30 /d y /n >nul
exit

为什么要先build再提交,而不是直接提交然后在服务器里build,因为每次提交整个项目都会先删除,考虑到3个问题
1.没有yarn.lock或package.lock.json里面的版本依赖变化了
2.又要重新安装包
3.不能利用dll缓存打包的优势
PS: git commit 加了 -n(-no-verify)跳过了代码校验,不是一个好习惯,这里只是为了快速部署

相关文章

网友评论

      本文标题:用.bat自动打包上传

      本文链接:https://www.haomeiwen.com/subject/skropctx.html