-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.js
28 lines (22 loc) · 849 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
import {deployConfig} from './deployConfig.js';
import process from 'process';
import path from 'path';
import {exec} from 'child_process';
const {user, server, location, buildFolder = 'dist'} = deployConfig;
if (!user || !server || !location) {
console.error('== Missing config variables! Config supplied:');
console.error(deployConfig);
process.exit(1);
}
const deployFrom = path.resolve(path.dirname(process.argv[1]), buildFolder)
// Yes, yes, unsanitized data in `exec()`, I'm going to burn in infosec hell.
exec(`rsync -vrz --checksum --delete ${deployFrom}/ ${user}@${server}:${location}`, (error, stdout, stderr) => {
if (error) {
console.error('== Deploy failed.');
console.error(stderr);
process.exit(1)
}
console.log('== Deploy successful. Rsync said:')
console.log(stdout);
})
//