How vue projects are automatically packaged and uploaded to the server through scripts

problem description

when deploying front-end projects, you can manually type: npm run build
build on the command line, and then manually enter the server address, directory, and password to the server
. It is very troublesome
whether you can write a script or something, and you only need to enter a command to complete the above actions

.

PS: projects are mostly built by vue-cli webpack templates

methods have been found. Thank you

this is the solution I found:
" simple configuration front-end project realizes that the files are automatically uploaded to the server after being packaged.
I have never used the gulp-sftp used in the article, and I don"t know where it is not configured. I usually upload it using scp, so instead of gulp-scp2, except for slight changes in the gulp configuration file, the rest is the same, paste the configuration:

const gulp = require("gulp")
const scp = require("gulp-scp2")

gulp.task("default", () => {
  console.log("")
  return gulp.src("./dist/**/*")
    .pipe(scp({
      host: "hostname",
      username: "username",
      password: "password",
      dest: "/home/admin/",
      watch: function(client) {
        client.on("write", function(o) {
          console.log("write %s", o.destination);
        });
      }
    }))
    .on("error", (err) => {
      console.log(err)
    })
    .on("end", () => {
      console.log("")
    })
})

personal test is valid, gulp likes upupup


if you upload, you can use gulp,package.json and package it first in upload. Like this, npm run bulid & & gulp cdn;


jenkins Automation deployment understands that all the functions you want have


this is not the job of js
automatic deployment Google

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36da6-2c050.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36da6-2c050.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?