-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.js
31 lines (26 loc) · 917 Bytes
/
deploy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const FtpDeploy = require('ftp-deploy');
const ftpDeploy = new FtpDeploy();
const program = require('commander');
program
.version('1.0.0')
.option('-d, --data', 'Deploys only data json files')
.parse(process.argv);
const config = {
user: process.env.FTP_USER,
password: process.env.FTP_PASS,
host: process.env.FTP_HOST,
port: 21,
localRoot: __dirname + '/dist',
remoteRoot: '/public_html',
include: ['*', '**/*'], // this would upload everything except dot files
deleteRemote: true // delete existing files at destination before uploading
}
console.log('Preparing deployment...');
if (program.data) {
console.log('Deploy only data json files');
config.localRoot = __dirname + '/dist/data';
config.remoteRoot = '/public_html/data';
}
ftpDeploy.deploy(config)
.then(res => console.log('finished'))
.catch(err => console.log(err))