@hubary/ftp-auto-upload

一款刀耕火种时期,提高生产效率的工具,用于删除/更新node打包后的文件到指定的服务器位置

Usage no npm install needed!

<script type="module">
  import hubaryFtpAutoUpload from 'https://cdn.skypack.dev/@hubary/ftp-auto-upload';
</script>

README

ftp-auto-upload

介绍

一款提高刀耕火种时期部署前端代码效率的神器,参考自deploy,进行修改和添加数据操作反馈,以及路径检测

安装

npm install @hubary/ftp-auto-upload -D

使用

1. 项目根目录新建ftp.config.js文件进行服务器的信息配置(可从包内复制)

module.exports = [
  {
    name: 'project-1-xxx',  // 项目1
    ssh: {
      host: '10.114.14.65',
      port: 22,
      username: 'test',
      password: '123456',
    },
    romotePath: '/home/front/dist',// 远程地址
    localPath: './dist',// 本地地址
    rootDir: 'dist',
    isTest: true, // 是否开启测试模式
  },
  {
    name: 'project-2-xxx',  // 项目2
    ssh: {
      host: '10.114.14.110',
      port: 22,
      username: 'test',
      password: '123456',
    },
    romotePath: '/home/front/dist',// 远程地址
    localPath: './dist',// 本地地址
    rootDir: 'dist',
    isTest: true, // 是否开启测试模式
  },
]

2 项目packages.json script 添加

{
  "scripts": {
    "upload": "node node_modules/@hubary/ftp-auto-upload"
  }
}

3 运行 npm run upload 即可删除/更新服务器指定位置代码

image