# go-upload-front-file **Repository Path**: ldlw/go-upload-front-file ## Basic Information - **Project Name**: go-upload-front-file - **Description**: golang实现前端打包上传linux - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-12-19 - **Last Updated**: 2023-12-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: Go语言 ## README # golang实现前端打包上传linux > 为了前端打包测试环境部署方便,已经实现核心功能,有不同场景可以改源码 ## 实现方式 在config.json里面配置对应的东西,在本地实现实现打包前端dist文件,并压缩成dist.zip文件, 通过sftp把这个文件上传linux指定的目录,然后再通过shell解压dist.zip,替换删除原来的dist目录 ## 配置说明 在项目根目录有一个config.json ```json { "sshKey": "linux服务器生成的密钥路径,一般放在根目录,填写示例:'../id_rsa'", "sshHost": "linux连接IP地址", "sshUser": "linux连接用户名", "sshPassWord": "linux连接密码", "sshPort": "linux连接端口", "localFilePath": "打包后的zip目录,填写示例:'../vue/dist.zip'", "remoteDir": "linux服务器上部署的目录,填写示例:'/tmp'" } 注意: 登录方式SshKey和sshPassWord填一个即可,优先使用SshKey的密钥路径 ``` ## 运行与打包 ``` go run index.go go build index.go ``` ## 目录说明 ``` go-upload-front-file ├─ .gitignore git忽略文件 ├─ config.json 配置文件 ├─ encodejson 读取解析配置文件 │ └─ index.go ├─ go.mod gomod提供依赖 ├─ go.sum ├─ index.exe 打包后的exe ├─ index.go 项目主入口文件 ├─ mysftp sftp相关 │ └─ index.go ├─ myssh ssh相关 │ └─ index.go ├─ readme.md readme文档 └─ vue 用来vue打包测试的 ├─ .gitignore ├─ babel.config.js ├─ jsconfig.json ├─ package-lock.json ├─ package.json ├─ public │ ├─ favicon.ico │ └─ index.html ├─ README.md ├─ src │ ├─ App.vue │ ├─ assets │ │ └─ logo.png │ ├─ components │ │ └─ HelloWorld.vue │ └─ main.js └─ vue.config.js ```