'use strict'const chalk = require('chalk')const ora = require('ora')const path = require('path')const { sh } = require('tasksfile')var FtpDeploy = require('ftp-deploy')var ftpDeploy = new FtpDeploy()console.log(chalk.yellow('Cordova www Build start.\n'))sh('cd ../ && cordova-hcp build')console.log(chalk.green('==== 1.热更新配置文件更新完成 ====.\n'))sh('cd ../ && cordova build android')console.log(chalk.green('==== 2.apk 打包完成 ====.\n'))var config = { user: '', password: '', host: '', port: 21, localRoot: path.resolve(__dirname, '../../www'), remoteRoot: '/public/download/merchant_app/latest/www', include: ['*', '**/*'], // 这样会上传所有文件 // include: ['*.php', 'dist/*', '.*'], // e.g. exclude sourcemaps, and ALL files in node_modules (including dot files) // exclude: ['dist/**/*.map', 'node_modules/**', 'node_modules/**/.*', '.git/**'], // 如果为true,则在上载之前删除目标上的所有现有文件 deleteRemote: true, // Passive mode is forced (EPSV command is not sent) forcePasv: false}const spinner = ora('文件上传中')spinner.start()ftpDeploy .deploy(config) .then(res => { spinner.stop() console.log(chalk.green('==== 3.热更新文件上传完成 ====.\n')) }) .catch(err => console.log(err))