@@ -5,7 +5,6 @@ const fs = require('fs');
55const path = require ( 'path' ) ;
66const keepAsset = require ( './keepAsset' ) ;
77const { NodeSSH} = require ( 'node-ssh' ) ;
8- const sshConfig = require ( './ssh.json' ) ;
98const zlib = require ( 'zlib' ) ;
109
1110const npmCmd = / ^ w i n / . test ( process . platform ) ? 'npm.cmd' : 'npm' ;
@@ -19,6 +18,13 @@ child.stdout.on('data', (chunk) => {
1918const publicPath = __dirname + '/public/' ;
2019const distPath = __dirname + '/dist/' ;
2120
21+ let sshConfig ;
22+ try {
23+ sshConfig = fs . readFileSync ( path . join ( __dirname , 'ssh.json' ) , 'utf8' ) ;
24+ } catch ( err ) {
25+ console . log ( 'No SSH config, skipping upload' ) ;
26+ }
27+
2228function copyFiles ( source , destination ) {
2329 if ( ! fs . existsSync ( destination ) ) {
2430 fs . mkdirSync ( destination ) ;
@@ -81,6 +87,10 @@ const onCompiled = async() => {
8187 copyFiles ( distPath , publicPath ) ;
8288 clearOldFiles ( ) ;
8389
90+ if ( ! sshConfig ) {
91+ return ;
92+ }
93+
8494 const archiveName = 'archive.zip' ;
8595 const archivePath = path . join ( __dirname , archiveName ) ;
8696 execSync ( `zip -r ${ archivePath } *` , {
0 commit comments