123456789101112131415161718192021222324252627282930313233343536373839404142 |
- 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 editHtml = fs.readFileSync('dist/editor.html');
- fs.writeFileSync(nativePath + path.sep + 'editor.html', editHtml);
- var shareHtml = fs.readFileSync('dist/share.html');
- fs.writeFileSync(nativePath + path.sep + 'share.html', shareHtml);
- // 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`;
- 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!`);
- });
|