How to write this shell function? Automatically publish front-end projects

function automatically uploads the files packaged at the front end under my window to the centos directory
simply throws my files to the specified directory without jenkins

May.22,2021

give me an idea

  1. execute the build script to compile the file
  2. After
  3. build is executed, call scp to copy the file directly to the service directory

wrote a simple sync script, you can refer to

var fs = require('fs')
var path = require('path')
var cp = require('child_process')

function release(src, dist, remote) {
  var script = `scp ${src} ${remote}/${dist}`
  cp.exec(script, function (err, stdout, stderr) {
      if (err) {
        console.log(`error: ${err}`)
        return
      }
      console.log(`stdout: ${stdout}`)
      console.log(`stderr: ${stderr}`)
  })
}
Menu