12345678910111213141516171819202122232425262728293031323334353637383940 |
- var path = require('path');
- var fs = require('fs');
- var sftp = require('./uploadSftp');
- var rimraf = require('rimraf');
- var nativePath = `dist/temp`;
- //创建临时目录
- fs.mkdirSync(nativePath);
- var indexHtml = fs.readFileSync('dist/index.html');
- fs.writeFileSync(nativePath + path.sep + 'index.html', indexHtml);
- var h5Html = fs.readFileSync('dist/h5.html');
- fs.writeFileSync(nativePath + path.sep + 'h5.html', h5Html);
- // var shareHtml = fs.readFileSync('dist/login.html');
- // fs.writeFileSync(nativePath + path.sep + 'login.html', shareHtml);
- // var consoleHtml = fs.readFileSync('dist/console.html');
- // fs.writeFileSync(nativePath + path.sep + 'console.html', consoleHtml);
- var serverPath = `/var/www/queenshow/stat`;
- var ftpUtils = new sftp({
- remotePath: serverPath,
- path: nativePath,
- username: 'root',
- password: 'MmxInfish@2020',
- host: '124.71.139.24',
- verbose: true,
- });
- ftpUtils.apply(function () {
- //删除maps文件夹
- rimraf.sync(nativePath);
- console.log(`ftp upload success!`);
- });
|