Created
August 4, 2015 10:01
-
-
Save eyy/4638671c8edd4fea533c to your computer and use it in GitHub Desktop.
Deploy static site to FTP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('connecting ftp...') | |
var FTP = require('jsftp'), | |
async = require('async') | |
var ftp = new FTP({ | |
host: '', | |
port: 21, | |
user: '', | |
pass: '', | |
debugMode: true | |
}) | |
var from = './pub/', | |
to = '/' | |
var files = [ | |
'index.html', | |
'css/index.css', | |
'js/index.js' | |
] | |
async.series(files.map(function (file) { | |
return function (cb) { | |
console.log('uploading', file) | |
ftp.put(from + file, to + file, cb) | |
} | |
}), function (err) { | |
if (err) | |
console.error(err) | |
console.log('ok') | |
ftp.raw.quit() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment