在你的vue项目根目录新建deploy.js,内容如下:
const path = require('path')
const NginxConfFile = require('nginx-conf').NginxConfFile
const {
exec } = require('child_process')
const fs = require('fs')
const {
COPYFILE_EXCL } = fs.constants
const appName = 'test'
const nginxpath = 'E:/deploy/nginx-1.18.0/nginx-1.18.0'
function createFile (resource, target) {
// 通过使用 COPYFILE_EXCL,如果目标文件存在,则操作将失败。
fs.copyFileSync(resource, target, COPYFILE_EXCL)
}
exec(`cd ${